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)
def logisticRegression(X, Y, X_test, Y_test, cv=10): clf = LogisticRegression(penalty="l1", C=2.0) return crossValidation(clf, X, Y)
def bagging(X, Y, X_test, Y_test): clf = BaggingClassifier(n_estimators=100, max_features=0.5, bootstrap=False) return crossValidation(clf, X, Y)
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)
def perceptron(X, Y, X_test, Y_test, cv=10): clf = Perceptron(penalty='l1', alpha=0.0001) return crossValidation(clf, X, Y)
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)
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)
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)
def mnb(X, Y, X_test, Y_test, cv=10): clf = MultinomialNB(alpha=1.0) return crossValidation(clf, X, Y)
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)))
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)
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)