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
ivm_custom_class = FastLogdet(K) ivm_custom_function = ivm optimizers = {} ### GREEDY ### optimizers["Greedy with IVM + RBF"] = Greedy(K, ivm_rbf) optimizers["Greedy with IVM + poly kernel class"] = Greedy(K, ivm_custom_kernel_class) optimizers["Greedy with IVM + poly kernel function"] = Greedy(K, ivm_custom_kernel_function) optimizers["Greedy with custom IVM class"] = Greedy(K, ivm_custom_class) optimizers["Greedy with custom IVM function"] = Greedy(K, ivm_custom_function) ### Random ### # We "optimize" over the random seeds so that the solution matches the target solution and we do not need to distinguish # between Random and the other optimizers optimizers["Random with IVM + RBF"] = Random(K, ivm_rbf, 12345) optimizers["Random with IVM + poly kernel class"] = Random(K, ivm_custom_kernel_class, 22222) optimizers["Random with IVM + poly kernel function"] = Random(K, ivm_custom_kernel_function, 22222) optimizers["Random with custom IVM class"] = Random(K, ivm_custom_class, 12345) optimizers["Random with custom IVM function"] = Random(K, ivm_custom_function, 12345) ### IndependentSetImprovement ### optimizers["IndependentSetImprovement with IVM + RBF"] = IndependentSetImprovement(K, ivm_rbf) optimizers["IndependentSetImprovement with IVM + poly kernel class"] = IndependentSetImprovement(K, ivm_custom_kernel_class) optimizers["IndependentSetImprovement with IVM + poly kernel function"] = IndependentSetImprovement(K, ivm_custom_kernel_function) optimizers["IndependentSetImprovement with custom IVM class"] = IndependentSetImprovement(K, ivm_custom_class) optimizers["IndependentSetImprovement with custom IVM function"] = IndependentSetImprovement(K, ivm_custom_function) ### 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)