本文整理汇总了Python中evaluator.Evaluator.holdout方法的典型用法代码示例。如果您正苦于以下问题:Python Evaluator.holdout方法的具体用法?Python Evaluator.holdout怎么用?Python Evaluator.holdout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类evaluator.Evaluator
的用法示例。
在下文中一共展示了Evaluator.holdout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _test
# 需要导入模块: from evaluator import Evaluator [as 别名]
# 或者: from evaluator.Evaluator import holdout [as 别名]
def _test():
dset = create_dataset('tests/lenses.mff')
dset.train.normalize_attributes()
for e in dset.train.examples:
print(e)
classifier = NeuralNetwork(trainset=dset.train, max_error=.2, debug=True)
evaluator = Evaluator(classifier)
evaluator.holdout(.5)
dset = create_dataset('tests/lenses.mff')
dset.train.nominal_to_linear()
print(dset)
classifier = NeuralNetwork(trainset=dset.train, debug=True, max_error=.1, j=10)
evaluator = Evaluator(classifier)
evaluator.holdout(.2)
dset = create_dataset('tests/test_data/iris-binary.mff')
classifier = NeuralNetwork(trainset=dset.train, debug=True, max_error=.1)
classifier.train(dset.train)
dset = create_dataset('tests/test_data/votes.mff')
classifier = NeuralNetwork(trainset=dset.train, debug=True, max_error=.1)
classifier.train(dset.train)
dset = create_dataset('tests/test_data/mushroom.mff')
classifier = NeuralNetwork(trainset=dset.train, debug=True)
classifier.train(dset.train)
dset = create_dataset('tests/test_data/soybean.mff')
classifier = NeuralNetwork(trainset=dset.train, debug=True)
classifier.train()
示例2: evaluate
# 需要导入模块: from evaluator import Evaluator [as 别名]
# 或者: from evaluator.Evaluator import holdout [as 别名]
def evaluate(classifier, testset=None, holdout=None, folds=10):
"""Create evaulator object.
Args:
classifier (Classifier): desired classifier to run
testset (DataSet): testset to run classification accuracies/tests
outfile (str): filepath of target output file
holdout (float): desired split for the hold-out method
folds (int): number of folds for cross validation
"""
evaluator = Evaluator(classifier)
if testset:
pass
elif holdout:
evaluator.holdout(holdout)
else: # runing folds
evaluator.cross_validate(folds)
return evaluator