本文整理匯總了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")