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.

479 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
1answer
101 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
37 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
1answer
1k 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
654 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
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
480 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
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
1answer
50 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 ...
3
votes
0answers
90 views

Best way to remove useless features 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
2answers
159 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
48 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
0answers
26 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
75 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
411 views
3
votes
0answers
726 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
685 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
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
164 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
2answers
244 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 its Anomaly. Likewise there are thousands of ...
3
votes
1answer
684 views

Scikit learn: which regressors natively support multi-target regression?

The docs on sklearn.multioutput.MultiOutputRegressor state that it implements a strategy for extending regressors that do not natively support multi-target regression. I'm interested to know: which ...
3
votes
0answers
179 views

Avoid hardware limitation while competing in Kaggle?

I've learned machine learning via textbooks and examples, which don't delve into the engineering challenges of working with "big-ish" data like Kaggle's. As a specific example, I'm working on the New ...
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
1answer
911 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 ...
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
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
28 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
1answer
45 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
41 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
57 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
38 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
1answer
39 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 ...
2
votes
0answers
34 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
54 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
34 views

Any advantage of sklearn wrappers for xgboost over python API?

Are there any advantages of using the XGBoost sklearn wrappers XGBRegressor or XGBClassifier over using the Python API with the <...
2
votes
0answers
16 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
192 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
482 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
1answer
578 views

sklearn - SimpleImputer in an empty Pipeline

When building a Pipeline I'm ending up at a scenario that can be simplified like this: FeatureUnion(NumericalPipeline(steps), CategoricalPipeline(steps)) Since this is one intermediary step in a ...
2
votes
1answer
24 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 ...
2
votes
1answer
52 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 ...
2
votes
0answers
55 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 ...
2
votes
0answers
55 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 ...
2
votes
0answers
17 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 ...
2
votes
0answers
104 views

different outcome of feature importance and coefficient from same data

I built a regression model to predict profit based on client, sales person, product category, client industry and client region. After trying several models with tuning hyperparameters, I found that ...
2
votes
0answers
151 views

Comparing feature importance in LightGBM + Scikit

I have a model trained using LightGBM (LGBMRegressor), in Python, with scikit-learn. On a weekly basis the model in re-trained, and an updated set of chosen features and associated ...
2
votes
0answers
159 views

Why are the regions/decision boundaries overlapping with multi-class classification using SVM in sci-kit?

I am using the SVM in scikit-learn library for doing multiclass classification. I am wondering why these regions (decision boundaries) are overlapping (as seen in the picture below)? Could someone ...

1
2 3 4 5
10