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
0
votes
0answers
8 views

How to forecast same number of inputs

I would like to forecast two non-correlated attributes (non-stationary). The input is X1 and X2, and I need the same attributes as output X1 and X2. I've followed some examples in here https://...
0
votes
0answers
12 views

Forecast two variables in MLP scikit-learn

I have two non-correlated variables which I would like to forecast. I mean, the output should be those two variables. How can I do it? I just found examples where output is one variable. https://...
0
votes
0answers
30 views

Reproducible sklearn SelectKBest + GridSearchCV results

I would like to be able to reproduce sklearn SelectKBest results when using GridSearchCV by ...
2
votes
1answer
37 views

Training, saving and distributing the model – what about data the transformations?

I have a question about process, and I’m a relative noob when it comes to Machine Learning. Let’s say I have dataset with X features to train a model. During development of my model I drop a few ...
0
votes
0answers
75 views

When does MAPE (Mean Absolute Percentage Error) fail?

I have a multioutput regression model that predicts float values. When using MAPE to evaluate regression model performance (using either built in libraries or implementing a function for it) I am ...
0
votes
0answers
23 views

Is there any way of limiting the matchable classes for data in SVMs?

Let's say I'm working on the "Recognizing hand-written digits" where we are using an SVM to analyze handwritten digits. Now imagine we have some additional information, for each image we are ...
0
votes
0answers
15 views

Sentiment Analysis using an SVM - How to comprehend the models decision based on weights and input?

I am doing sentiment analysis using sklearns linear SVM and I want to try to figure out why certain texts get incorrectly classified by looking at the models weights and the vector for that text. For ...
0
votes
0answers
14 views

Machine learning training with regard of hidden features

Having an effect that my data has a hidden feature, leads to falsely high accuracy, when training my data without regarding this effect. This kind of data looks like: index n features label Then the ...
0
votes
2answers
65 views

Large Negative r-Squared Scores using Cross-Validation

I am working working with the World Happiness Report dataset from Kaggle. When using either cross_val_score or GridSearchCV from ...
0
votes
1answer
48 views

XGBoost, Imbalanced Data and CalibratedClassifierCV

I am currently working with a slightly imbalanced dataset (9% positive outcome) and am using XGBoost to train a predictive model. ...
0
votes
1answer
47 views

Does GridSearchCV actually fit the best model to the training data, or do you have to refit after hyperparameter optimisation?

I have this code, with the aim being to develop a neural network with cross validation and hyperparameter optimisation for a regression problem (continuous features, continuous label). ...
2
votes
0answers
23 views

Does Sklean have a Gaussian Discriminant Analysis (GDA)

I was trying to look for the Gaussian Discriminant Analysis in sklearn however I was unsuccessful and I was wondering what it the name of it. I was about to find the LinearDiscriminantAnalysis and ...
1
vote
0answers
25 views

Least median square in python

I couldn't find least median square technique on python, any one knows any library? Or how to adapt it from the common linear regression.
1
vote
1answer
16 views

Control group in ML model? [closed]

I have on my Data Frame column with name "group" with values: control_group / campaing_group. And my question is should I use observations from "control" in Machine Learning model ...
0
votes
0answers
21 views
0
votes
0answers
32 views

How do I handle separate standardization for test and training when doing Cross-Validation

I understand that if I am going to standardize numeric columns in preparation for a machine learning algorithm, I should do this scaling separately for training and testing data, which is fine and ...
0
votes
0answers
9 views

F1 Score of RFE Top 20 features Greater than RFE CV F1 Score

I've been running some simulations using RFE on random forests and I got some puzzling results. Let's say I run RFE with CV and the highest F1 score is sometimes lower than the F1 Score I get from ...
0
votes
0answers
8 views

“GP Kernel” between parameters in skopt

I am trying to run skopt's gp_minimize optimization algorithm over a set of parameters, and I'm having trouble understanding how ...
3
votes
2answers
103 views

How to understand and interpret multicollinearity in regression models

I am using python to implement different regression models on a fantasy sports dataset. I am using a multivariable dataset which contains 5 independent variables to 2 regression models, which is Lasso ...
3
votes
0answers
33 views

KFold CV and Monte-Carlo CV performance for a regression problem

I've ran the following code on google colaboratory. Succintly, I've used some housing prices for a typical regression problem, and then trained the same simple neural network, but with different Cross-...
2
votes
0answers
34 views

Why Ridge and Lasso regression is returning almost identical results to Linear Regression [closed]

I was trying to compare Ridge, Lasso and Linear Regression models to each other. I am using a subset of the Ames housing dataset. Here is a link to an already preprocessed dataset that I am using. The ...
0
votes
1answer
26 views

Why macro F1 measure can't be calculated from macro precision and recall?

I'm interested in calculating macro f1-score by macro precision and recall manually. But the results aren't equal. What is the difference in the final formula between f1 and f1_new in code? Would you ...
3
votes
2answers
269 views

Is `TweedieRegressor` a completely general GLM solution?

I consider sklearn's TweedieRegressor a general solution for all types of regression, as it is a GLM model. If I understand well,...
2
votes
0answers
58 views

Efficient way to use Repeated K-fold cross-validation along with grid search using sklearn

I am intended to know the impact of outlier analysis on SVR's performance. So, I need to have two versions of SVR model: Version_1 with all the original dataset, Version_2 with just the non-outlier ...
0
votes
0answers
22 views

DecisionTreeClassifier performing better than RandomForestClassifier

I am currently working on a supervised learning project with sklearn. According to my experiments I observe DecisionTreeClassifier(DTC) performs better than RandomForestClassifier(RFC), both in term ...
0
votes
0answers
23 views

Is it a bad idea to always standardize all features by default? [duplicate]

Is there a reason not to standardize all features by default? I realize it may not be necessary for e.g., decision trees but for certain algorithms such as KNN, SVM and K-Means. Would there be any ...
2
votes
0answers
36 views

Is it always better to use the RobustScaler (vs StandardScaler)?

From reading the docs, I believe the RobustScaler is more immune to outliers that the StandardScaler. In that case, why not just use the RobustScaler always?
1
vote
0answers
23 views

Imbalanced class issue

I am taking my first steps in machine learning and data science area. I know for sure that my next task will be related to the imbalanced class problem. I’ve walked through many articles covering this ...
3
votes
1answer
51 views

Accuracy over different sample sizes from dataset

What I'm trying to do is predict how much more data would help in a classification task. So, what I'm doing is bootstrapping entries in my dataset to get a sample, with a specified size. Then, I fine-...
0
votes
1answer
28 views

When Normalize is true are the coefficients arising from LASSO normalized or in the original state?

From this question: Are LASSO coefficients raw or standardized? I understand that when standardizing the data, the coefficients are returned to the original scale. Is this correct? Can I just plug in ...
0
votes
0answers
20 views

Objective for Ward's agglomerative clustering

As far as I understood the original article (Ward, J. H. (1963). Hierarchical grouping to optimize an objective function), Ward proposed the following criterion for agglomerative clustering. In each ...
0
votes
0answers
55 views

Train and test score - overfitting?

I have hourly time series data with a range of two years. I want to test my model when predicting my target variable (continuous) for a specific week. I'm doing the following: Splitting my data into ...
0
votes
1answer
37 views

Cross validation with GridSearchCV or train-val-test split

I have a question regarding the CV in GridSearchCV. To test my model should I split my data into 3: training, validation, test? For easy understanding let's say my data is split into training with 60% ...
0
votes
0answers
16 views

Random Forest behaviour with multi output hierarchical dependent variables

I have trained Random forest on multi-output(4) variables in python where each dependent variable is multi-class and variables have hierarchical dependency. I cannot provide the actual details due to ...
0
votes
0answers
30 views

Cross_val_score for regression is highly negative

I am doing regression modeling. Here is the code ...
1
vote
0answers
38 views

How to use sklearn's Gaussian Process Regression parameters?

I have been trying to play around with Gaussian process Regression. I have constructed a fake 1D data for this. I am using a Squared exponential kernel. I solved the regression problem using inbuilt ...
1
vote
0answers
17 views

k-Fold evaluation across periodic data

I am currently working on code to predict a customers next order on a B2B eCommerce site. The data has already been reduced down to a basic how much get orders for each part each week (with zero ...
1
vote
1answer
26 views

How does linear SVC generate the predictions after learning the feature weights

I'm fitting an SVC model with linear kernel, after that i'm checking the dot product of the fitted weights by the input to understand the prediction better. From my understanding of the linear SVC ...
0
votes
0answers
23 views

How to do augmentation and k-fold cross validation?

I am solving one NLP problem which by default gave me train and test data. Test data has no labels while train has. Now I split train dataset into train(I will call this as updated train dataset) data ...
1
vote
1answer
48 views

Random Forest Regressor Python - cross validation

I'm training a Random Forest Regressor and I'm evaluating the performances. I have an MSE of 1116 on training and 7850 on the test set, suggesting me overfitting. I would like to understand how to ...
0
votes
0answers
9 views

How can a lower C-parameter value lead to both better training and testing score in a SVM model?

I am trying out ML classification models (Logistic Regression and SVM) with different C-parameter values with Scikitlearn's breast cancer dataset: ...
0
votes
0answers
23 views

I applied ordinalEncoder to the categorical data, these new representations of the categories, can StandardScaler be applied to them?

I have some data with, categorical and numerical data, to the categorical data I apply OrdinalEncoder. I want to apply the StandardScaler, the question is: do I apply it only to the numerical data and ...
1
vote
1answer
74 views

Validity of BIC for Dirichlet process mixture models

I am implementing clustering using Dirichlet process mixture models via scikit learn's Variational Bayesian Gaussian Mixture model. I arrived at the appropriate priors iteratively, and I am able to ...
0
votes
1answer
146 views

Getting nan scores from RandomizedSearchCV with Random Forest Classifier

I am trying to tune hyperparameters for a random forest classifier using sklearn's RandomizedSearchCV with 3-fold cross-validation. In the end, 253/1000 of the mean ...
0
votes
0answers
55 views

How can overfitting on patterns of missingness be prevented?

I'm working on a binary classification task with a dataset that contains a large number of missing values. Most features are numerical rather than categorical. I believe the patterns of missingness in ...
0
votes
0answers
12 views

Applying trees to ordered discrete dependent variables?

I am trying to use trees to model the number of months counties take to fully recover following an extreme weather event. Since I am looking at count of months, I have an ordered discrete dependent ...
2
votes
1answer
46 views

K Fold Cross Validation in Python

I am trying to compare 2 classifying methods (SVC vs Random Forest) in order to do that I am using the cross_val_score function. It is posible to use the same folds in both methods? In order to ...
0
votes
1answer
51 views

Scoring rules (log-loss vs. F1-weighted) and RandomizedSearchCV

I read multiple posts about scoring rules during cross-validation and the fact that the log-loss score is a proper scoring rule and, correct me if I am wrong, any threshold based approach is a ...
1
vote
0answers
16 views

Hausdorff Distance with Manhattan Distance

I'm applying Hausdorff Distance to understand if two datasets are representing the same subset of the space of a particular problem. The point is that I've read the Hausdorff distance computes the ...
1
vote
1answer
67 views

CalibratedClassifier and RandomSearchCV

I was wondering what the right steps would be to perform both hyperparameter optimisation and obtain a calibrated model. I thought the following could be the right way (70% train split, 10% validation ...

1
2
3 4 5
32