Пример #1
0
def adaboost(X, Y, X_test, Y_test, cv=10):

    clf = AdaBoostClassifier(n_estimators=100, learning_rate=0.2)
    return crossValidation(clf, X, Y)
from knn import *
from DataAcesses import *
from CrossValidation import crossValidation

i = Database()
dados = i.selectAll()
crossValidation(dados, 2)
Пример #3
0
def logisticRegression(X, Y, X_test, Y_test, cv=10):

    clf = LogisticRegression(penalty="l1", C=2.0)
    return crossValidation(clf, X, Y)
Пример #4
0
def bagging(X, Y, X_test, Y_test):
    clf = BaggingClassifier(n_estimators=100,
                            max_features=0.5,
                            bootstrap=False)

    return crossValidation(clf, X, Y)
Пример #5
0
def deep(X, Y, X_test, Y_test, cv=10):

    clf = MLPClassifier(hidden_layer_sizes=(40, 30, 20, 10, 5, 2, 1),
                        learning_rate="invscaling")

    return crossValidation(clf, X, Y)
Пример #6
0
def perceptron(X, Y, X_test, Y_test, cv=10):

    clf = Perceptron(penalty='l1', alpha=0.0001)
    return crossValidation(clf, X, Y)
Пример #7
0
def neuralNet(X, Y, X_test, Y_test, cv=10):

    clf = MLPClassifier(hidden_layer_sizes=(
        30, 15), learning_rate="invscaling")

    return crossValidation(clf, X, Y)
Пример #8
0
def decisionTree(X, Y, X_test, Y_test, cv=10):

    clf = tree.DecisionTreeClassifier(
        max_depth=20, min_samples_split=25, max_leaf_nodes=100)

    return crossValidation(clf, X, Y)
Пример #9
0
def gradientBoost(X, Y, X_test, Y_test, cv=10):

    clf = GradientBoostingClassifier(
        learning_rate=0.1, n_estimators=200, max_depth=4)
    return crossValidation(clf, X, Y)
Пример #10
0
def mnb(X, Y, X_test, Y_test, cv=10):

    clf = MultinomialNB(alpha=1.0)

    return crossValidation(clf, X, Y)
Пример #11
0
def svc(X, Y, X_test, Y_test, cv=10):

    clf = SVC(kernel='linear', C=0.4, degree=2)
    return crossValidation(clf, X, Y)
from knn import *
from DataAcesses import *
from CrossValidation import crossValidation
i = Database()
dados = i.selectAll()
for a in range(2, 120):
    print(str(a) + ' : ' + str(crossValidation(dados, a)))
Пример #13
0
def knn(X, Y, X_test, Y_test, cv=10):
    clf = KNeighborsClassifier(n_neighbors=5, leaf_size=30, p=2)
    return crossValidation(clf, X, Y)
Пример #14
0
def randomForest(X, Y, X_test, Y_test, cv=10):

    clf = RandomForestClassifier(n_estimators=150,
                                 max_depth=None,
                                 max_leaf_nodes=None)
    return crossValidation(clf, X, Y)