Exemplo n.º 1
0
def run_nb(X_train, y_train, X_test, y_test):
	nb = GaussianNB()
	nb.fit(X_train, y_train)
	return compute_accuracy(y_test, nb.predict(X_test))
Exemplo n.º 2
0
def run_linearDiscriminantAnalysis_full(X, y):
    from learner.LinearDiscriminantAnalysis import LinearDiscriminantAnalysis
    lda = LinearDiscriminantAnalysis(n_components=1)
    lda.fit(X, y)
    return compute_accuracy(y, lda.predict(X))
Exemplo n.º 3
0
def run_sk_linearDiscriminantAnalysis_full(X, y):
    from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
    lda = LinearDiscriminantAnalysis(n_components=1, solver='eigen')
    lda.fit(X, y)
    return compute_accuracy(y, lda.predict(X))
Exemplo n.º 4
0
def run_sk_linearDiscriminantAnalysis(X_train, y_train, X_test, y_test):
    from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
    lda = LinearDiscriminantAnalysis(n_components=1)
    lda.fit(X_train, y_train)
    return compute_accuracy(y_train, lda.predict(X_train)), compute_accuracy(
        y_test, lda.predict(X_test))