<p dir="auto">Help doc of <code class="notranslate">LDA.transform</code> says:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Returns
-------
X_new : array, shape = [n_samples, n_components]"><pre class="notranslate"><code class="notranslate">Returns
-------
X_new : array, shape = [n_samples, n_components]
</code></pre></div>
<p dir="auto">However:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="X = np.array([[-1, -1, -1], [-2, -1, -1], [-3, -2, -2], [1, 1, 3], [2, 1, 4], [3, 2, 1]])
y = np.array([1, 1, 1, 2, 2, 2])
lda = LDA(n_components=3).fit(X, y)
lda.transform(X).shape"><pre class="notranslate"><code class="notranslate">X = np.array([[-1, -1, -1], [-2, -1, -1], [-3, -2, -2], [1, 1, 3], [2, 1, 4], [3, 2, 1]])
y = np.array([1, 1, 1, 2, 2, 2])
lda = LDA(n_components=3).fit(X, y)
lda.transform(X).shape
</code></pre></div>
<p dir="auto">produces<br>
<code class="notranslate">(6, 2)</code> while I expect it to be <code class="notranslate">(6, 3)</code> as <code class="notranslate">n_components == 3</code></p>
<p dir="auto">Looking at the code of transform:<br>
<code class="notranslate">return np.dot(X, self.coef_[:n_comp].T)</code></p>
<p dir="auto">Where <code class="notranslate">self.coef_</code> is computed as in <code class="notranslate">.fit()</code>:<br>
<code class="notranslate">self.coef_ = np.dot(self.means_ - self.xbar_, self.scalings_)</code></p>
<p dir="auto">which produces a 2x1 matrix (or whatever the number of means is).</p>
<p dir="auto">Not sure what the correct thing would be but it seems that <code class="notranslate">LDA.coef_</code> should have length <code class="notranslate">n_compoments</code>, no?</p>
<p dir="auto">Currently rfc only support array like input , thus it can not apply to huge dataset. If the sparse matrix could be supported in the near future, would Be Greatly Appreciated!</p>