scikit-learn

Can I get F1 score each time from GridSearchCV?

Can I get F1 score each time from GridSearchCV? Question: I want to show F1 score from gridsearch each loop of change parameter. I use f1_micro in the GridSearchCV like this. params = { ‘max_depth’: [None, 2, 4, 6, 8, 10], ‘max_features’: [None, ‘sqrt’, ‘log2’, 0.2, 0.4, 0.6, 0.8], } clf = GridSearchCV( estimator=DecisionTreeClassifier(), param_grid=params, …

Total answers: 1

scikit-learn documentation example: 'got an unexpected keyword argument'

scikit-learn documentation example: 'got an unexpected keyword argument' Question: When running this example from the scikit-learn documentation, I get the error v_measure_score() got an unexpected keyword argument ‘beta’: from sklearn import metrics labels_true = [0, 0, 0, 1, 1, 1] labels_pred = [0, 0, 1, 1, 2, 2] metrics.v_measure_score(labels_true, labels_pred, beta=0.6) It looks like a …

Total answers: 1

Plot many PartialDependencePlot lines in one plot for multiclass classification

Plot many PartialDependencePlot lines in one plot for multiclass classification Question: Kind of a broad question but I need to plot many PartialDependencePlot lines in the same plot – one line for each target in the multiclass classification, for each variable in the dataset. So for variable age I’d have one plot with the many …

Total answers: 1

How to Inverse Transform a Predicted Output of a loaded pickle XGBoost model?

How to Inverse Transform a Predicted Output of a loaded pickle XGBoost model? Question: I am trying to run a program that could produce a predicted output using a loaded model (pickle file). The saved model (XGBoost) was trained to have its dataset to undergo transformation via StandardScaler before fitting it, and the predicted value …

Total answers: 2

High metrics value for linear regression model

High metrics value for linear regression model Question: I’m working with a dataset of cars, containing 10k rows and 5 columns: id mileage_per_year model_year price sold There are two negative values in the price column, I didn’t know if I should 0 it or just leave it, and so, I left it untouched. I don’t …

Total answers: 1

ImportError: cannot import name '_check_weights' from 'sklearn.neighbors._base'

ImportError: cannot import name '_check_weights' from 'sklearn.neighbors._base' Question: I am trying to do Missforest as a method for handling missing values in table data. import sklearn print(sklearn.__version__) ->1.2.1 import sklearn.neighbors._base import sys sys.modules[‘sklearn.neighbors.base’] = sklearn.neighbors._base !pip install missingpy from missingpy import MissForest It was working fine until now, but since yesterday, the following error message …

Total answers: 2

How to apply scaler module with groupby in pandas dataframe?

How to apply scaler module with groupby in pandas dataframe? Question: I want to scale one column in my dataframe. However, I have different groups within my dataframe. I want to scale within a group. How would I do this? Currently, my code scaled the column in relation to all rows but again, I want …

Total answers: 1

Need for both CV and train-test-split to assess a model's performance

Need for both CV and train-test-split to assess a model's performance Question: This is a theoretical question. Suppose I am working on a supervised learning model to predict employee attrition based on some categorical and numerical features. I have a small dataset of 500 employees. I want to try a few models, such as a …

Total answers: 1

continuous data, Y response not support in the cross_val_score() binary|multiclass for IterativeImputer for BayesianRidge

continuous data, Y response not support in the cross_val_score() binary|multiclass for IterativeImputer for BayesianRidge Question: Problem Defined, Continuous Challenge This new imputer_bayesian_ridge() function is for Iterative Imputer to impute training data. Sending in data frame training data, then immediately get data.values for numpy array variable. This send or passes a training data with many features, …

Total answers: 1