def pre(cfg): name = cfg["method"] sigma = cfg["sigma"] scale = cfg["scale"] K = cfg["K"] kernel = RBFKernel(sigma=sigma,scale=scale) fastLogDet = FastIVM(K, kernel, 1.0) if name == "Greedy": opt = Greedy(K, fastLogDet) if name == "IndependentSetImprovement": opt = IndependentSetImprovement(K, fastLogDet) elif name == "Random": opt = Random(K, fastLogDet, cfg["run_id"]) elif name == "SieveStreaming": e = cfg["epsilon"] opt = SieveStreaming(K, fastLogDet, 1.0, e) elif name == "SieveStreaming++": e = cfg["epsilon"] opt = SieveStreamingPP(K, fastLogDet, 1.0, e) elif name == "Salsa": e = cfg["epsilon"] opt = Salsa(K, fastLogDet, 1.0, e) elif name == "ThreeSieves": e = cfg["epsilon"] T = cfg["T"] opt = ThreeSieves(K, fastLogDet, 1.0, e, "sieve", T) return opt
### SieveStreaming ### optimizers["SieveStreaming with IVM + RBF"] = SieveStreaming(K, ivm_rbf, 1.0, 0.1) optimizers["SieveStreaming with IVM + poly kernel class"] = SieveStreaming(K, ivm_custom_kernel_class, 1.0, 0.5) optimizers["SieveStreaming with IVM + poly kernel function"] = SieveStreaming(K, ivm_custom_kernel_function, 1.0, 0.5) optimizers["SieveStreaming with custom IVM class"] = SieveStreaming(K, ivm_custom_class, 1.0, 0.1) optimizers["SieveStreaming with custom IVM function"] = SieveStreaming(K, ivm_custom_function, 1.0, 0.1) ### SieveStreamingPP ### optimizers["SieveStreamingPP with IVM + RBF"] = SieveStreamingPP(K, ivm_rbf, 1.0, 0.1) optimizers["SieveStreamingPP with IVM + poly kernel class"] = SieveStreamingPP(K, ivm_custom_kernel_class, 1.0, 0.1) optimizers["SieveStreamingPP with IVM + poly kernel function"] = SieveStreamingPP(K, ivm_custom_kernel_function, 1.0, 0.1) optimizers["SieveStreamingPP with custom IVM class"] = SieveStreamingPP(K, ivm_custom_class, 1.0, 0.1) optimizers["SieveStreamingPP with custom IVM function"] = SieveStreamingPP(K, ivm_custom_function, 1.0, 0.1) ### Salsa ### optimizers["Salsa with IVM + RBF"] = Salsa(K, ivm_rbf, 1.0, 0.1) optimizers["Salsa with IVM + poly kernel class"] = Salsa(K, ivm_custom_kernel_class, 1.0, 0.1) optimizers["Salsa with IVM + poly kernel function"] = Salsa(K, ivm_custom_kernel_function, 1.0, 0.1) optimizers["Salsa with custom IVM class"] = Salsa(K, ivm_custom_class, 1.0, 0.1) optimizers["Salsa with custom IVM function"] = Salsa(K, ivm_custom_function, 1.0, 0.1) ### ThreeSieves ### optimizers["ThreeSieves with IVM + RBF"] = ThreeSieves(K, ivm_rbf, 1.0, 0.1, "sieve",5) optimizers["ThreeSieves with IVM + poly kernel class"] = ThreeSieves(K, ivm_custom_kernel_class, 1.0, 0.01, "sieve",1) optimizers["ThreeSieves with IVM + poly kernel function"] = ThreeSieves(K, ivm_custom_kernel_function, 1.0, 0.01, "sieve",1) optimizers["ThreeSieves with custom IVM class"] = ThreeSieves(K, ivm_custom_class, 1.0, 0.1, "sieve",5) optimizers["ThreeSieves with custom IVM function"] = ThreeSieves(K, ivm_custom_function, 1.0, 0.1, "sieve",5) failed = False for name, opt in optimizers.items(): opt.fit(X)