Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [scikit-learn]

scikit-learn is a popular machine learning package for Python that has simple and efficient tools for predictive data analysis. Topics include classification, regression, clustering, dimensionality reduction, model selection, and preprocessing.

Filter by
Sorted by
Tagged with
0 votes
1 answer
32 views

How can I improve my predictive model?

Here is my interpretation of my model so far, I am investigating the relationship between ratings and followers on video games, but there is a problem. The more you get high ratings, the more you get ...
Hugo Guay's user avatar
-1 votes
0 answers
31 views

What two different formulas in SVC minimization problem means?

Im studying a Support Vectors Machine and for soft margin I found minimization problem in form like this: $$\min_{w,b} \frac{1}{2} \|w\|^2 + C \sum_{i=1}^l \xi_i$$ And this this formula seems pretty ...
Almer's user avatar
  • 1
1 vote
1 answer
18 views

Scoring function in cross-validation often left default

I'm a PhD student applying ML in microbiology. In research papers, the usual performance measure reported on classification models is ROC-AUC. But when I look at implementations, the scoring function ...
alepfu's user avatar
  • 51
0 votes
1 answer
32 views

Making cpp function from xgboost dump_model() output

I'd like to use the output of an xgboost BDT model in a code base without having to rely explicitly on xgboost or otherwise. Using a modified version of this script, xgb2cpp I am able to generate a ...
Miles Cochran-Branson's user avatar
0 votes
1 answer
22 views

How do I identify overffiting when using GridSchearCV?

For context, I'm using Scikit Learn's GridSearchCV to find the best Hyperparameters of a Decision Tree. I believe I understand Train, Validation, and Test sets and overfitting concepts when applied ...
Lisana Daniel's user avatar
0 votes
0 answers
13 views

How to use cross validation to select/evaluate model with probability score as the output?

Initially I was evaluating my models using cross_val with out-of-pocket metrics such as precision, recall, f1 score, etc, or with my own metrics defined in ...
szheng's user avatar
  • 21
1 vote
1 answer
27 views

Linear regression with confidence interval

I am running a multivariate linear regression on noisy data, where the amount of error for each measurement is known (or at least estimated). It works reasonably well with weighted linear regression ...
Brad's user avatar
  • 111
1 vote
0 answers
41 views

Multiclass matrix loss function in scikit-learn / xgboost / lightgbm

I have data with 4 classes: $c_1, c_2, c_3, c_4$. I'd like to create a classifier which has different scaling for the loss function per class combination: $$ \begin{bmatrix} 0 & l \left( \hat{c}_{...
Avi T's user avatar
  • 56
0 votes
0 answers
36 views

improve my f1_score for classification - pandas/sklearn

I would like advice on how to improve my f1_score for classification. I currently have something around 0.57. Dataset: lotWaferDie - lot, board and chip on which defects were measured string values ...
user162343's user avatar
0 votes
0 answers
13 views

Are there any Python (sklearn or other) ML libraries that can handle missing data?

I am running a model using a sparse matrix for the X. It can not be imputed. So are there any libraries who modify the main ML models to deal with this?
J_Bake's user avatar
  • 1
1 vote
1 answer
28 views

How to get the feature names from a OneHotEncoder embedded in a ColumnTransformer?

How can I get the feature names from a OneHotEncoder embedded in a ColumnTransformer? The following piece of code: ...
Evan Aad's user avatar
  • 175
0 votes
0 answers
13 views

Need to compare results using Ward's method

So I create clusters like this and StandardScale them ...
Poyo's user avatar
  • 1
0 votes
1 answer
22 views

why is my svm taking much time to run what changes should i make in my code?

...
Kshitija Thakur's user avatar
0 votes
0 answers
16 views

If I do cross validation do I need to refit the model?

I am making a dual process. I have an initial dataset in which I train (fit) a model, then I do cross validation to get results. Until now everything normal, but additional to that, I create a new ...
Curious student's user avatar
1 vote
1 answer
32 views

Why doesn't SciKit-Learn's KBinsDiscretizer's 'quantile' strategy distribute values evenly in the bins?

According to SciKit Learn's documentation for sklearn.preprocessing.KBinsDiscretizer, the quantile strategy is suppose the ...
Evan Aad's user avatar
  • 175
1 vote
1 answer
20 views

Change of data shape when using IterativeImputer from sklearn

I am using the IterativeImputer from sklearn and I notice that it changes the data shape. Initially I have an (X,5) array where all columns except for the last one contain the missing value (which has ...
gmaravel's user avatar
  • 111
0 votes
0 answers
18 views

RFECV with Random Stratified K-Folds returns different features everytime

I am trying to learn more about Feature Selection in machine learning. I am working on a dataset that contains 17 features, and I have achieved about 75% accuracy on a Random Forest model with no ...
rehanqb's user avatar
0 votes
0 answers
26 views

Calculate AUC-ROC and AUC-PRC for an LSTM Model

I have the following simple Bidirectional LSTM model for a binary classification task: ...
thatsroughbuddy's user avatar
1 vote
0 answers
18 views

Outlier detection with elliptic envelope - unexpected error

I am trying to detect outliers with sklearn.covariance.EllipticEnvelope for a single variable, but it throws an unexpected error. Here is an example the reproduces ...
Maya's user avatar
  • 11
0 votes
0 answers
9 views

Test vs train data inconsistent numbers of samples error

I am trying to train an AI model to learn from an Excel file so I can ask it questions about the file later. I created this code ...
advancedspectrum's user avatar
0 votes
0 answers
20 views

Pipelines in SKLEARN

I am building a pipeline. I am downloading a dataset from an online ML repository and generating descriptive stats for it. The link for the dataset is https://archive.ics.uci.edu/dataset/45/heart+...
EngineerP's user avatar
0 votes
0 answers
20 views

How to apply online learnig to Random Forest?

I have developed a random forest model for wind veliocity prediction with hyperparameter tuning, but i am getting continuous data. So i want to apply online leearning for random forest model. could ...
RAJESH KOYI's user avatar
1 vote
0 answers
32 views

Gaussian process regression not working in GPytorch and Scikit-learn, can't find suitable hyperparameters

This is a MWE of my problem, basically I want to find out the map between qin and qout using a Gaussian process and with that ...
Hans's user avatar
  • 111
-1 votes
1 answer
35 views

How to deal with a heavily imbalanced test dataset?

Both my train data and test data were imbalanced. So I tried SMOTE for training. Before Smote: ...
GrGr11's user avatar
  • 1
-1 votes
1 answer
41 views

In order to predict after training on Standardized data, do I need the StandardScaler as well?

Is the scaler saved inside the model.keras file or I need to separately save it? I want to train an neural network, save it, and ...
Cohensius's user avatar
  • 163
3 votes
1 answer
64 views

When do you know training a model is not feasible?

A couple weeks ago I volunteered to take on a project at work to try predicting the ideal price rental cars my employer should be charging based on our historical rental data. The variables available ...
enmasse's user avatar
  • 31
1 vote
0 answers
31 views

How does ROC work with SVM?

Could someone please explain how ROC works with SVM? Specifically i'm using RocCurveDisplay.from_predictions(y_test, y_pred, ax=ax[1]) which works fine. Since the ...
lemintare's user avatar
0 votes
0 answers
25 views

ROC Curve - How to deal with overflow?

I'm trying to calculate the ROC curve and the AUC of a binary logistic regression from scratch, without using third party methods like sklearn.metrics.roc_curve, to ...
Matteo Campagnoli's user avatar
0 votes
1 answer
43 views

Is it usual to obtain very different values of mutual information score using sci-kit learn?

Good day to everyone! I have a little question related to the function mutual_information_score of sci-kit learn. I've been using it to obtain the mutual information between two datasets A and B; ...
gengar123's user avatar
1 vote
1 answer
51 views

Minimize $\sum_i||Y_i-AX_i||^2$

I have N data vectors $X_i$ and N target vectors $Y_i$ where $i$ indexes the sample. I would like to learn a linear map $A$ between the data and the target i.e find the matrix $A$ that minimize $$\...
Nichola's user avatar
  • 113
1 vote
1 answer
50 views

How does a Decision Tree split when two features are tied?

Decision Trees split based on which feature and which cut-off value creates the largest mean decrease in impurity (assuming hyperparameter split="best", criterion="gini"). Now take ...
AvanishM's user avatar
0 votes
1 answer
27 views

Performance difference between two equivalent ML codes

Using the two Python libraries GPyTorch and scikit-learn to perform Gaussian Process Regression (GPR) for a machine learning task, I have encountered a problem I failed to solve during the last days. ...
C_Swann22's user avatar
  • 111
1 vote
1 answer
32 views

Multinomial Logistic Regression sensitive to choice of Encoding

I am using the following LogisticRegression model using sklearn. The task requires to select one label from multi-labels, so if I provide a, b the output could be <...
user_04248753498's user avatar
0 votes
0 answers
6 views

What is the best method of defining a score function for SKLearn Custom Estimator of a baseline fitting algorithm

I am attempting to optimize a baseline fitting algorithm for signal preprocessing by instantiating it as a SKLearn Custom Estimator and using GridSearchCV. How can I define a custom score to optimize ...
octaneOolong's user avatar
1 vote
1 answer
214 views

Why is Precision-Recall AUC different from Average Precision score?

I have been calculating the area under the Precision-Recall curve (AUPRC) using the code snippet below: ...
chilipepper's user avatar
0 votes
0 answers
9 views

Relationship among different classifiers of a model in multiclass problems

Suppose we are fitting a LogisticRegression model with scikit-learn, or the same model with pytorch. In multiclass problems, the strategy OneVsRest will fit a different classifier for each of the ...
CasellaJr's user avatar
  • 229
0 votes
0 answers
24 views

Gradient boosting to forecast just one-step ahead

I'm training a gradient boost algorithm (trying both XGBoost and LightGBM) for cash flow forecasting. I was able to do it well separating my training and test sets using the default separation (80/20) ...
vibebizarrinha's user avatar
0 votes
1 answer
23 views

Why is there a kmeans and kmeans_plusplus function in scikit-learn?

I want to use the kmeans method in the scikit-learn library and I was reading the documentation to see if there was a parameter to use kmeans++. It turns out that this is the default behavior. However,...
Adrian Fletcher's user avatar
0 votes
0 answers
37 views

Need Expert Advice for using sklearn pipeline to create a composite estimator with multiple models & features. Column Transformer with Mixed Types

I am trying to use sklearn pipeline to create a composite estimator. Please check attached image for model blueprint. Can anyone help me understand how this can be done in python. Column Transformer ...
prafull ghare's user avatar
1 vote
0 answers
77 views

Macro-average ROC curve not looking right

I am performing a 10-fold Cross-validation on imbalance datasets with small n examples and large p attributes. I am plotting ROC curves by merging predicted probabilities obtained by testing on each k ...
Edoardo Taccaliti's user avatar
2 votes
0 answers
49 views

Discretization of Multiple Time Series

I'm working on discretizing multiple time series for a project. Here's what I've done so far: I concatenated the train signals like this: [1,2,3,5] and [7,3,6,7] into [1,2,3,5,7,3,6,7]. Then, I ...
Nathaldien's user avatar
0 votes
2 answers
413 views

Handling categorical variables for Xgboost?

Currently there seems to be two approaches for handling categorical variables in gbdts: Xgboost as an option, but data need to be encoded properly (integers) Catboost can handle everything provided ...
Lucas Morin's user avatar
  • 2,234
0 votes
0 answers
37 views

My machine learning model cannot classify data that it has never seen before

I am creating a spam identifier to detect wheter an email is malicous. The issue I have is my model using the RandomForest Classifier showed it was 99% accurate. csv: https://www.kaggle.com/datasets/...
John Adams's user avatar
0 votes
0 answers
28 views

Algorithms from R-statistics package Caret R Package- LVQ algorithm, is there similar in Python

In the R-statistics package : Caret R Package, they have the LVQ algorithm that is used for the purpose of "Feature Selection". I have used this to do some data science in R-stats over 6 ...
Palu's user avatar
  • 103
0 votes
1 answer
152 views

Python SK-Learn KNN Imputer ( "ValueError: could not convert string to float: )

I have data with missing values. All columns are integer, except for a column that has missing values. These missing values, were set with a "?" which was converted to NaN using the Numpy ...
Palu's user avatar
  • 103
1 vote
1 answer
35 views

Number of stop words variation in libaries sklearn and nltk

Is there a reason why there is a big variation in the number of stop words? I assumed that there would be a general agreement from English experts how many stop words there could be. And even with ...
heretoinfinity's user avatar
0 votes
2 answers
513 views

Solve a non-linear system, in Python, with the GAUSS-NEWTON algorithm? (Jacobian matrix J, etc.)

I would like to solve a non-linear system (which contains the goals of a football team in previous matches) using the Gauss-Netwon algorithm, in order to find the parameter (of frequency) to use as ...
Zollikofen4's user avatar
0 votes
1 answer
28 views

Any Interface/Library that can take the Python ML code and run on spark cluster without learning PySpark?

I have been working with Python for machine learning and have a fair amount of code written in Python using libraries such as scikit-learn, pandas, and numpy. Recently, I’ve been faced with larger ...
Mohith7548's user avatar
1 vote
1 answer
31 views

Out-of-Range Target Variable in Sequence-based Machine Learning Model

I'm encountering a scaling issue in a machine learning project. I'm predicting a target variable from an input sequence (and doing this for many). However, I've encountered a challenge where the ...
Bloggy's user avatar
  • 11
0 votes
0 answers
62 views

How to deal with missing values in the output for XGBoost Regressor

So I am trying to create a regression model that takes two arrays as the input features and an array as an Output. However, some of the point in this dataset do not contain any value. This is because ...
RM25's user avatar
  • 1

1
2 3 4 5
47