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.
1,798
questions
0
votes
1
answer
62
views
Need new strategy for single class classifier
I am attempting to create a single class classifier where the classes are fairly close to balanced (+/- 25). My dataset has ~2,800 samples and ~1,100 features. All of the features are binary except ...
1
vote
1
answer
3k
views
Learning curves - Why does the training accuracy start so high, then suddenly drop?
I implemented a model in which I use Logistic Regression as classifier and I wanted to plot the learning curves for both training and test sets to decide what to do next in order to improve my model.
...
23
votes
2
answers
23k
views
What is the difference between $R^2$ and variance score in Scikit-learn?
I was reading about regression metrics in the python scikit-learn manual and even though each one of them has its own formula, I cannot tell intuitively what is the difference between $R^2$ and ...
0
votes
1
answer
497
views
Using centroids to find predictive cluster features
I clustered some data (rows: text documents, columns: word frequencies) using the KMeans implementation in Scikit Learn. This, like most other centroid-based clustering algorithms, returns a centroid ...
1
vote
2
answers
2k
views
Random Forest model good train and test performance but bad "real world" performance
I am working on a classification problem where I need to classify objects based on a visual data. There are a couple hundred different classifications to be made and I have around a million plus ...
4
votes
1
answer
4k
views
Ensemble models perform worse than single one
In my model testing, I tried to use model ensembling (blending in this case) to get better results. However the ensemble cannot beat single RandomForrestClassifier.
In first layer, I train meta-...
1
vote
1
answer
92
views
Machine learning step order question
I have been working on this project for over a year now and I believe i finally have things figured out. Mainly i'm looking for any suggestions or things i'm doing wrong with my process, but i also ...
1
vote
0
answers
394
views
Generate code for sklearn's GradientBoostingClassifier
I want to generate code (Python for now, but ultimately C) from a trained gradient boosted classifier (from sklearn). As far as I understand it, the model takes an initial predictor, and then adds ...
2
votes
1
answer
81
views
In a CART model, why is the average of the leaf proportions equal to the total proportion only when the classes are unweighted?
Suppose I want to do binary classification (the two classes are 0 and 1) and I choose to work with a CART model. I first fit this model on a training set. (Note that I am using Python, and ...
3
votes
1
answer
2k
views
Do you need to scale Vectorizers in sklearn?
I have a set of custom features and a set of features created with Vectorizers, in this case TfidfVectorizer.
All of my custom features are simple np.arrays (e.g. [0, 5, 4, 22, 1]). I am using ...
2
votes
0
answers
867
views
Why is my SVM multiclass classifier only correctly predicting a few classes?
I'm doing an online course to learn the basics of Machine Learning. This exercise is on how to use a SVM classifier with multiple classes. While the problem is specific to question 2 from this ...
5
votes
1
answer
8k
views
Linear SVM feature weights interpretation. Binary classification, only positive feature values
I'm using clf = svm.SVC(kernel='linear') on a data set with only two classes $y \in \{-1, +1\}$ and the feature values of all samples are normalized between 0 and 1....
15
votes
1
answer
9k
views
Difference between ElasticNet in scikit-learn Python and Glmnet in R
Has anybody tried to verify whether fitting an Elastic Net model with ElasticNet in scikit-learn in Python and glmnet in R on ...
2
votes
0
answers
1k
views
Strategy for finding optimal bagging parameters
I am using a BaggingClassifier of SVMs in sklearn. What is the best strategy for finding optimal parameters, using my training/vaildation data?
When using the full dataset, I can use grid search to ...
1
vote
1
answer
2k
views
Assigning weights to a multilabel SVM to balance classes
How is this done? I am using Sklearn to train an SVM. My classes are unbalanced. Note that my problem is multiclass, multilabel so I am using OneVsRestClassifier:
<...
1
vote
0
answers
45
views
Modelling house energy production using month as a variable
I'm attempting to model the energy production of a set of houses for which data on temperature and daylight over 22 months is available. The data is arranged such as such:
...
5
votes
1
answer
2k
views
Find max value of random forest regressor output
I was wondering, for scikit learns regressors (extra trees, random forest regressor etc), how can i find the combination of inputs that would give me the max value of the target variable?
Other than ...
8
votes
1
answer
2k
views
Difference in partial dependence calculated by R and Python
I noticed there's a difference in partial dependence calculated by R package gbm and Python's scikit-learn.
Here's ...
1
vote
1
answer
298
views
random forest for density estimation using sklearn [closed]
I want to use or extend sklearn-randomForest for density estimation. I don't know to tackle it. I read A. Criminisi and his team work on random forest as a unified framework where they first ...
2
votes
2
answers
1k
views
Is it legitimate to modify the classification of an scikit-learn random forest classifier by changing its default threshold?
I am using a random forest binary classifier (in sklearn) in Python to detect anomalous events with an extremely unbalanced class dataset (1% are positive and 99% are negative). My recall score for ...
23
votes
2
answers
34k
views
Difference between selecting features based on "F regression" and based on $R^2$ values?
Is comparing features using F-regression the same as correlating features with the label individually and observing the $R^2$ value?
I have often seen my ...
17
votes
3
answers
8k
views
Logistic Regression: Scikit Learn vs glmnet
I am trying to duplicate the results from sklearn logistic regression library using glmnet package in R.
From the ...
1
vote
0
answers
88
views
People detection in a supermarket zenital video
I am programming a people detector in a supermarket environment. I am using a dataset that I built from an example vídeo with 500 people and 500 background pictures which have 128x128 size with HOG ...
59
votes
3
answers
123k
views
Logistic Regression: Scikit Learn vs Statsmodels
I am trying to understand why the output from logistic regression of these
two libraries gives different results.
I am using the dataset from UCLA idre tutorial, predicting ...
1
vote
1
answer
2k
views
What do eps and tol do in LassoCV (scikit-learn)
Using scikit-learn:
http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LassoCV.html
Specifically, I am interested in:
1) If eps grows, does the accuracy(precision) increase or ...
1
vote
1
answer
41
views
Designing a training set for regression on probabiltiy values given time , categorical and continous features
Assume we have following variables out of which "Probability of sale " needs to be predicted , and this is to be done for a portable business vendor whose location changes with time :
...
0
votes
0
answers
883
views
Image Segmentation with a challenging background
[cross-posted from datascience, as no answers received]
I'm working on an animal classification problem, with the data extracted from a video feed. The recording was made in a pen, so the problem is ...
0
votes
1
answer
4k
views
How to combine the results of several clustering with scikit-learn?
I am trying to fit several cluster algorithms on one or across several subsets of a data matrix X, of shape (n_samples, n_features).
For example:
...
4
votes
1
answer
3k
views
Is it necessary to use warm_start when tracking oob_score in scikit RandomForestClassifier?
I'm planning on doing feature-selection with RandomForestClassifier by using the feature_importances and ...
1
vote
1
answer
644
views
Different predictions on multiple run of the same algorithm scikit neural network
Since a MLP can implement any function. I have the following code, using which I am trying to implement the AND function. But what I find that on running the program multiple times, I end up getting ...
2
votes
1
answer
2k
views
How to reduce dimensionality of audio data that comes in form of matrices and vectors?
I'm working on a project involved with identifying different types of sounds (such as screams, singing, and bangs) from each other. We've got our data a reasonable number of different transformations ...
2
votes
2
answers
3k
views
Lasso with constraint on some coefficients (not all)
I would like to run a lasso regression (L1 penalisation) with a twist: there are different constraints on my problem.
The coefficients for my features (predictors) are $\beta_i$.
I want to find the $...
0
votes
1
answer
1k
views
Minimizing residual sum of squares formula
I recently saw a question on the scikit-learn mailing list that I had wondered about. This is the formula to minimize the residual sum of squares.
http://scikit-learn.org/stable/modules/linear_model....
5
votes
2
answers
2k
views
Predictive modeling with feature selection using a small sample size?
I am trying to build a predictive model for a binary classification problem. I have 200,000 features and 100 samples. I want to reduce the # of features and not over-fit the model, all while being ...
1
vote
1
answer
736
views
Recommender System + Collaborative filtering without users
So I have a problem where I have a dataset that includes a list of Tools that are tied to Tasks. The data is structured as follows:
The users do not rate the Tools, they simply use them in a method ...
8
votes
1
answer
11k
views
Sampling from Gaussian Process Posterior
Anyone know of a Python package that both fits a Gaussian Process to data, and also lets you sample paths from the posterior? I'm interested in sampling the colorful lines on right (b) of the ...
3
votes
0
answers
71
views
What is the best way to simultaneously fit multiple binomial and continuous predictors?
What is the most efficient way to fit a linear model w so that
Y = w . X, where
X is a ...
0
votes
1
answer
133
views
How this code of cross-validation work? [closed]
I am new in sklearn and I try to learn how to use cross-validation to choose the best model of an SVM. I found this example How to split the dataset for cross validation, learning curve, and final ...
5
votes
1
answer
5k
views
Is it possible to share models between R, scikit-learn and spark?
If I create machine learning models in Python or R, is it possible to export the models in a format that could be imported by spark MLlib?
1
vote
0
answers
147
views
features selection - methods based on estimated feature importances vs. methods based on scores
I noticed that all feature selection methods implemented in sklearn are based on external estimator that assigns weights to features, AKA feature_importances.
I ...
4
votes
1
answer
6k
views
Random forest low score on testing data (scikit-learn)
I am trying to train my model using Scikit-learn's Random forest (Regression) and have tried to use GridSearch with Cross-validation (CV=5) to tune hyperparameters. I fixed ...
3
votes
1
answer
4k
views
Logistic regression using ANOVA kernel in SKLearn?
In RapidMiner, you can run a logistic regression classifier with multiple kernel types. I see no options in sklearn.linear_models.LogisticRegression.
Does anybody ...
3
votes
2
answers
721
views
Features, samples, and over-fitting?
I have a data set with 30 samples, 2 classes, and 100,000 features. When I run an SVC classifier on it from SKLearn using stratified cross-validation, the accuracy is barely better than chance.
After ...
1
vote
0
answers
2k
views
How would one use KDE as a one 1D clustering method?
I need to cluster a simple univariate data set into a preset number of clusters. Technically it would closer to binning or sorting the data since it is only 1D, but my boss is calling it clustering, ...
2
votes
2
answers
8k
views
Weighting time series data for prediction
I am building a simple random forest to predict soccer results in sckit. I simply train the model to predict each teams score based on various features. However I am trying to think how I can weight ...
8
votes
0
answers
4k
views
Which standard deviation of the cross-validation score?
When doing cross-validation for model selection, I found there are many ways to quote the "standard deviation" for the cross-validation scores (here "score" means an evaluation metric e.g. accuracy, ...
4
votes
2
answers
939
views
Question about the Scikit-learn "SVM-Anova: SVM with univariate feature selection" example
Can anyone explain to me why in the Scikit-learn "SVM-Anova: SVM with univariate feature selection" example
http://scikit-learn.org/stable/auto_examples/svm/plot_svm_anova.html
when we use all ...
3
votes
0
answers
99
views
Car out of route
I have one KML file that describes the movement of a car. Data comes from sensor in the car, contains wrong or noisy measurements.
I want to filter the wrong measurements, i.e. throw away the ...
3
votes
2
answers
7k
views
Ensembling with VotingClassifier
I am using VotingClassifier from sklearn.ensemble however i am puzzled with the results.
Consider following algorithms:
...
6
votes
1
answer
7k
views
Cross-validation vs random sampling for classification test
I usually have used cross-validation for testing classification performance. However, I read about the article that random sampling (bootstrapping) works better in many cases. I am not sure which one ...