Questions tagged [scikit-learn]

scikit-learn is a popular machine learning package for Python that has simple and efficient tools for predictive data analysis. Topics include classification, regression, clustering, dimensionality reduction, model selection, and preprocessing.

Filter by
Sorted by
Tagged with
0 votes
1 answer
423 views

Feature Selection algorithm/library for CRF

I am using the Conditional Random Fields CRF suite scikit-learn wrapper algorithm. I have read on the literature various approaches for feature selection, but I cannot find any on that package or, ...
20-roso's user avatar
  • 680
0 votes
1 answer
34 views

Naive Bayes / SVM classifiation - min. number of records (Python)

I am doing text classification with Python. I have around 120 records with 2 columns: text class I tokenize, stem and lematize the words, I also did some of my own text preprocessing. When I run the ...
heisenberg7584's user avatar
1 vote
1 answer
5k views

ValueError: Expected 2D array, got 1D array instead

I would like to extract the 20 most informative features of a very large set of features $X$ coming from a dataset containing clinical data by using the RFE function from scikit-learn in Python. $X$ ...
Arnau's user avatar
  • 123
1 vote
2 answers
2k views

Managing NaN in target variables (testing)

Please can someone advise me on how to handle NaN in my target variables set? I've tried a variety of things but none is working. Here's what I've tried: Imputing zeros (0) in Y_test Replacing NaN ...
Seghelicious's user avatar
1 vote
2 answers
167 views

How to encode an array of categories to feed into sklearn

I'm working on a recommendation problem, broadly following the Youtube paper on theirs. Their surrogate problem is to recommend the next video a user will watch. One feature they include in their ...
Dan Scally's user avatar
  • 1,754
0 votes
0 answers
83 views

Regression Task - Spark, PyTorch, TensorFlow or scikit

I know it's a broad question, sorry for that, but I'm still testing the waters with machine learning. I have a typical regression task (predict target numbers with the help of features x,y,z) and a ...
mre's user avatar
  • 1
8 votes
3 answers
11k views

How to combine GridSearchCV with Early Stopping?

I'm a beginner in machine learning and want to train a CNN (for image recognition) with optimized hyperparameter like dropout rate, learning rate and number of epochs. The optimal hyperparameter I ...
Code Now's user avatar
  • 393
1 vote
2 answers
959 views

Is it possible to know the output vectors of MLP Classifier of scikit learn?

I'm a beginner with scikiti-learn library. I have an ANN with 3 input, 2 hidden layers and 3 output. ...
Paul's user avatar
  • 113
1 vote
1 answer
258 views

sklearn.feature_selection vs xgboost feature_importances?

sklearn.feature_selection vs xgboost feature_importances Can somebody explain in-detailed differences between sklearn.feature_selection and xgboost feature_importances? And how the algorithms work ...
Pluviophile's user avatar
  • 3,848
1 vote
1 answer
1k views

Why are my Decision Tree Leafs not pure?

I'm making a using DecisionTreeClassifier from SKlearn (v0.21.3) with its default settings, using Python. I do not want regularize it in any way, I want it to ...
NorwegianClassic's user avatar
4 votes
2 answers
6k views

GridSearchCV vs RandomSearchCV and How it works?

GridSearchCV vs RandomSearchCV Can somebody explain in-detailed differences between GridSearchCV and RandomSearchCV? And how the algorithms work under the hood? As per my understanding from the ...
Pluviophile's user avatar
  • 3,848
2 votes
1 answer
2k views

SGDClassifier partial_fit() for online learning - is one step of gradient descent enough?

I'm interested in incremental (online) learning for my logistic regression model trained with SGDClassifier. Basically updating the model as more labeled data comes ...
jamix's user avatar
  • 181
3 votes
1 answer
122 views

Is there any optimal way on feature selection for more than one classification algorithms?

I have a wine dataset with 13 features that indicates 3 different wine classes (target), and k-NN, SVM with linear kernel and SVM with rbf kernel algorithms to be tried with this dataset. My goal is ...
bbasaran's user avatar
  • 171
2 votes
0 answers
217 views

What is the scikit learn Non-negative Matrix Factorisation Coordinate Descent algorithm?

What is the scikit-learn Coordinate Descent (CD) algorithm for Non-negative Matrix Factorization (NMF)? The sklearn implementation of NMF has two different solvers, Coordinate Descent and ...
christopherlovell's user avatar
0 votes
1 answer
140 views

Testing if a sample fits into an existing cluster

I have a sample of data I'd like to create a model from, which would create N clusters. After the fitting to clusters, I'd like to test various samples against the existing clusters, seeing if the ...
Aviram's user avatar
  • 1
1 vote
1 answer
5k views

Permutation feature importance vs. RandomForest feature importance

What is the difference between Permutation feature importance vs. RandomForest feature importance? What are the disadvantages vs. advantages of the two techniques?
Eric Kim's user avatar
  • 149
1 vote
0 answers
293 views

Using a trained classifier in an Android app

As the title suggests, I'm attempting to train some different classifiers into an android app. The main question I have is how to represent the different models in a neat and effective way, from ...
Phil's user avatar
  • 11
3 votes
2 answers
141 views

How to interpret ANOVA results?

I am trying to identify what attributes are not relevant in my dataset to remove them before fitting a classifier. The target is a categorical variable with three different values. I also have a lot ...
Tlaloc-ES's user avatar
  • 337
2 votes
2 answers
2k views

Need machine learning algorithm to fill in time-series data

I am currently dealing with a time-series data set with cyclical gaps every 30 minutes (30 minutes of data, 30 minutes of no data). Is there a relatively simple way of using scikit-learn (or some ...
Alex Tonelli's user avatar
4 votes
1 answer
2k views

Linear Regression on data with bimodal outcome

I have a data set with 3,000 features and continuous dependent variables of time with 18,000 instances. The histogram of the dependent variables show that the they have a bimodal distribution. I am ...
kevin vivian's user avatar
1 vote
1 answer
6k views

TypeError: 'GridSearchCV' object is not callable - how do I use a pickle of an SVM (Scikit-learn)?

I have created an SVM in Scikit-learn for classification. It works; it prints out either 1 or 0 depending on the class. I converted it to a pickle file and tried to use it, but I am receiving this ...
Finn Williams's user avatar
4 votes
2 answers
527 views

Training a model sample by sample

I'm training a Scikit model but it seems that in all examples, they call the fit method on the entire training set. What I want to do however is call it per sample (...
Wouter Vandenputte's user avatar
0 votes
1 answer
296 views

Increase accuracy of classification problem [closed]

I am trying to build a classifier that predicts the compiler given some operations of assembly code. Here is the pandas dataframe: What I do is using a TfidfVectorizer and select the features that ...
J.D.'s user avatar
  • 861
1 vote
1 answer
3k views

How do I force specified coefficients in a Linear Regression model to be positive?

Looking for a way to do this in Python. scipy.optimize.nnls forces all coefficients to be positive. Some additional context: I have a data frame with a some explanatory variables and a response ...
Kyle Zengo's user avatar
0 votes
0 answers
90 views

can i get weights per iteration of MLP?

im building an mlp with scikit learn. Is there a way I can access weights and biases of the output layer per iteration? There is an option mlp.coefs_ But it ...
imtiaz ul Hassan's user avatar
0 votes
1 answer
1k views

Applying Standardization OLS estimator

I have basic understanding of how to perform linear regression with sklearn and statsmodels. There are several questions that I would like to ask regarding Linear Regression (OLS estimator) : Is ...
Yohanes Alfredo's user avatar
0 votes
1 answer
147 views

Building an efficient feature vector

I am building a classifier for malware analysis, which predicts if I have a malware by looking at the intructions of an assembly code, such as push, mov,... and predicting the optimization method. ...
J.D.'s user avatar
  • 861
2 votes
1 answer
87 views

Scikit model is not able to predict sequence correctly

I am trying to create a regression model using scikit-learn for predicting car price. The input data are, car model(trim), kilometers used, past resale price of similar car and age of used car. I am ...
Yoganand.N's user avatar
5 votes
1 answer
9k views

Difference between learning_curve and validation_curve

What is the difference between these two curves: learning_curve and validation_curve ?
Ben's user avatar
  • 550
0 votes
2 answers
1k views

How to Keep Missing Values in Ordinal Logistic Regression

I’m using mord package in python to do ordinal logit regression (predict response to movie rating 1-5 stars). One of my predictor variables is also ordinal but ...
Insu Q's user avatar
  • 181
1 vote
2 answers
564 views

Why I am having ValueError in this Linear Regression?

...
Mushfikunnabi Nijhum's user avatar
1 vote
1 answer
118 views

Selecting features for malware analysis

I am trying to build a classifier that detects if I have a malaware by predicting the provenance compiler. To do so I have a dataset composed of assembly code in json format : In particular, I want ...
J.D.'s user avatar
  • 861
0 votes
2 answers
238 views

SVM, which range to use when normalizing

I am using the SVM classifier from Scikit Learn. I was wondering is there is a know-best-practice when it comes to normalization. I'm using different normalization tecniques, but all my normalized ...
Federico Dorato's user avatar
0 votes
1 answer
3k views

PCA scikit-learn - ValueError: array must not contain infs or NaNs

I use PCA from from sklearn.decomposition to reduce data dimension. ...
Antonina's user avatar
  • 126
1 vote
2 answers
486 views

Sklearn LocalOutlierFactor contamination parameter

Can anyone provide an intuitive explanation of the choice of contamination parameter used in sklearn's LocalOutlierFactor implementation when ...
sandyp's user avatar
  • 224
1 vote
2 answers
6k views

Majority voting in scikit-learn Random forest

My main concern is that i need to understand that how does the random forest do majority voting in scikit learn source code. I did not find that specific code in source code of RandomForest. if ...
user84294's user avatar
5 votes
1 answer
1k views

TS-SS and Cosine similarity among text documents using TF-IDF in Python

A common way of calculating the cosine similarity between text based documents is to calculate tf-idf and then calculating the linear kernel of the tf-idf matrix. TF-IDF matrix is calculated using ...
kgkmeekg's user avatar
  • 153
2 votes
0 answers
25 views

Temporal outlier Analysis on sensor data

I am working to find anomaly/outliers in sensor data using unsupervised machine learning (without training dataset). I have around 20000 samples taken per minute of various sensors. I just need to ...
sdave1's user avatar
  • 21
2 votes
1 answer
316 views

What to do with large number of collinear variables?

I have this time-series dataset that has 63 features, out of which 57 were manually engineered. While checking for collinearity, I get this correlation matrix: As can be seen there are a number of ...
Shiv_90's user avatar
  • 265
2 votes
0 answers
129 views

Are pipelines capable of cacheing intermediate results?

I use pandas to do feature extraction for machine learning. I hope to achieve the following: Consider I have five data processing steps done sequentially, and if I execute them once, the results will ...
william007's user avatar
2 votes
1 answer
371 views

Explaining feature_importances_ in Scikit Learn RandomForestRegressor

For a project, I used the feature_importances_ attributes from the RandomForestRegressor. Everything works well but I don't know ...
F.McQueen's user avatar
2 votes
1 answer
2k views

LightGBM vs Sklearn LightGBM- Mistake in Implementation- Exact same parameters giving different results

While passing the exact same parameters to LightGBM and sklearn's implementation of LightGBM, I am getting different results. Initially, I was getting the exact same results on doing this, however, I ...
Sanchez_P's user avatar
  • 101
1 vote
3 answers
231 views

Cross-fold validation done on whole dataset or training set?

I have a dataset of 77 samples with 302 features with two labels (0,1). I trained an SVM with gridsearch (cv=5) to perform binary classification. In one run of my script, I do a test-train split, ...
Bari Tala's user avatar
0 votes
1 answer
4k views

train_test_split() error: Found input variables with inconsistent numbers of sample

...
yari's user avatar
  • 1
0 votes
0 answers
1k views

Value Error: MSLE & CrossVal

I'm trying to run cross validation with mean squared log error with sklearn and getting the following error message: ...
Iain MacCormick's user avatar
0 votes
1 answer
479 views

What is the use of fit method in sklearn.preprocessing.Normalizer()?

According to the documentation of fit(self, X[, y]) method of sklearn.preprocessing.Normalizer(), it does nothing and return the estimator unchanged. I understand that if I intend to normalize data I ...
Vishal Poddar's user avatar
4 votes
3 answers
8k views

How to Split And Resample Imbalanced Dataset Into Train, Validation and Test

I want to understand how to split the imbalanced data set with a binary target variable where 87% of the samples are negative and 13% of the samples are positive. Now, I know that you should always ...
Krishnang K Dalal's user avatar
1 vote
3 answers
172 views

Gradient decent in Python

I just finished working on my first machine learning algorithm i.e Linear regression. I want to reduce the rmse by optimising the model. I found out that gradient decent does the same job. But i dont ...
Maagalam HARSHA VARDHAN's user avatar
2 votes
2 answers
2k views

class_weight on sklearn's DecisionTreeClassifier

Can class_weight='balanced' on scikit-learn's DecisionTreeClassifier be interpreted as having identical duplicate data points for the minority classes? I know that doesn't work that way, class_weight ...
Olivetree's user avatar
  • 143
4 votes
2 answers
1k views

Hierarchical Clustering: Extract observations from large heatmap

I'm currently trying to visualize a large data set as heat map. That in itself works smoothly but I struggle with gaining insights from interestingly looking clusters. Specifically, I have two ...
romeasy's user avatar
  • 43

1
22 23
24
25 26
47