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
10 views

Is the Silhouette Score meaningful with 200+ clusters?

Most of the examples I have seen that use the Silhouette Score to assess the quality of a particular clustering have less than 10 clusters. I am wondering if this score is an appropriate measure of ...
1
vote
1answer
146 views

sklearn LinearRegression handles rank deficient matrix

I have defined two numpy arrays X and y as ...
0
votes
0answers
15 views

Gaussian Mixture Model Clustering - cluster means are assigned to a different cluster

I ran a gaussian mixture model with 7 clusters on my data. My data has been PCA transformed with 200 components. Then I extracted the means of each cluster and applied the predict_proba function on ...
12
votes
3answers
1k views

Why can't scikit-learn SVM solve two concentric circles?

Consider the following dataset (code for generating it is at the bottom of the post): Running the following code: ...
0
votes
1answer
260 views

What is meant by “number of support vectors” in the SVM implementation of scikit-learn

I noticed that decreasing the C regularization parameter tends to increase n_support_ in the solution provided by ...
0
votes
1answer
23 views

Calculating F-Score using LOOCV

I am a machine learning novice and currently evaluating my decision tree model using the LOOCV. From my research I know that the accuracy can be calculated using LOOVC however I was wondering if it is ...
0
votes
0answers
15 views

Why does scikit-learn multiply class_weight with num_classes

Does it make a difference for keras (or scikit-learn) if our class_weight dictionary, used in .fit() for keras models and when ...
1
vote
0answers
281 views

Do I need to get dummies for “binary” categorical columns?

My question is about a multi-variate linear regression model. I am experimenting with Python's sklearn library with the Ames Housing data set: http://jse.amstat.org/...
1
vote
0answers
157 views

Can you use the isolation forest algorithm on a large sample size?

I've been using the scikit learn sklearn.ensemble.IsolationForest implementation of the isolation forest to detect anomalies in my datasets that range from 100s of ...
1
vote
1answer
37 views

Interpreting coefficients in Scikit-Learn

I'm experimenting with using SKLearn on some Spotify playlists. After doing the usual train_test_split I got these coefficients and am trying to draw conclusions from them: ...
0
votes
0answers
39 views

Similar error and R2 on Multiple Linear Regression and Random Forest, but very different predictions for new values?

I'm trying to compare a Multiple Linear Regression model against a Random Forest Regression model using sklearn. I have 4 features and one continuous variable to predict. I am training on 70% of the ...
0
votes
0answers
28 views

Identifying 1d clusters with scipy.stats or sklearn? [duplicate]

The thing is, I have tons of 1d-data that is distributed around multiple different mean points, I'm searching for a general way of identifying this little clusters and somehow spreading them. I've ...
2
votes
1answer
90 views

Ranking most probable labels from multilabel classifier

I have been working on a multilabel classification problem. I want to classify whether each of 25 labels is present on a given sample. The labels are not mutually exclusive. Ultimately, I would like ...
0
votes
0answers
32 views

Imputation where some data points should not be imputed

I am trying to impute the RSSI (Received Signal Strength Indicator) measurement from different WiFi access points. In this instance, data can be missing for two reasons: either the laptop did not look ...
1
vote
0answers
33 views

Gaussian Process Classifier and specifying kernel

I am using scikitlearn's gaussian process classifier and either I don't think I understand how the kernel is used (more likely), or there is an error in the module (less likely). In short, the ...
2
votes
1answer
52 views

Which algorithm is implemented in sklearn's SVM method?

I'd like to know which exact version of svm is implemented in slearn. The references section on sklearn's svm page cites libsvm package and a paper from 1999 which is about comparing classification ...
0
votes
0answers
16 views

Applying different kernels to parts of a dataset and merging the output [duplicate]

I am trying to create a classifier using SVM on a dataset that is composed of 6 sets of data for each of my observations. When I train the SVM (rbf kernel), I get a better performance of the ...
2
votes
0answers
21 views

How to prepare the training data for Support Vector Machine?

I'm currently doing some comparison of Naive Bayes Algorithm and Support Vector Machine classifying news to see each algorithm's accuracy. I already know how to prepare the training data for Naive ...
1
vote
0answers
15 views

Scaling test set based on training will cause test set to have values greater than the scale

I have a time series data that does not have an upper limit (data is somewhat monotonically increasing). Making the Test set values larger than the training set. (I am not shuffling because time ...
2
votes
1answer
264 views

Logistic Regression Loss Function: Scikit Learn vs Glmnet

The loss function in sklearn is $$\min_{w,c}{\frac{1}{2}w^Tw+C\sum_{i=1}^N{\log(\exp(-y_i(X_i^Tw+c))+1)}}$$ Whereas the loss function in glmnet is $$\min_{\beta,\beta_0}{-\bigg[\frac{1}{N} \sum_{i=...
1
vote
0answers
150 views

PCA returns duplicated features for different components

I performed (sklearn) PCA on a (1416960,140) pandas DataFrame. The resulting components_ attribute is a matrix where each ...
2
votes
0answers
359 views

R alternative to scikit-learn [closed]

As a statics researcher, I've been using R since university and I know it quite well, I also know that it's immediate, but it quickly gets chaotic, and this also happens because of the variety and ...
0
votes
1answer
59 views

Derivative of all the parameters in Logistic Regression

$\mathcal{L}$ is the loss function, $\mathcal{L} = y_i \text{log} \sigma(z) + (1-y_i) \text{log} (1-\sigma(z))$, where $z = \sum_i w_ix_i$, with $w_i$ representing the weights and $x_i$ the features. ...
2
votes
2answers
114 views

How to interpret the meaning of KMeans clusters

Using the elbow method, I determine the correct number of clusters for the KMeans function. Having done that, I still have no idea how to interpret the clusters in a meaningful way. If someone asked ...
2
votes
0answers
230 views

Understanding probability calibration with isotonic regression in sklearn

After reading sklearn manual it was not very obvious for me to understand how Isotonic regression works in the case of probability calibration (using CalibratedClassifierCV). I briefly read sklearn's ...
0
votes
1answer
32 views

How improve linear regression model in my example

I try to perform an example of linear regression model in python. The aim is find a linear relationship among two features in my dataset, this features are 'Year' and 'Obesity (%)'. I want train my ...
1
vote
0answers
25 views

Calculating three average precisions and a single value for ROC from raw predicted class outputs

I'm not a statistician or mathematician so I apologize if I use any terms incorrectly. Please do point out any errors in my use of terminology. The four values I need are the equivalent of Weka's ROC ...
0
votes
1answer
47 views

Iterative Imputor gives the same output for all the values it has to impute

I have a df named so as follows: ...
1
vote
2answers
1k views

Random forest on data having only one feature

So I'm applying Random forest regression from sklearn library to a dataset having only one feature and I'm getting a very good score. The output labels are continuous. The problem is I don't quite ...
1
vote
1answer
492 views

how to combine recursive feature elimination and grid/random search inside one CV loop?

I've seen taught several places that feature selection needs to be inside the CV training loop. Here are three examples where I have seen this: Feature selection and cross-validation Nested cross-...
0
votes
0answers
41 views

Is it reasonable to do log transformation on both input and output variables in multioutput regression problem?

I have been working on a small machine learning project, and I decided to use regression algorithms to solve the problem, however, I have encountered some problems in the project. Let me show some ...
1
vote
0answers
64 views

OneHotEncoding and Scaler in Pipeline, avoid data leak?

so I have my data and split it in the beginning in test and train set. Then I apply following Pipelines on it: ...
2
votes
0answers
33 views

Literary author classification from books content

Some background: I'm pretty much a newbie in NLP and in machine learning in general, I'm currently following some courses in my university about these topics. I'm working on my first ml project using ...
1
vote
1answer
48 views

Sklearn PCA Calculation Seems to Use Truncated Division as Opposed to Floating Point Division

I am working with the following dataset: Housing dataset From this dataset, I am only interested in the following columns: GrLivArea (independent variable), and SalePrice (dependent variable). What ...
3
votes
1answer
156 views

Machine learning (KNeighborsRegressor) Train score = 1

I'm trying to understand the outcome of this model. What I don't understand is why the score train is always one. I understand that this type of behavior is due to overfitting. However, I have already ...
1
vote
1answer
691 views

Why accuracy and prediction changes when random state is changed in machine learning?

When random state is changed between 0,1,2 manually I observed accuracy is changing and at the same time when the model was checked with random state '0' and with internally split X_test data it ...
1
vote
3answers
1k views

Logistic Regression Failed in statsmodel but works in sklearn; Breast Cancer dataset

I am learning about both the statsmodel library and sklearn. I am trying to construct a logistic model for both libraries trained on the same dataset. In sklearn, the following works: ...
2
votes
1answer
780 views

Interpretation of y-axis in partial dependence plot

First off, I know there are many questions on this site similar to this one. I've read them, and have not been able to find a solution. In Elements of Statistical Learning, the following figure shows ...
0
votes
2answers
47 views

How to train model when Data is consist of matrices [closed]

I am new to ML and python. I am facing an issue related to the training SVM model. I have a training data file size (200,50,120). Where 200 are my examples (or experiments). While Actual data is a ...
1
vote
0answers
165 views

Multi Output Regressor Random Forest - Every output looks at different features

I am supposed to predict a hourly timeseries T 48 hours ahead in the feature. For technical reasons, I can only use a Random Forest Regressor, with 48 output ...
1
vote
1answer
92 views

Categorical and Numerical Features - Correlation [closed]

I am working with a dataset that has both numerical and categorical features. I have seen this post which discusses the problem in R, and was wondering if someone could recommend the same in ...
0
votes
1answer
30 views

Algorithm for recognizing similar data?

I've been given a youtube trending dataset with the assignment to make a predictive model which outputs the probability of a video getting into trending with at least 60% accuracy. I have the title, ...
4
votes
1answer
334 views

Mann Whitney U and ROC AUC relationship

I've been learning about the relationship between Mann-Whitney U. Supposedly, the area under the ROC curve should be U/(n0 * n1), where U is the Mann-Whitney ...
0
votes
1answer
139 views

How can I replicate the process sklearn calculates the posterior probabilities?

I have a question pertaining to scikit-learn methods. Can I get the same probabilities obtained with predict_log_proba() by hand calculating the likelihoods and prior obtained with feature_log_prob_ ...
0
votes
1answer
2k views

Partial Least Squares Using Python - Understanding Predictions

I am having trouble constructing/applying a regression equation from PLS to make a prediction in a manner that can obtain the same predicted values that the model produces when calling the model....
0
votes
1answer
78 views

Can training with too much data cause overfitting in a random forest?

I have a dataset with around 3.4 million records. I am predicting a binary target variable. The distribution of the target variable is 10%. I am using 17 features for prediction and am comparing ...
1
vote
1answer
346 views

Bagging classifier vs RandomForestClassifier [duplicate]

Is there a difference between using a bagging classifier with base_estimaton=DecisionTreeClassifier and using just the RandomForestClassifier? This question refers to models from python library called ...
1
vote
1answer
86 views

LDA vs QDA on the AT&T dataset, poor QDA performance

I am obtaining two very different accuracies for the AT&T face database when fitting the model with lda & qda. Before using QDA I first search for the ideal regularisation parameter, AFAIK the ...
1
vote
1answer
93 views

SKLearn cross_val_score error AttributeError(“'Binarizer' object has no attribute 'predict'”,)

So I have this code ...
0
votes
1answer
20 views

Obtain feature names from model when training data is not available

Is it possible to obtain the feature names expected by a model if we don't have the training data available? I want to ensure that I am giving the model the data with features in the correct/expected ...

1
5 6
7
8 9
32