本文整理汇总了Python中disco.core.Job.params["accuracy"]方法的典型用法代码示例。如果您正苦于以下问题:Python Job.params["accuracy"]方法的具体用法?Python Job.params["accuracy"]怎么用?Python Job.params["accuracy"]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类disco.core.Job
的用法示例。
在下文中一共展示了Job.params["accuracy"]方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fit
# 需要导入模块: from disco.core import Job [as 别名]
# 或者: from disco.core.Job import params["accuracy"] [as 别名]
def fit(dataset, trees_per_chunk=1, bootstrap=True, max_tree_nodes=50, min_samples_leaf=10, min_samples_split=5,
class_majority=1, separate_max=True, measure="info_gain", accuracy=1, random_state=None, save_results=True,
show=False):
from disco.worker.pipeline.worker import Worker, Stage
from disco.core import Job
import discomll
path = "/".join(discomll.__file__.split("/")[:-1] + ["ensemble", "core", ""])
try:
trees_per_chunk = int(trees_per_chunk)
max_tree_nodes = int(max_tree_nodes) if max_tree_nodes != None else max_tree_nodes
min_samples_leaf = int(min_samples_leaf)
min_samples_split = int(min_samples_split)
class_majority = float(class_majority)
accuracy = int(accuracy)
separate_max = separate_max
if trees_per_chunk > 1 and bootstrap == False:
raise Exception("Parameter trees_per_chunk (or Trees per subset) should be 1 to disable bootstrap.")
if trees_per_chunk <= 0 or min_samples_leaf <= 0 or class_majority <= 0 or min_samples_split <= 0 and accuracy < 0 or type(
bootstrap) != bool:
raise Exception("Parameters should be greater than 0.")
except ValueError:
raise Exception("Parameters should be numerical.")
if measure not in ["info_gain", "mdl"]:
raise Exception("measure should be set to info_gain or mdl.")
job = Job(worker=Worker(save_results=save_results))
job.pipeline = [
("split", Stage("map", input_chain=dataset.params["input_chain"], init=map_init,
process=map_fit_bootstrap if bootstrap else map_fit)),
('group_all', Stage("reduce", init=simple_init, process=reduce_fit, combine=True))]
job.params = dataset.params
job.params["trees_per_chunk"] = trees_per_chunk
job.params["max_tree_nodes"] = max_tree_nodes
job.params["min_samples_leaf"] = min_samples_leaf
job.params["min_samples_split"] = min_samples_split
job.params["class_majority"] = class_majority
job.params["measure"] = measure
job.params["bootstrap"] = bootstrap
job.params["accuracy"] = accuracy
job.params["separate_max"] = separate_max
job.params['seed'] = random_state
job.run(name="forest_distributed_decision_trees_fit", input=dataset.params["data_tag"],
required_files=[path + "decision_tree.py", path + "measures.py"])
fitmodel_url = job.wait(show=show)
return {"fddt_fitmodel": fitmodel_url} # return results url
示例2: fit
# 需要导入模块: from disco.core import Job [as 别名]
# 或者: from disco.core.Job import params["accuracy"] [as 别名]
def fit(
dataset,
trees_per_chunk=3,
max_tree_nodes=50,
min_samples_leaf=10,
min_samples_split=5,
class_majority=1,
measure="info_gain",
k="sqrt",
accuracy=1,
random_state=None,
separate_max=True,
save_results=True,
show=False,
):
from disco.worker.pipeline.worker import Worker, Stage
from disco.core import Job
import discomll
path = "/".join(discomll.__file__.split("/")[:-1] + ["ensemble", "core", ""])
try:
trees_per_chunk = int(trees_per_chunk)
max_tree_nodes = int(max_tree_nodes) if max_tree_nodes != None else max_tree_nodes
min_samples_leaf = int(min_samples_leaf)
min_samples_split = int(min_samples_split)
class_majority = float(class_majority)
separate_max = separate_max
accuracy = int(accuracy)
if (
trees_per_chunk <= 0
or min_samples_leaf <= 0
or min_samples_split <= 0
or class_majority <= 0
or accuracy < 0
):
raise Exception("Parameters should be greater than 0.")
except ValueError:
raise Exception("Parameters should be numerical.")
if measure not in ["info_gain", "mdl"]:
raise Exception("measure should be set to info_gain or mdl.")
job = Job(worker=Worker(save_results=save_results))
job.pipeline = [
("split", Stage("map", input_chain=dataset.params["input_chain"], init=map_init, process=map_fit)),
("group_all", Stage("reduce", init=simple_init, process=reduce_fit, combine=True)),
]
job.params = dataset.params
job.params["trees_per_chunk"] = trees_per_chunk
job.params["max_tree_nodes"] = max_tree_nodes
job.params["min_samples_leaf"] = min_samples_leaf
job.params["min_samples_split"] = min_samples_split
job.params["class_majority"] = class_majority
job.params["measure"] = measure
job.params["accuracy"] = accuracy
job.params["k"] = k
job.params["seed"] = random_state
job.params["separate_max"] = separate_max
job.run(
name="distributed_weighted_forest_fit",
input=dataset.params["data_tag"],
required_files=[path + "decision_tree.py", path + "measures.py", path + "k_medoids.py"],
)
fitmodel_url = job.wait(show=show)
return {"dwf_fitmodel": fitmodel_url} # return results url