New answers tagged

1 vote

high degree polynomial model with sklearn does not fit

Try fit_intercept=True The fit intercept option determines whether the model should fit an intercept.
0 votes

Get multiple predictions from a knn model

Instead of using the classifier you might need to use a nearest neighbor instance: https://scikit-learn.org/stable/modules/neighbors.html This will allow you to get indices of nearest neighbors. An ...
  • 2,320
0 votes

sklearn.decomposition.PCA explained_variance_ratio_ attribute does not exist

Check your version then. The attribute explained_variance_ratio_ exists the latest version to this date, sklearn 1.2.1. https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.PCA.html
  • 1
1 vote

problem with imputing in sklearn

in the second cell you are printing the isnull() on train_date... But you have applied imputer on train_data and assigned values to data_with_imputed_values... Try to replace train_data in second cell ...
0 votes

problem with standardScaler

What is df_scaled here? If df_scaled is the Pandas DataFrame object, As we know that pandas DataFrame are 2D objects therefore it is giving an error here. If you do like this: ...
2 votes

problem with standardScaler

I suppose when you said df_scaled is empty, you actually meant all values inside is 0 (not df_scaled = None, which does not make sense). You can try this: ...
0 votes

What is Auto-Sklearn Dummy Model?

Dummy model is a model which predicts by purely guessing or using simple rule. E.g. for classification randomly assigns a class or just uses the majority class; for regression just uses the mean. It ...
  • 536
0 votes
Accepted

DecisionTreeClassifier cannot take one-hot encoded classes?

You need to integer encode your labels instead of one-hot encoding them. [1, 0, 0] -> 0 [0, 1, 0] -> 1 [0, 0, 1] -> 2 so that the labels for multiclass classification (with K classes) that ...
0 votes

Random Forest with less samples & variation in test_scores

You have 75 samples which is not enough data for meaningful machine learning. The result is high variance in performance between different runs.
0 votes

Random Forest with less samples & variation in test_scores

It could be that these "outliers" which you removed were not really the problem, maybe there were in fact easier to predict then the more common cases and increased $R^2$ significantly, and ...
0 votes

What is the difference between the CCA weights and rotations?

From the scikit-learn documentation for Canonical Correlation Analysis (CCA): x_weights_ … The left singular vectors of the cross-covariance matrices of each iteration. x_rotations_ … The projection ...
0 votes

Anomaly detection using clustering of highly correlated Categorical data

You can create a map (dataset) of the normal combinations and then classify new samples as anomalous if they are not found in the dataset of the normal combinations. You do not need to use any machine ...
0 votes

Does sklearn perform feature selection within cross validation?

Thanks for providing code. Are you sure you really want to: perform SequentialFeatureSelector for each configuration of the grid within cross validation? Do you ...

Top 50 recent answers are included