in scripts/vw-hyperopt.py [0:0]
def string_to_pyll(self):
line = shlex.split(self.command)
algorithms = ["sgd"]
for arg in line:
arg, value = arg.split("=")
if arg == "--algorithms":
algorithms = set(self.range_pattern.findall(value)[0].split(","))
if tuple(self.distr_pattern.findall(value)) not in {(), ("O",)}:
raise ValueError(
(
"Distribution options are prohibited for --algorithms flag. "
"Simply list the algorithms instead (like --algorithms=ftrl,sgd)"
)
)
elif self.distr_pattern.findall(value) == ["O"]:
algorithms.add("sgd")
for algo in algorithms:
if algo not in self.algorithm_metadata:
raise NotImplementedError(
("%s algorithm is not found. " "Supported algorithms by now are %s")
% (algo, str(self.algorithm_metadata.keys()))
)
break
self.space = {
algo: {"type": algo, "argument": self.algorithm_metadata[algo]["arg"]}
for algo in algorithms
}
for algo in algorithms:
for arg in line:
arg, value = arg.split("=")
if arg == "--algorithms":
continue
if arg not in self.algorithm_metadata[algo]["prohibited_flags"]:
distrib = self._process_vw_argument(arg, value, algo)
self.space[algo][arg] = distrib
else:
pass
self.space = hp.choice("algorithm", self.space.values())