Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [scikit-learn]

scikit-learn is a machine-learning library for Python that provides simple and efficient tools for data analysis and data mining, with a focus on machine learning. It is accessible to everybody and reusable in various contexts. It is built on NumPy and SciPy. The project is open source and commercially usable (BSD license).

0
votes
0answers
17 views

Manually computed AIC differs from statsmodels AIC

I tried to manually code a formula for the AIC. I want to use it in connection with scikit learn. For testing if i coded correctly, I compared the AIC values from statsmodels given the same datasets. ...
1
vote
1answer
16 views

Including the outcome variable in multiple imputation

I'm trying to perform binary classification on a dataset with missing values. I used sklearn's iterative imputer to impute these values and I got pretty good results. However, I realized that I was ...
0
votes
0answers
19 views

Are feature importances from tree based models directly actionable for business?

If my response variable say is "has_repurchased" [0 or 1] and I have all customer level features. Can I rank the features in order of importance from the random forest model and report them as whats ...
0
votes
0answers
3 views

Validation and Learning Curves with Pipeline or Model Only?

I have a pretty complex Sklearn pipeline including Standardization, PCA, and more. I created a couple of models and would like to evaluate them with learning and validation curves. I find myself ...
0
votes
0answers
8 views

Error when computing the gradient of a derivative with Gaussian process regression in scikit

Gaussian process regression in scikit-learn provides a conditional mean and variance, $(y_*,\sigma_*^2)$, based upon the observed data, $(y,\sigma^2)$. But given $(y_*,\sigma_*^2)$, how can you ...
0
votes
1answer
20 views

Using different color scales for correct and incorrect predictions in an sklearn confusion matrix [on hold]

I'm trying to illustrate the accuracy of my neural net predictions using a matplotlib plot of an sklearn confusion matrix. My problem is that the size of my test set is quite large the accuracy is ...
0
votes
0answers
11 views

How to avoid overfitting by entities in short text classifcation? [on hold]

I am binary classifying headlines. This headlines are between 1 to 7 words, and sometimes include the name of the person who created them or locations. I am able to classify with 81% precision but ...
1
vote
1answer
20 views

What does the PCA().transform() method do?

I've been taught to think of the PCA as change of basis technique with a cleverly chosen basis. Let's say my initial data is a $m\times n$ matrix $X$ where $m$ is a number of features and $n$ is a ...
0
votes
0answers
5 views

Datasets for Document Classification problem [on hold]

I am doing a project to make a application that can take pdf and docx documents as input and classify them into various categories such as - Financial - Government and Political - Sports and ...
0
votes
0answers
4 views

what is the difference between sklearn's train_test_split and keras load_data()?

im experimenting on autokeras, while doing so i came across something like (x_train, y_train), (x_test, y_test) = mnist.load_data(), is this different from sklearn.model_selection....
2
votes
0answers
17 views

How to aggregate calibration curves which were created in cross validation?

When looking into Scikit's CalibratedClassifierCV I noticed that the object needs to keep multiple calibrated classifiers in memory to average the results in real time. I understand that these ...
0
votes
0answers
21 views

Which algorithm should I use to predict the winner/loser of a competition, among 5 competitors?

I hope I posted in the correct session. I need to solve this "simple" problem. PROBLEM EXPLANATION I need to predict who is more likely to win a car race, among 5 drivers. I have a database that ...
1
vote
1answer
14 views

Weighted Minkowski distance for DBSCAN

I'm trying to make clustering of image's pixels with DBSCAN, using RGB values and pixel's coordinates as features. It works well with just RGB values as features, but I want pixels with the same color,...
0
votes
1answer
48 views

Performance Imbalance Dataset Decision Tree

I have a imbalance dataset for a classification task, with the minority class accounting for about 21% of the total. When I use a decision tree based model for prediction, let's say a classification ...
0
votes
1answer
14 views

scikit learn PCA - transform results - explain why transform does not match dot product of components on original data

I have a timeseries of first differences onto which i apply PCA using scikit to get the first PC ...
0
votes
0answers
13 views

Short string classification, high acc tons of false positives. ¿Are we on the right path? [duplicate]

TL;DR AT THE END Suggested to ask here from https://stackoverflow.com/questions/56038093/short-string-classification-high-acc-tons-of-false-positives-are-we-on-the-ri (same question but on ...
1
vote
2answers
31 views

Which Labeling should I use for my data

I am currently getting ready to preprocess my data for scikitlearn and was wondering if I should use one hot encoding or label encoding when working with values greater than 9. I may be wrong but when ...
-3
votes
1answer
33 views

why the neural network gives me null results? [closed]

I trying to predict some fluid parameters, you will find the data I use in the drive link (24 input and 3 output to predict): DATA. first of all I replaced the null values ​​in the data with the ...
1
vote
2answers
54 views

Determining epsilon for DBSCAN

I'm using the method described in this paper for determining the optimal epsilon value for DBSCAN clustering in which a plot of the nearest neighbors is used: However, the plots in the paper and ...
0
votes
1answer
21 views

ROC-AUC score in sklearn

I'm trying to understand ROC-curve and AUC characteristic for it and found that behaviour of sklearn function roc_auc_score ...
-1
votes
0answers
12 views

How to choose which classifier is better than the other one?

I'm doing binary classification by using Gradient Boosting Machine (GBM). First, I used scikit implementation of GBM and get these results: Training Dataset AUC: 0.97 Test Dataset AUC: 0.90 And ...
0
votes
0answers
23 views

Logistic regression: Understanding convergence towards coefficients from synthetic model

In preparation for working on real-world datasets, I am exploring classifiers on syntethically generated data. First I generate random variables $X_1 ... X_8$ that represent observables with physical ...
0
votes
0answers
20 views

What do you call the problem of predicting a non-binary value for many parameters?

I have some discrete decision variables -namely colour, texture, size and temperature- which clearly have many possible values and the object I observe will obviously have some value for all of these ...
1
vote
0answers
33 views

Calculating PCA coefficients using SVD, PCA (sklearn) and Covariance Matrix

I am trying to understand PCA implemented in different methods on python. I am failing to get equal PCA coefficients in each of the methods. By PCA coefficients I mean data projected in the principle ...
0
votes
0answers
32 views

High dimensional clustering (K-means and DBSCAN)

My research is all about comparing the K-means and DBSCAN(Density-Based Spatial Clustering with Application of Noise) and I used python with the aid of jupyter notebook. I have 28 variables and 3048 ...
0
votes
0answers
18 views

Cross Validation and Feature Selection with Chronological Split and Feature Preprocessing

I have a task with daily entries for which I need to do binary classification. Suppose I have 18 months of data and the model is refit every month. In addition I've got about 150 one-hot encoded ...
0
votes
0answers
22 views

Why am I getting r2_score on test set as negative?

I wanted to initally test out without dropping any features (Redundant features such as ID are dropped). data_source -> https://archive.ics.uci.edu/ml/datasets/Automobile This was my procedure: 1) ...
1
vote
1answer
24 views

Dummy/baseline models for time series forecasting

I am working on an evaluation of time series forecasting models in Python, more specifically with statsmodels, scikit-learn and tensorflow. I think it makes sense to first compare the model ...
0
votes
1answer
45 views

How do I make predictions from Lasso coefficients?

I am struggling to understand the implementation of lasso regularization (LassoCV in sklearn) and feature selection. First, I used cross-validation to determine value of alpha that minimizes the MSE. ...
-2
votes
0answers
27 views

Principal component Analysis to Original variables [duplicate]

First, I have high dimensional data which has 3048 observation and 28 variables. Since I have high dimensional data I used principal component analysis to reduce the dimension of my data. Now I have ...
0
votes
1answer
21 views

Low Feature Importance Scores but High Precision/Recall?

I am running a heterogeneous classification model with numeric, categorical, and unstructured text data to predict a binary response. The data suffers from class imbalance hence I decided to perform ...
1
vote
1answer
44 views

Improve precision/recall for class imbalance?

Trying to get better precision/recall for both classes ... any tips? I have heterogeneous features [a few num vars, a few cat vars, and 2 text vars] Target is a binary classification w/ class ...
0
votes
0answers
20 views

Understanding epoch, batch size, accuracy ,performance gain in lstm forecasting model

I am new to machine learning and lstm. I am referring this link LSTM for multistep forecasting for Encoder-Decoder LSTM Model With Multivariate Input section. Here ...
2
votes
2answers
38 views

How effective is SVM over big datasets?

I have a dataset of 800,000 observations and 11 features that I am using for a classification problem. I tried to optimize my model many times but in vain. The one thing I haven't tried is using SVM. ...
2
votes
2answers
39 views

Randomized search on big dataset

I have a dataset of 700,000 rows that Im applying random search on. My parameter grid looks like this: ...
0
votes
1answer
22 views

Cross validation for time series classification

Relying on the documentation provided by scikit-learn (https://scikit-learn.org/stable/modules/cross_validation.html#cross-validation-of-time-series-data), the TimeSeriesSplit method is implemented ...
0
votes
0answers
17 views

Why do cross_val_score() and fit() return the last value, and not the best?

When you fit() a model, in let's say Keras, over a large number of epochs, chances are overfitting will occur. When supplied with a validation-set, you can easily find the point where the validation ...
4
votes
1answer
98 views

How to Compute the Brier Score for more than Two Classes

tl;dr How do I correctly compute the Brier score for more than two classes? I got confusing results with different approaches. Details below. As suggested to me in a comment to this question, I ...
1
vote
1answer
21 views

Comparison Between Features for Random Forest or Decision Tree

In the random forest of sklearn package, will there be some relationships among features? For example: if value(feature_1) > value(feature_2); it is category A, else B. I read some materials online, ...
0
votes
0answers
41 views

Can LogisticRegressionCV be used with StandardScaler?

If we apply StandardScaler to transform the training data before we fit the LogisticRegressionCV model, I think it is incorrect ...
0
votes
1answer
69 views

Issue in evaluating the performance of my “clustering algorithm” using NMI, ARI when the “ground truth” is available? [duplicate]

(**Edited the question after the initial comments) Suppose, Ground_truth_data = [1, 1, 1, 1, 1, 1, 1]; Clustering_result = [1, 1, 1, 1, 1, 1, 2]; Here, as you can see, there are "7" instances of ...
0
votes
1answer
26 views

How to normalize mutual information between to real-valued random variables?

How can I normalize mutual information between to real-valued random variables using Python or R? ...
0
votes
1answer
45 views

Which algorithm does Decision Tree classifier in sklearn implement?

Which algorithm does Decision Tree classifier in sklearn Library implement? Is it GUIDE? There are a total of 6 techniques available according to my knowledge, according to this paper
0
votes
1answer
49 views

Specific the Validation set in GridSearchCV

For my Strategy that I'm using is doing the cross validation on medical information from 10 patient. So what I am doing is split 1 subject to be validation set and 8 subjects are training sets. And I'...
1
vote
1answer
25 views

Model Deployment: export Scikit Learn Pipeline or Model only?

Following ML best practices, I use Scikit Pipelines to make sure my data preprocessing is the same at each model development iteration. Also as a best practice, once I have completed model ...
1
vote
0answers
46 views

Predicted Ys for Lasso regression show negative correlation with observed Ys

I observed than when using Lasso regression and KFold crossvalidation with my data, predicted values show negative correlation with observed values. I tried to replicate the problem with a randomly ...
0
votes
0answers
11 views

Package to perform 2nd degree polynomial regression with L1 penalty for use of the 2nd degree

I'm trying to fit either a straight line or 2nd degree polynomial through many sets of points (2-dimensional data). I would much prefer a straight line over a polynomial, so am trying to penalize the ...
3
votes
1answer
188 views

What makes a Random Forest random besides bootstrapping and random sampling of features?

After reading about random forests in the original paper and in textbooks I was under the impression that what makes the model random is bootstrapping - training each tree on a different random subset ...
0
votes
0answers
111 views

How to express Root Mean Squared Error as a percentage?

I want to compare the result of my prediction with that of another person's prediction. In the article, the author says 'The relative percentage of root mean square (RMS%) was used to evaluate the ...
1
vote
1answer
107 views

Multivariate (Polynomial?) Regression

I'm trying to solve one problem, I'm not sure how to do it... Here is my problem (related to Heat transfer/Fluid mechanics) that I tried to simplify : I have a few independents measurements $x_1, ...