Questions tagged [scikit-learn]

A machine-learning library for Python. Use this tag for any on-topic question that (a) involves scikit-learn either as a critical part of the question or expected answer, & (b) is not just about how to use scikit-learn.

Filter by
Sorted by
Tagged with
1
vote
0answers
18 views

Should Scikit-Learn CalibratedClassifierCV isotonic mode use bucketed rates instead of the actual targets?

This is less a question about sklearn's implementation, and more theoretical. I find it weird that we'd do isotonic regression against target values in {0, 1} because that could result in very jagged ...
1
vote
1answer
17 views

what is the scoring variable called for aucpr?

i am trying to conduct a grid search for an imbalanced problem however i cannot find the aucpr (area under curve precision recall) scoring metric for gridsearch. e.g. you have 'roc-auc', 'neg-brier-...
0
votes
0answers
12 views

Questions about scikit-learn.org “Nested vs non-nested CV” example

I think I'm starting to get an idea about nested cross-validation, but I have a couple questions about this specific example. Isn't what we calculate in the outer loop a less biased performance ...
0
votes
0answers
6 views

Feature engineering of closely related text

I am trying to do multi class classification of text. For many reasons I can't paste the data, atleast now in open. The problem is there is a text of closely related subjects like Anatomy and ...
2
votes
1answer
16 views

Is n_estimators in BaggingRegressor() the number of trees or data subsets?

I'm learning about using the BaggingRegressor() from scikit learn (https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.BaggingRegressor.html) Its <...
0
votes
0answers
25 views

Yeo-Johnson did not improve model. Can that really be? [closed]

I have a dataset which has several continuous columns including my y-variable. Most of these columns are non-normally distributed and some of them have also negative values. For that reason, I tried a ...
0
votes
0answers
12 views

Using Cross Validation for Highly Seasonal Data with small sample

I'm having trouble getting good scores on cross validated metrics on time series regression models. Essentially, I am trying to model product purchases based on amount of money spent on different ...
0
votes
0answers
17 views

Is this the correct procedure for hyperparameter tuning and model evaluation?

As a follow up to my previous post (What is the correct procedure for nested cross-validation?) I wanted to see if my following nested cross-validation procedure is valid: Split my data into train/...
1
vote
0answers
76 views

Should I perform nested CV with Grid Search to make my ensemble model robust?

I'm doing classification of 8 types of hand gestures with stacking models. For that I initially split the data into training and test sets. Then I used GridSerachCV ...
0
votes
0answers
6 views

How does the base_estimator and n_estimators work in the AdaBoostRegressor function provided by Sklearn

I have questions related to the definitions of the base_estimator and n_estimators given in the scikit-learn documentation: <...
1
vote
1answer
34 views

Why does the last estimator of the Sklearn only get fit and not transformed? [closed]

Here is the documentation for the pipeline constructor from Sklearn website: Sequentially apply a list of transforms and a final estimator. Intermediate steps of the pipeline must be ‘transforms’, ...
0
votes
0answers
4 views

Multi target multi class classifcation

I have a problem which have been described precisly in this link https://stackoverflow.com/q/64238213/13669992 As of now I have tried sklearn Classifier Chain with Random Forest as base classifier but ...
0
votes
0answers
21 views

What is the correct procedure for nested cross-validation?

I am trying to use scikit-learn to make a classifier and then predict the accuracy of the classifier. My dataset is relatively small and I am unsure of the best parameters. Hence I turned to nested ...
1
vote
0answers
12 views

How can one use Grid Search without overfitting the model?

I checked several questions, like Overfitting during model selection - AutoML vs Grid search and Hyperparameter tuning using grid search/randomised search, but I don't think any of them answer my ...
2
votes
0answers
21 views

Is Normalized Mutual Info Score equivalent to V-measure when normalized by arithmetic mean

According to sklearn.metrics.v_measure_score, it says This score is identical to normalized_mutual_info_score with the 'arithmetic' option for averaging. In the ...
2
votes
1answer
26 views

I can't explain this precision score

I am printing out the precision score and confusion matrix using sklearn. ...
0
votes
1answer
13 views

How can I extract the correct hyper-plane from sklearn.svm's LinearSVC

I'm not certain I understand how sklearn's Linear SVC works. I had assumed that it would find an optimal hyper-plane to divide one class from another. I tried to recover the separating hyper-plane ...
0
votes
0answers
8 views

How does sample_weights work in Naive Bayes?

I want to use the sample_weights parameter in sklearn Naive Bayes classification. I have seen online that it can be used to balance data but I have also seen that it can be used to weight data with ...
0
votes
1answer
13 views

What's the formula behind Normalization function?

sklearn.preprocessing.Normalizer(norm=l2) I need to undone a normalization (Normalizer algorithm) within my dataset and I'd like to know which formula I should use for it. I've try both formulas (...
1
vote
1answer
19 views

What to do after knowing the model is overfitted?

So I was trying to run a model using scikit-learn. In order to tune the hyperparameters, I used RandomizedSearchCV, just like this: ...
1
vote
1answer
10 views

sklearn's SVM classification failure

I'm trying to fit a trivial classifier but I'm not sure what am I doing wrong. I'm providing scikit-learn's svm.SVC linear classifier with two samples of X=[[0.], [0.5]] and labels y=[0, 1] and I get ...
0
votes
0answers
18 views

How to properly measure accuracy with feature selection?

I applied a feature selector (with this great python package) in my dataset. This package uses the wrapper approach, where you define a classification model that runs on your data and find the best $k$...
0
votes
0answers
7 views

Implementations for Conditional Average Treatment Effects that can be trained incrementally

I am currently working on a very large dataset (billions of rows) of A/B test data and want to implement some methods to estimate conditional average treatment effects. I basically need a forecast ...
3
votes
1answer
43 views

Why is my Random Forest Regression performing worse in cross validation than on a baseline?

So I am trying to use a Random Forest Regression on a dataset with a mix of categorical and numeric data types. The predictors are in X_train and ...
0
votes
0answers
31 views

Need to implement train_test split before validation_curve/learning_curve in Sklearn?

I'm doing a regression using sklearn, and I wonder if there is a need to split my data set X and the target variable y into x_train, x_test, y_train, y_test before implementing the validation_curve ...
1
vote
1answer
16 views

Does it make sense train Linear Support Vector Regression with an epsilon of 0?

In the sklearn.svm.LinearSVR implementation, the default parameter of epsilon is 0.0. And the documentation says "if unsure,...
1
vote
1answer
39 views

Does it make sense for correlation coefficients to be vastly different from regression coefficients?

I'm working on a project where I'm analyzing how improvements in players' skills are associated with changes in their values. Specifically to see if there is a correlation between point changes in ...
0
votes
1answer
18 views

LassoLarsCV: different results after removing variables with coef=0

I am using LassoLarsCV from sklearn on a dataset with around 100 variables. After fitting the model around 80 of them have a coefficient of 0. I want to remove those variables from my dataset because ...
0
votes
0answers
25 views

StackingClassifier + RandomSearchCV: How is it dividing the folds under the hood?

I'm able to (based on the example from the accepted answer here ) set up a StackedClassifier and add RandomSearchCV to perform a quick hyperparameter search. The models/pipelines are set up like in ...
0
votes
2answers
33 views

How long would building an Sklearn K-Nearest Neighbours classifier take? [closed]

I have a dataset that contains roughly 21m 768-dimension vectors (which comes in at 60GB large!). I am looking to using Sklearn to train an 8-nearest neighbour model on this data, but I'm not sure how ...
0
votes
0answers
14 views

Normalize parameter in sklearn Ridge, Lasso, ElasticNet [duplicate]

Is there any risk or disadvantage to set normalize=True when using ridge, lasso or elasticnet or does it only have benefits? And what is the impact on the range of alpha if it is set to True, does it ...
0
votes
0answers
11 views

Metrics to optimize imbalanced multiclass classification [duplicate]

I am working on a problem regarding authorship-attribution. Our multilabel (three possible authors) data set is highly imbalanced. We already took steps to solve the class-imbalance problem (by ...
0
votes
0answers
10 views

How to select 'n-splits' in ShuffleSplit

How many times can I do ShuffleSplit? What is the maximum/recomemend value of 'n-splits'? If, for example, I'm comparing two classifiers, can I perform ShuffleSplit as many times as needed on each ...
0
votes
0answers
6 views

Which Regression scoring to use when have small dataset?

I am currently working on a Elastic-net regression assignment. The problem is I only have 40 training examples and I have to use 4 fold Gridsearchcv for hyper-parameter tuning. I am using sklearn for ...
1
vote
1answer
31 views

Is the concept of Kernel in Linear Algebra and kernel for SVD the same?

Is the term kernel used in Sklearn to execute the SVD machine learning algorithm conceptually related to the notion of a kernel in linear algebra ( null space )? Or do they happen to use this same ...
0
votes
1answer
13 views

How to select best models if the ROC AUC score changes drastically at each separate run?

Below are two plots for ROC curves with their AUC mentioned in the legend brackets. How do I shortlist the best models if the scores differ at each run? Should I rather calculate the ROC AUC only from ...
1
vote
0answers
33 views

Random Forest with train AUC = 1 and test AUC = 58%

I'm trying to understand why my train AUC = 1 while my test AUC is near 58% using random forest. Context: You are trying to sell a product, and you have historic data about the purchases/noPurchases ...
0
votes
0answers
13 views

The most important matrices for evaluating a predictive model for customer churn

My questions is as above. What are the most important matrices (f1, precision, recall...etc) that I need to prioritize my work to improve for evaluating how good a model predict customer churn and the ...
0
votes
0answers
11 views

Adaboost - Is it (really) necessary to plug sample weights into cost function?

I implemented Adaboost using the SAMME algorithm (for multiclass) with Multilayer Perceptron networks as weak learners. For the MLP, i am using ...
1
vote
2answers
25 views

Why does plotting a LinearRegression from sklearn make a crazy graph?

I've seen a couple of posts on how to make a simple graph that looks something like this: The code for this would be as follows: ...
1
vote
0answers
30 views

Unstable cross validation results, which one do I select?

I'm running StratifiedKFold(n_splits=5, shuffle = True) on a binary classification problem. I take the accuracy and recall from each testing fold and report their average. I noticed that the averaged ...
0
votes
0answers
21 views

nature certainty in predict_proba in GaussianNB() from sklearn, python

If using predict_proba in a GaussianNB() model I generate the following two sets of probabilities: Probabilities of '0' and '1' outcomes: ...
0
votes
1answer
14 views

Is it correct to decrease the alpha parameter in sklearn SVM pipeline to improve performance?

I'm trying to find the best parameters for a Fine-grained Sentiment Analysis of a dataset of movie reviews. This is the current code: ...
0
votes
0answers
13 views

Using my models with NGBoost?

I've come across this new tool of NGBoost from the Machine Learning group of Stanford, I was curious if peopel have started using it yet. They say that one can have a Base learner such as a regression ...
0
votes
0answers
16 views

Is it an overfitting problem for SVM classification?

I am new in Machine learning, and I want to detect emotions from the face. Preprocessing: I used equalizeHist to equalizes the histogram of grayscale images (JAFFE database with 213 images), in the ...
4
votes
2answers
68 views

Should we center original data if we want to get principal component?

Suppose we have data matrix $X$ with shape $n*p$, each row $x_i^T$ is a sample. By definition first principal component is $y_1 = e_1^T * x$, where $e_1$ is unit eigenvector corresponding to largest ...
2
votes
1answer
21 views

Getting feature weights with permutation_test_score()

I am using sklearn to fit a SVM to some data. Since I wanted to use cross-validation and evaluate my classification accuracy using permutations, I am using the permutation_test_score() function (https:...
0
votes
0answers
22 views

Issue in using KNN in out-of-sample estimation

In search of the best possible features of forecasting, I have the idea of finding the KNN(5) of my Y variable to predict future values of Y. This is only possible in real time, using forecasts of X-...
0
votes
1answer
27 views

SVM for fMRI: unbalanced data - leave-one-triplet-out?

I am using SVM (sklearn.svm) to classify fMRI data from two groups of people. One group has n = 25 and the other n = 26. Everyone except for one person has seen 96 trials, so in total I have 2,496 ...
1
vote
0answers
17 views

Scaling revenues - Drawbacks and advantages of average vs. median scaling

Context Currently I am doing some regression-predictions with various machine learning algorithms (still in the experimental phase). Some features I use for the prediction are revenues customers ...

1
2 3 4 5
29