“Scikit Learn Lda” Réponses codées

LDA Scikit Learn

import numpy as np
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])
y = np.array([1, 1, 1, 2, 2, 2])
clf = LinearDiscriminantAnalysis()
clf.fit(X, y)

print(clf.predict([[-0.8, -1]]))
Ultimate Gohan

Scikit Learn Lda

from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
lda = LDA(n_components = 2)
X_train = lda.fit_transform(X_train, y_train)
X_test = lda.transform(X_test)
Ultimate Gohan

Réponses similaires à “Scikit Learn Lda”

Questions similaires à “Scikit Learn Lda”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code