示例#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))
示例#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))
示例#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))
示例#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))