本文整理汇总了Python中Classifier.Classifier.run方法的典型用法代码示例。如果您正苦于以下问题:Python Classifier.run方法的具体用法?Python Classifier.run怎么用?Python Classifier.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Classifier.Classifier
的用法示例。
在下文中一共展示了Classifier.run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RandomForestClassifier
# 需要导入模块: from Classifier import Classifier [as 别名]
# 或者: from Classifier.Classifier import run [as 别名]
from sklearn import cross_validation
from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifier, AdaBoostClassifier, \
GradientBoostingClassifier
from sklearn.grid_search import GridSearchCV
from sklearn.linear_model import LogisticRegression
from sklearn.naive_bayes import BernoulliNB
from sklearn.svm import SVC, LinearSVC
from sklearn.tree import DecisionTreeClassifier
from Classifier import Classifier
import numpy as np
if __name__ == '__main__':
#test models
name = 'RF_test'
model = RandomForestClassifier(n_estimators=100, max_features='auto', max_depth=None, min_samples_split=3,
bootstrap=True, oob_score=True, n_jobs=-1, verbose=True)
min_samples_int = np.linspace(1, 10, 10)
min_samples_frac = np.linspace(0, 0.5, 3)
param_grid = dict(min_samples_split=min_samples_int, min_samples_leaf=min_samples_int, min_weight_fraction_leaf=min_samples_frac)
model = GridSearchCV(model, param_grid=param_grid, verbose=True, n_jobs=-1)
clf = Classifier(model, name, one_hot=False, drop_cat=False, calibration=False)
clf.run()
示例2: run
# 需要导入模块: from Classifier import Classifier [as 别名]
# 或者: from Classifier.Classifier import run [as 别名]
def run(self):
preprocessor = Preprocessor()
preprocessor.load_encoder()
classifier = Classifier(preprocessor)
classifier.run()