I tried to use LDA and find a 3-channel output. But its output has just 2 channels.
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
x = []
y = []
for i in range(len(img)):
for j in range(len(img[0])):
x.append([i,i,j,j])
y.append(img[i][j])
y = np.array(y)
x = np.array(x)
y.shape,x.shape
lad = out = _ = ''
lda = LDA(n_components=3)
out = lda.fit(x, y).transform(x)
print(out.shape,y.shape,x.shape)
I used [i, i, j, j] because LDA asked me to have x with more features.
and printed output is:
((392960, 2), (392960,), (392960, 4))
but for out.shape I seek (392960,3)
Can anyone help me with this, please?