本文整理汇总了Python中weka.flow.control.Flow.save方法的典型用法代码示例。如果您正苦于以下问题:Python Flow.save方法的具体用法?Python Flow.save怎么用?Python Flow.save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weka.flow.control.Flow
的用法示例。
在下文中一共展示了Flow.save方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from weka.flow.control import Flow [as 别名]
# 或者: from weka.flow.control.Flow import save [as 别名]
def main():
"""
Just runs some example code.
"""
# setup the flow
flow = Flow(name="list files")
listfiles = ListFiles()
listfiles.config["dir"] = str(helper.get_data_dir())
listfiles.config["list_files"] = True
listfiles.config["list_dirs"] = False
listfiles.config["recursive"] = False
listfiles.config["regexp"] = ".*.arff"
flow.actors.append(listfiles)
tee = Tee()
flow.actors.append(tee)
convert = Convert()
convert.config["setup"] = conversion.PassThrough()
tee.actors.append(convert)
console = Console()
console.config["prefix"] = "Match: "
tee.actors.append(console)
load = LoadDataset()
load.config["use_custom_loader"] = True
flow.actors.append(load)
cross = CrossValidate()
cross.config["setup"] = Classifier(classname="weka.classifiers.trees.J48", options=["-C", "0.3"])
flow.actors.append(cross)
summary = EvaluationSummary()
summary.config["matrix"] = True
flow.actors.append(summary)
# print flow
flow.setup()
print("\n" + flow.tree + "\n")
# save the flow
fname = tempfile.gettempdir() + os.sep + "simpleflow.json"
Flow.save(flow, fname)
# load flow
fl2 = Flow.load(fname)
# output flow
fl2.setup()
print("\n" + fl2.tree + "\n")