Skip to content
Advertisement

Tag: pca

Make available .best_params_ after pipeline

How to go about making available the clf.best_params_ after carrying a pipeline? For the code I have below, I get an: AttributeError: ‘GridSearchCV’ object has no attribute ‘best_params_’ Here is my code: Answer Your clf is never fitted. You probably meant clf.fit(X_train,y_train). Also, np.linspace(10,50,11) yields floats, while max_depth expects ints, so this may fail and you should probably add a

TypeError: SparseDataFrame() takes no arguments in Principal Component Analysis using Light_FAMD

When attempting to perform a FAMD according to the instructions on https://pypi.org/project/light-famd/#factor-analysis-of-mixed-data-famd, I keep getting the same error over and over again, namely: TypeError: SparseDataFrame() takes no arguments. How to fix this problem? It occurs not only on my own data set but also whenever I try it on a basic randomly-generated data set such as created like this: The

Sklearn PCA explained variance and explained variance ratio difference

I’m trying to get the variances from the eigen vectors. What is the difference between explained_variance_ratio_ and explained_variance_ in PCA? Answer The percentage of the explained variance is: The variance i.e. the eigenvalues of the covariance matrix is: Formula: explained_variance_ratio_ = explained_variance_ / np.sum(explained_variance_) Example: Also based on the above formula: 7.93954312 / (7.93954312+ 0.06045688) = 0.99244289 From the documentation:

Principal Component Analysis (PCA) in Python

I have a (26424 x 144) array and I want to perform PCA over it using Python. However, there is no particular place on the web that explains about how to achieve this task (There are some sites which just do PCA according to their own – there is no generalized way of doing so that I can find). Anybody

Advertisement