Skip to main content

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
0 answers
26 views

What are the best options for imputing time series that is missing lots of days [closed]

I have many months of temperature data recorded roughly every ten minutes. Except it has gaps. If the gap is an hour or so, I can linearly interpolate, but if the gap is a few days this obviously ...
Tunneller's user avatar
  • 111
0 votes
1 answer
17 views

How does KNNImputer stores fitted values of the train set?

If someone here is familiar with the KNNImputer implementation of Scikit-learn, I would be eager to learn this from him. When you fit an Imputer transformer on your ...
Yann's user avatar
  • 43
0 votes
0 answers
14 views

GridSearchCV performs worse than baseline

I'm working on a binary classification problem using scikit-learn. One of the models I've tested is KNeighborsClassifier, for ...
AndreaTerenz's user avatar
4 votes
2 answers
85 views

Finding the corners of noisy polygons

I have some polygons that look for example like this: If I zoom in very close on one side, you can see the noise. The data is a list of x coordinates and a corresponding list of y coordinates. I ...
sav's user avatar
  • 239
2 votes
1 answer
67 views

Is my understanding/approach to nested cross-validation, final model tuning correct?

I am training a SVM on limited training data with unbalanced classes. Here are the things that I want to do: 1.) I want to make a statement of the generalizability ...
curious's user avatar
  • 115
0 votes
1 answer
35 views

Reason for high MSE and negative R square value

I am getting really high MSE and negative R square value. Dataset: https://docs.google.com/spreadsheets/d/1moTZS_LgOn6d74NC44i9lVcWchj-abVx/edit?usp=sharing&ouid=100514649347129021200&rtpof=...
user avatar
1 vote
1 answer
29 views

How to interpret the results of a classifier when train/test method gives much better results than cross validated one?

I need your help to understand a situation where using train and test set produces perfect results (in terms of accuracy, precision, and recall) but when cross validation is used, the accuracy on ...
letdatado's user avatar
  • 357
1 vote
0 answers
28 views

An error occurred when using the xgboost as a classifier for hiclass [closed]

Bellow it's my example when using the xgboost classifier for hiclass. My question is specifically directed to the hiClass Python package for hierarchical classification. I would like to model the ...
Ramzy's user avatar
  • 21
6 votes
1 answer
34 views

What is happening behind the scenes when we use CalibratedClassifierCV without prefit?

From what I understood by reading sklearn Probability Calibration, when we run CalibratedClassifierCV we will fit "a regressor (called a calibrator) that maps the output of the classifier (as ...
andy mot's user avatar
0 votes
0 answers
18 views

Weighted KNN imputation

Consider the following piece of python code. ...
Evan Aad's user avatar
  • 1,433
1 vote
1 answer
15 views

How does average_precision_score metric in scikit-learn work for non-probability prediction scores

Scikit-learn has an AP metric function Here The description of y_score (predictions) says :- ...
Anmol's user avatar
  • 113
1 vote
1 answer
41 views

Hierarchical clustering of a distance matrix with element weights

I am computing a hierarchical clustering of some geospatial data. I need to add in an element weighting to the approach. My current approach is: I compute temporal cross-correlations between my N ...
JoshD's user avatar
  • 51
0 votes
0 answers
11 views

Can exponentiated coefficients in multinominal logistic regression (with softmax normalization) be interpreted as odds ratios?

Exponentiated logistic regression coefficients are interpreted as odds ratios. Does this still hold in multinominal logistic regression, where softmax is typically used to normalize probabilities to ...
tomas's user avatar
  • 381
0 votes
0 answers
19 views

"How can I address the lack of correlation and a low R-squared value in my univariate linear regression when the data is scattered?"

** "I'm trying to find a correlation between the confirmed cases and deaths rates against HUMIDEX values. As you can see, the data is very scattered, so I understand that polynomial and ...
Carlos Leonel Guerrero Rodrigu's user avatar
0 votes
0 answers
39 views

Permutation Feature Importance in the Context of Cross Validation

I am considering two apporaches to calculate the mean, std and standard error (se) for ...
Kevin Li's user avatar
  • 103
1 vote
1 answer
23 views

Standard function to quantify consistency of a sequence of predictions

Let's say I let a deep learning model classify a single object multiple times but under varying circumstances. Ideally it should predict the same class again and again. But in reality its class ...
wouterio's user avatar
  • 111
0 votes
0 answers
19 views

How should uncertainties be treated when scaling data for optimisation

I have a large dataset for which I am using Bayesian statistics for parameter estimation and model selection (using MultiNest for more detail). This involves setting a prior over which the nested ...
shram's user avatar
  • 33
1 vote
0 answers
25 views

Changing OOB scoring metric for RandomForestRegressor from r2 to MSE

In sklearn's documentation https://scikit-learn.org/1.4/modules/generated/sklearn.ensemble.RandomForestRegressor.html it states that the default scoring for OOB samples are r2. It also states that you ...
Mathias Nissen's user avatar
2 votes
0 answers
27 views

K-nearest neighbors to estimate mutual information

I would like to use the mutual_info_regression object from scikit-learn to get a rough idea of how well any individual feature ...
David's user avatar
  • 1,276
0 votes
0 answers
40 views

Explicit form of L2 regularization in sklearn.linear_model.LogisticRegressionCV [duplicate]

I am using LogisticRegressionCV of sklearn, and I would like to know the explicit form of the L2 regularization in Logistic Regression. In the official page of LogisticRegressionCV, it is written $Cs$ ...
HQMA's user avatar
  • 145
3 votes
2 answers
74 views

Am I finding redundant columns in my data using Factor Analysis

I have a pandas data frame with 50 columns and 10 rows. The columns represent events and the rows are days. If an event occurs in a day, then the corresponding cell is a "1", else, is a &...
slow_learner's user avatar
0 votes
1 answer
49 views

How to handle correlated variables before using Recursive Feature Elimination?

I have seen a few Kaggle notebooks that list without reason that RFE works better when removing correlated variables. I struggle to see the reason why so I conducted some of my own research and would ...
AvanishM's user avatar
1 vote
0 answers
82 views

Why does feature importance decrease for highly correlated variables?

I am investigating the relationship between correlation between features and its impact on their feature importances using sklearn's DecisionTreeClassifier algorithm. I manipulated the correlation of ...
AvanishM's user avatar
4 votes
1 answer
90 views

Can a ML classifier's prediction be understood as a probability?

When predicting classes with a machine learning classifier, such as scikit-learn's DecisionTreeClassifier or KNeighborsClassifier...
YPOC's user avatar
  • 175
0 votes
0 answers
19 views

How to compute the correlations of extra features with respect to the principal components

I have a dataset with 4 features and n observations. I have done a Principal Components Analysis using only 3 features. Now I need to find the correlation between the extra feature and the principal ...
Charly's user avatar
  • 1
0 votes
0 answers
33 views

What are the best ways to perform feature selection for a binary classification problem with extremely imbalanced dataset

I have a classification problem where the size of the dataset is about 1 million lines but the target group is only about 0.6% of the dataset. I have about 40 feature including both categorical and ...
peiman razavi's user avatar
2 votes
2 answers
68 views

Regression model with multiple rows per user to predict death

I'm trying to build a regression model for predicting mortality in users according to their lab reports, the thing is in my dataset each row is a different laboratory even for the same user, for ...
Khantus's user avatar
  • 23
0 votes
0 answers
13 views

Using PLS to determine relative contributions of different drivers to the variability of a source?

I have a several drivers that are influencing the variability of a source. The drivers are not independent of one another, so I cannot use linear regression. Instead, I used Partial Least Squares (PLS)...
Billiam's user avatar
1 vote
1 answer
65 views

Sklearn's LogisticRegression C hyperparameter issue

In sklearn user's guide for LogisticRegression it is said that: where C is so, shouldn't C hyperparameter be in front of the regularization term r(w) rather than in front of the sum?
Ivan Mitriakhin's user avatar
0 votes
0 answers
17 views

accuracy value under f1-score in classification report

Consider this y_true = [0, 1, 2, 2, 2] y_pred = [0, 0, 2, 2, 1] from sklearn.metrics import classification_report print(classification_report(y_true, y_pred)) ...
Zoso's user avatar
  • 123
1 vote
1 answer
86 views

sklearn.metrics.r2_score vs sklearn.LinearRegression.score [closed]

I'm using sklearn to calculate the coefficient of determination between X (true age) and Y (predicted age). But I'm getting two different values for two different methods, which to the best of my ...
reas0n's user avatar
  • 123
3 votes
1 answer
36 views

How to find correlations of the features in a dataframe? The features are of mixed types (nominal, ordinal, discrete, and continuous)

I am working with python using pandas, and seaborn libraries. I have a dataframe, that I am using for some machine learning. My dataframe has a target variable, along with several other features. ...
letdatado's user avatar
  • 357
0 votes
1 answer
42 views

How to get best ml model in data with not-normal right skewed distribution?

I am working with small amount of data: https://github.com/jeffheaton/data/blob/master/bupa.csv I want to predict y data which is drinks, who have not-normal right skewed distribution. There is a ...
Jaminka's user avatar
  • 11
1 vote
1 answer
37 views

Extracted variance is above 1 (CCA and redundancy analysis)

I tried to repeat the analysis from Stewart and Love 1968, to compute the Variance Extracted and redundancy index from CCA. Based on their paper (if I followed it correctly), Variance Extracted per ...
Polina Turishcheva's user avatar
1 vote
1 answer
683 views

How to interpret pairplots()

I have been working on a Classification problem. And I want to see how many features associate with the target variables. Let me share an example. I got this pairplot using ...
letdatado's user avatar
  • 357
2 votes
1 answer
93 views

Is Linear Regression a good algorithm or even applicable with the distribution shown in the scatter plot I have shared in this question?

I am trying to use Linear Regression on a dataset using scikit-learn with python. And my understanding is that Linear Regression requires "some linearity" to exist between independent and ...
letdatado's user avatar
  • 357
11 votes
7 answers
3k views

Why do we use Linear Models when tree based models often work better than linear models?

In Supervised Machine Learning, and specifically on Kaggle, it is usually seen that tree models often outperform linear models. And even in the tree-based models, it is usually XGBoost that ...
letdatado's user avatar
  • 357
0 votes
0 answers
44 views

Classification Threshold varies wildly when using ROC curves for threshold moving

I'm trying to do threshold moving to get the appropriate threshold for an imbalanced dataset. I have a 1D timeseries that I am applying a binary transformer-based classifier on. I have: ...
Techie5879's user avatar
1 vote
0 answers
10 views

Issues with gradient of standard deviation in GPR using skopt.learning.gaussian_process

I'm currently working on a Gaussian Process Regression (GPR) model using the implementation provided in skopt.learning.GaussianProcessRegressor which is a wrapper for the sklearn implementation. This ...
Dave's user avatar
  • 11
1 vote
0 answers
97 views

What is the scalings_ attribute in Linear Discriminant Analysis?

Learning to do Linear Discriminant Analysis with sklearn, and a bit confused about the scalings_ attribute of the fitted model. The LDA classifier can be written as ...
jacob's user avatar
  • 459
0 votes
0 answers
14 views

Random forest for feature selection over large inhomogeneous data set [duplicate]

I have a very large dataset (500,000 examples, 3000 features with a lot of missing values). I want to run a random forest algorithm for feature selection with sklearn. Unfortunately, I cannot load the ...
Constantinus Spanakis's user avatar
5 votes
1 answer
276 views

Is ROC curve unique?

ROC curve and the area under it (AUC) are routinely used to evaluate the performance of binary classifiers. However, it seems that both, the shape of the curve and the area, depend on the parameter ...
Roger V.'s user avatar
  • 4,421
0 votes
0 answers
26 views

best practices on optimizing feature transforms for a model

I have a regression model that Transforms some time series features using a different halflife for each feature Uses the transformed features along with some other features to create a prediction ...
Arran Duff's user avatar
3 votes
1 answer
68 views

Is my regularized logistic regression model overfit?

I have a dataset with the following characteristics: moderate sample size (~300 samples) moderate class imbalance (~20% positives) high-dimensional (the number of independent variables, again ~300, ...
ladislaw94's user avatar
0 votes
0 answers
26 views

Sklearn feature selection performs strangely with 2 groups (and with SVC)

Previously I've successfully performed support vector classification with recursive feature elimination in R using the e1071 package, but I'm now hoping to move over to SciKit Learn given that Python ...
Benjamin Taylor's user avatar
0 votes
0 answers
51 views

How does `sklearn.metrics.roc_curve` work without using model predictions? [duplicate]

I am trying to understand sklearn's function for computing the roc_curve. If I understand correctly, one needs the TPR and FPR to compute ROC. However, sklearn's function takes as input - ...
desert_ranger's user avatar
1 vote
0 answers
22 views

A method to categorize variations in time series of images

I am working with a time series of remote sensing images from a particular area. Temporal standard deviation (SD) of these images showed high fluctuations at some regions with SD of 1.17 while some ...
sat_P's user avatar
  • 11
0 votes
0 answers
23 views

Classification problem: Choosing medication to prevent side effects based on patient characteristics

I need your help to solve a classification problem. Typically, we have independent variables and we try to predict a target variable. I have a different type of problem to solve. In my case, let's ...
Mohamed kenani's user avatar
0 votes
0 answers
49 views

Why are my training and validation curves suspiciously close to one another (sklearn neural network)

I am trying to graph the accuracy, error and precision scores over epoch for a neural network and am using cross validation. However, my training and validation scores are practically on top of one ...
iron_carbon's user avatar
1 vote
1 answer
113 views

meaning of drop in OneHotEncoder

I am having a tough time as a newbie understanding the drop argument in OneHotEncoder. Does it drop the column with the non-...
heretoinfinity's user avatar

1
2 3 4 5
37