“Scikit belajar LDA” Kode Jawaban

lda scikit belajar

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 belajar 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

Jawaban yang mirip dengan “Scikit belajar LDA”

Pertanyaan yang mirip dengan “Scikit belajar LDA”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya