Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 6
0
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)