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.

516 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
1answer
112 views

Gridsearch XGBoost for ensemble. Do I include first-level prediction matrix of base learners in train set?

I'm not quite sure how I should go about tuning xgboost before I use it as a meta-learner in ensemble learning. Should I include the prediction matrix (ie. df containing columns of prediction results ...
4
votes
1answer
76 views

Reduce multiclass classification targets to binary classification targets in scikit-learn

I would like to reduce multiclass classification targets to binary classification targets. Ideally, this mapping would happen within scikit-learn so the same transformation applies during both ...
4
votes
1answer
39 views

Spatially constrained geospatial similarity

What's the current methodology for clustering geospatial data by features? Example: I have some demographic dataset. Let's say this contains average home price and population density. So, an example ...
4
votes
2answers
2k views

How to deal with missing data for Bernoulli Naive Bayes?

I am dealing with a dataset of categorical data that looks like this: ...
4
votes
1answer
723 views

Scikit-learn average_precision_score() vs. auc score of precision_recall_curve()

I've been searching around for an explanation to this, and haven't come across one yet- in scikit-learn, when I compute the auc() of the ...
4
votes
2answers
263 views

Anomaly detection using clustering of highly correlated Categorical data

My data has two columns and both are highly correlated e.g. if column1 has value ABC, column2 should be XYZ i.e. ABC-->XYZ. If column2 has anything else it's Anomaly. Likewise, there are thousands ...
4
votes
0answers
3k views

Isolation Forest Feature Importance

As of scikit-learn version 0.19.1, there is no implementation for calculating feature importance in an Isolation Forest. I'm also having trouble finding any online resources proposing ways to get at ...
4
votes
0answers
2k views

How to tune weights in Voting Classifier (Sklearn)

I am trying to do the following: ...
4
votes
2answers
592 views

Can I do incremental learning with the sklearn implementation of Linear Discriminant Analysis

I have a large number of pictures that I would like to use LDA on. However, it requires too much memory, so I was wondering if it would be possible to make the learning incremental, using a sklearn ...
4
votes
1answer
916 views

What preprocessing steps to be followed before image comparison?

1 down vote favorite For example I am trying to find the similarity between two images using skimage - SSIM. The code block will be as follows ...
4
votes
0answers
11k views

Tuning Gradient Boosted Classifier's hyperparametrs and balancing it

I am not sure if it is a correct stack. Maybe I should have put my question into crossvalidated. Nevertheless, I perform following steps to tune the hyperparameters for a gradient boosting model: ...
3
votes
0answers
88 views

sklearn FutureWarning message when running a CNN model

When I run my model, I am receiving the following error message: ...
3
votes
0answers
106 views

Best way to remove useless features (non-english words) when there are more than 100,000 features?

I am in a situation where i have more than 100,000 features, and i need to select the top features to give them to my final neural network model. So far i have been using RandomForestClassifier in ...
3
votes
1answer
48 views

Issues with self-implemented logistic regression

I am trying to self-implement a logistic regression algorithm to do some self-learning but I am having a bit of trouble with achieving similar accuracy to the logistic regression of sklearn. Here is ...
3
votes
2answers
298 views

How to perform feature selection on dataset with categorical and numerical features?

I am working on a dataset with 30 columns (29 numerical, 1 non-ordinal categorical). I hot-encoded the categorical feature and reached at 35 columns. To improve training efficiency, I want to perform ...
3
votes
1answer
53 views

How to use sklean pipeline to deal with data that read in line by line

The problem I'm facing is that my data is too big, i can't load it to a dataframe and then process it. However, I really want to use the sklearn pipeline API, so that I can reuse those subclass ...
3
votes
1answer
25 views

Text vectorizer that capture feature offset in the text?

I'm using sklearn Tfifdfvectorizer to extract feature from text towards text classification. I believe the information I need tends to be in the beginning of the document, so I would like to somehow ...
3
votes
0answers
27 views

Gaussian process regressor returns almost identical std for all datapoints

I am using a Gaussian process regressor as the regressor for active learning and I use its standard deviation to choose the next training inctance (the one with the highest std is chosen). However, ...
3
votes
1answer
81 views

Gaussian Naive Bayes (GaussianNB) classifier not working with large number of features

I'm trying to make a partial fitting with GuassianNB here's small snippet of my code ...
3
votes
1answer
110 views

Unbalanced data set - how to optimize hyperparams via grid search?

I would like to optimize the hyperparameters C and Gamma of an SVC by using grid search for an unbalanced data set. So far I have used class_weights='balanced' and selected the best hyperparameters ...
3
votes
1answer
604 views
3
votes
0answers
915 views

Why does classifier chain ask for at least 2 classes, when I have it

I'm using Classifier Chain with logistic regression and when i try to use fit, i get This solver needs samples of at least 2 classes in the data, but the data contains only one class: 1 but I'm ...
3
votes
1answer
788 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 ...
3
votes
1answer
83 views

test_train_split with stratify integer overflow

I'm trying to do a stratified split for a skewed dataset with target variable 'b'. The target variable is a bit value (either 0 or 1). Here's an example: ...
3
votes
1answer
2k views

K-fold cross validation of scikit-learn with confusion matrix of Keras

I intend to display a confusion matrix using Keras while K-fold of scikit-learn. My code using Keras is: ...
3
votes
1answer
1k views

How many coefficients does the Logistic regression model has as a function of the number of features?

I have built a logistic regression model using Python anaconda and was surprised to see that the number of model coefficients turned out to be proportional to the training sample size i.e. My ...
3
votes
0answers
190 views

PCA and FastICA in scikit-learn giving near identical results

So after importing my data, transforming it, and splitting into training and test sets I tried running this script for PCA: ...
3
votes
1answer
2k views

Low silhouette coefficient

I am doing a kmeans clustering on a dataset of selling values of articles. Each article has 52 selling values (one per week). I am trying to automatically calculate the optimum amount of clusters ...
3
votes
0answers
1k views

why the accuracy of LDA model is always changing and also is high

Let’s explain the whole goal firstly, then go through the question. I am using topic modeling like LAtent Dirichlet Allocation and NMF to extract the topic from a collection of documents. My dataset ...
3
votes
1answer
1k views

IsolationForest Decision Function vs. Anomaly Prediction Question

I'm currently working on an unsupervised anomaly detection project, and for it I'm using IsolationForest through scikit-learn. My question is, why/how is it possible for the model to predict something ...
3
votes
0answers
1k views

Which algorithm is used in sklearn SGDClassifier when modified huber loss is used?

The documentation says: The loss function to be used. Defaults to ‘hinge’, which gives a linear SVM. The ‘log’ loss gives logistic regression, a probabilistic classifier. ‘modified_huber’ is ...
3
votes
0answers
1k views

Fuzzy Rules with more than two variable in python

I am trying to build a fuzzy inference system in python using skfuzzy library. I have 4 variables depending on which output class is decided. ...
2
votes
1answer
24 views

Reading the classification report of evaluation metric?

I am using the "classification_report" from: from sklearn.metrics import classification_report in order to evaluate a classification model. How can I ...
2
votes
0answers
25 views

What would be a good randomization environment for data science?

I would like to know if there are any best practices to optimize random environment. Currently I use this simple structure in my config : ...
2
votes
1answer
34 views

How to fit a KNN and then a linear regression with those neighbors?

How do I fit a KNN to get the $k$ nearest neighbors and then aggregate the those neighbors into a fit using a linear regression (instead of a weighted average) in Scikit-Learn? I've tried creating a ...
2
votes
0answers
45 views

Apply error analysis on the iris dataset for a specific type of misclassification

Suppose that I have the well-known iris dataset and I want to perform error analysis on the misclassified examples, more specifically for a specific class. I don't ...
2
votes
0answers
15 views

Methods of de-emphasizing some dimensions in a cluster analysis

I'm trying to understand how "weightings" on different dimensions in a cluster analysis might relate to the range of values along a given dimension in the dataset. DATA SET List of 1,000 to ...
2
votes
1answer
29 views

Large dataset - ANN

I am trying to classify around 400K data with 13 attributes. I have used python sklearn's SVM package, but it didn't work, and then I learned that SVM's are not suitable for large dataset ...
2
votes
2answers
147 views

Is it good practice to include data cleaning or feature engineering steps in an sklearn pipeline to create a scalable pipeline?

I am working on implementing a scalable pipeline for cleaning my data and pre-processing it before modeling. I am pretty comfortable with the sklearn Pipeline ...
2
votes
2answers
145 views

How to decode encoded labels in Decision tree classifier

I have some dataset with procurements of organization where actually i'm working. The aim is to find most important features that describe why some processes of purchases is succesful, and why not ...
2
votes
1answer
69 views

what does the standard deviation plot around my learning curve indicate?

I plotted a learning curve below. There is a thick red band around the top portion of my training score. Why is it so high at the beginning? Below is a snippet of the code used: ...
2
votes
0answers
62 views

Genetic Programming Python library with a Scikit-Learn inspired API

I've been working with GPlearn for the passed couple of months as part of my research, but it turns out that it provides only a binary symbolic classifier. Do you guys know any other python library ...
2
votes
0answers
91 views

How to Ensemble LGBM and XGBoost Machine Learning Models?

I want to Ensemble my predictions for the StratifiedKFold of LGBM and XGBoost into another LGBM Model. I had written the following code which works when the data set has an ID_COL, but in this data ...
2
votes
0answers
51 views

Initial value space for Random Forest hyperparameter tuning

I'm building a Random Forest Classifier using Scikit Learn. My problem consists in a 4 class classification task, the values are distributed as follows (after splitting my data in training set and ...
2
votes
0answers
72 views

Classification and clustering of Time series data of temperature

I have a time series recorded data of temperature. This is what my data looks like: The change in data represents specific event or a class which I would like to detect when new incoming data. ...
2
votes
0answers
17 views

Identifying persistent clusters within a series of graphs

The task is to identify persistent clusters, i.e., groups of nodes that "persist" as clusters (tend to form a cluster) in a series of graphs. This is how I approached the problem: I form a ...
2
votes
0answers
19 views

interpolation - graphical quality evaluation

I try to compare different interpolation models quality and I'm looking for a graphical tool to do that. Application case: I'm not familiar with intepolation using neural networks. I decide to test it ...
2
votes
2answers
316 views

Techniques for Cluster Analysis of a Very Large (n=140000) Binary Dataset in Python?

In essence: what techniques in Python are possible to find clusters/trends in a very large categorical dataset? My very large dataset (140000 rows/observations, 80 variables) of categorical data has ...
2
votes
1answer
780 views

Convert Pandas Dataframe with mixed datatypes to LibSVM format

I have a pandas data frame with about Million rows and 3 columns. The columns are of 3 different datatypes. NumberOfFollowers is of a numerical datatype, UserName is of a categorical data type, ...
2
votes
0answers
58 views

Multi-output regression python

I am new to machine learning and cannot figure a way to solve this problem: I have X which is always one row/record while the y can be a row or more. Here is a simple sample from my data-set, 'i ...

1
2 3 4 5
11