本文整理汇总了Python中sklearn.ensemble.ExtraTreesClassifier.decision_function_shape方法的典型用法代码示例。如果您正苦于以下问题:Python ExtraTreesClassifier.decision_function_shape方法的具体用法?Python ExtraTreesClassifier.decision_function_shape怎么用?Python ExtraTreesClassifier.decision_function_shape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.ensemble.ExtraTreesClassifier
的用法示例。
在下文中一共展示了ExtraTreesClassifier.decision_function_shape方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SVC
# 需要导入模块: from sklearn.ensemble import ExtraTreesClassifier [as 别名]
# 或者: from sklearn.ensemble.ExtraTreesClassifier import decision_function_shape [as 别名]
df_new_3['X'].fillna(mode(df_new_3['X']).mode[0],inplace = True)
df_new_3=pd.read_csv('G:\\Datasets\\7z assignment\\Test\\machine3_answer.csv')
df_new_3=df_new_3.drop("Unnamed: 0",axis=1)
df_new_3.dtypes()
df_new_3['Y']= df_new_3['Y'].astype(float)
df_new_3['Y']=df_new_3['Y'].values
from sklearn import svm
svm_clf= svm.SVC(decision_function_shape='ovo')
svm_clf.fit(new_df_machine_1[new_predictor_machine1],new_df_machine_1['X'])
X = [[0], [1], [2], [3]]
Y= [0, 1, 2, 3]
clf = svm.SVC(decision_function_shape='ovo')
clf.fit(X, Y)
SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
decision_function_shape='ovo', degree=3, gamma='auto', kernel='rbf',
max_iter=-1, probability=False, random_state=None, shrinking=True,
tol=0.001, verbose=False)
dec = clf.decision_function([[1]])
dec.shape[1] # 4 classes: 4*3/2 = 6
6
clf.decision_function_shape = "ovr"
dec = clf.decision_function([[1]])
dec.shape[1] # 4 classes
4