コード例 #1
0
def main():

    data, targets = rf.read_letters()
    clf = RandomForestClassifier(n_estimators=10,
                                 max_depth=None,
                                 min_samples_split=1,
                                 random_state=0)
    scores = cross_val_score(clf, data, targets)
    print("Forest_Letters: ", end="")
    print(scores.mean() * 100)

    data, targets = rf.read_abalone()
    clf = RandomForestClassifier(n_estimators=10,
                                 max_depth=None,
                                 min_samples_split=1,
                                 random_state=0)
    scores = cross_val_score(clf, data, targets)
    print("Forest_Abalone: ", end="")
    print(scores.mean() * 100)

    data, targets = rf.read_lungs()
    clf = RandomForestClassifier(n_estimators=10,
                                 max_depth=None,
                                 min_samples_split=1,
                                 random_state=0)
    scores = cross_val_score(clf, data, targets)
    print("Forest_Lungs: ", end="")
    print(scores.mean() * 100)
コード例 #2
0
def main():

    data, targets = rf.read_letters()
    clf = BaggingClassifier(KNeighborsClassifier(),
                            max_samples=0.5,
                            max_features=0.5)
    scores = cross_val_score(clf, data, targets)
    print("Bagging_Letters: ", end="")
    print(scores.mean() * 100)

    data, targets = rf.read_abalone()
    clf = BaggingClassifier(KNeighborsClassifier(),
                            max_samples=0.5,
                            max_features=0.5)
    scores = cross_val_score(clf, data, targets)
    print("Bagging_Abalone: ", end="")
    print(scores.mean() * 100)

    data, targets = rf.read_lungs()
    clf = BaggingClassifier(KNeighborsClassifier(),
                            max_samples=0.5,
                            max_features=0.5)
    scores = cross_val_score(clf, data, targets)
    print("Bagging_Lungs: ", end="")
    print(scores.mean() * 100)
コード例 #3
0
def main():
    data, targets = rf.read_letters()
    clf = KNeighborsClassifier(n_neighbors=2, algorithm='ball_tree')
    scores = cross_val_score(clf, data, targets)
    print("KNN_Letters: ", end="")
    print(scores.mean() * 100)

    data, targets = rf.read_abalone()
    clf = KNeighborsClassifier(n_neighbors=2, algorithm='ball_tree')
    scores = cross_val_score(clf, data, targets)
    print("KNN_Abalone: ", end="")
    print(scores.mean() * 100)

    data, targets = rf.read_lungs()
    clf = KNeighborsClassifier(n_neighbors=2, algorithm='ball_tree')
    scores = cross_val_score(clf, data, targets)
    print("KNN_Lungs: ", end="")
    print(scores.mean() * 100)
コード例 #4
0
def main():
    data, targets = rf.read_letters()
    clf = AdaBoostClassifier(n_estimators=100, learning_rate=.007)
    scores = cross_val_score(clf, data, targets)
    print("Adaboost_Letters: ", end="")
    print(scores.mean() * 100)

    data, targets = rf.read_abalone()
    clf = AdaBoostClassifier(n_estimators=100, learning_rate=.12)
    scores = cross_val_score(clf, data, targets)
    print("Adaboost_Abalone: ", end="")
    print(scores.mean() * 100)

    data, targets = rf.read_lungs()
    clf = AdaBoostClassifier(n_estimators=100, learning_rate=.1)
    scores = cross_val_score(clf, data, targets)
    print("Adadboost_Lungs: ", end="")
    print(scores.mean() * 100)
コード例 #5
0
def main():

    data, targets = rf.read_letters()
    clf = tree.DecisionTreeClassifier(criterion='entropy')
    scores = cross_val_score(clf, data, targets)
    print("DecisionTree_Letters", end="")
    print(scores.mean() * 100)

    data, targets = rf.read_abalone()
    clf = tree.DecisionTreeClassifier(criterion='entropy')
    scores = cross_val_score(clf, data, targets)
    print("DecisionTree_Abalone", end="")
    print(scores.mean() * 100)

    data, targets = rf.read_lungs()
    clf = tree.DecisionTreeClassifier(criterion='entropy')
    scores = cross_val_score(clf, data, targets)
    print("DecisionTree_Lungs", end="")
    print(scores.mean() * 100)
コード例 #6
0
ファイル: svm.py プロジェクト: wxhucong/Ensemble_Learning
def main():
	
	data, targets = rf.read_letters()
	clf = svm.SVC()
	scores = cross_val_score(clf, data, targets)
	print("SVM_Letters: ", end="")
	print(scores.mean() * 100)

	data, targets = rf.read_abalone()
	clf = svm.SVC()
	scores = cross_val_score(clf, data, targets)
	print("SVM_Abalone: ", end="")
	print(scores.mean() * 100)

	data, targets = rf.read_lungs()
	clf = svm.SVC()
	scores = cross_val_score(clf, data, targets)
	print("SVM_Lungs: ", end="")
	print(scores.mean() * 100)