AI, Dimensionality Reduction, Machine Learning, Python, Data Science.
lda.explained_variance_ratio_ # Calculate the cumulative explained variance cumulative_explained_variance = np.cumsum(explained_variance_ratio) # Find the number of components that explain at least 75% of the variance n_components = np.argmax(cumulative_explained_variance >= 0.75) + 1 # Transform