Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [scikit-learn]

Scikit-learn is a Python module comprising of simple and efficient tool for machine learning, data mining and data analysis. It is built on NumPy, SciPy, and matplotlib. It is distributed under the 3-Clause BSD license.

0
votes
0answers
11 views

Which sklearn classification would perform best on shape= (2000, 1024) w/ binary features?

I have a training data set that is roughly 2000 rows by 1024 columns all binary data either 1's or 0's. The labels are numbers that equate to the letters of the alphabet so this basically a hand ...
0
votes
1answer
19 views

sklearn.decomposition.PCA explained_variance_ratio_ attribute does not exist

When trying to identify the variance explained by the first two columns of my dataset using the explained_variance_ratio_ attribute of ...
2
votes
1answer
28 views

K-nearest neighbors complexity

Why does the complexity of KNearest Neighbors increase with lower value of k? And when does the plot for k-nearest neighbor have smooth or complex decision boundary? Please explain in detail. And ...
1
vote
1answer
8 views

AUC with sklearn vary each time script is started

I'm using the following code to perform a tree classification. I set up an int value for random_state in train_test_split ...
1
vote
1answer
33 views

TypeError: unhashable type: 'numpy.ndarray' [on hold]

I'm trying to do a majority voting of the predictions of two deep learning models.The shape of both y_pred and vgg16_y_pred are (200,1) and type 'int64'. ...
0
votes
1answer
13 views

How to interpret the mean for output clusters for expected-maximization?

I am trying to cluster data using scikit's expectation-maximization. So I created two different data sets from a normal distribution which is I have shown in the graph below. The mean for each of the ...
0
votes
0answers
9 views

Learning to Rank for information retrieval. [on hold]

I want to some csv data foramt and converted into light svm format and apply ranking algorithms and then need to get for which query what was the most relevant one in python can any one help me in ...
0
votes
1answer
19 views

Using GridSearchCV and a Random Forest Regressor with the same parameters gives different results

As the huge title says I'm trying to use GridSearchCV to find the best parameters for a Random Forest Regressor and I'm measuring my results with mse. ...
0
votes
0answers
16 views

Training/Fitting scikit-learn model with probabilty vector [closed]

I'm not very familiar with scikit-learn or ML and may be wrong with my assumptions, please correct me if I'm wrong and give your tips what to research on. There is predict_proba() function in many ...
-1
votes
0answers
5 views

Retrieve a cluster connected to a ring

I am trying to retrieve data points in a cluster in 2D space. The cluster is connected to other data points roughly in the shape of a ring. I have to do this for various clusters and rings so a non-...
0
votes
1answer
19 views

sentiment analysis nltk python

I'd like to perform sentiment analysis on stock comment using scikit and nltk. I already have about 100 comments on different stocks like "this stock will rock" which I marked as positive (1) or "this ...
0
votes
0answers
20 views
0
votes
1answer
22 views

Target feature in training set or not?

If I analyse a random forest in python with scikit I do: ...
0
votes
0answers
27 views

hashingvectorizer vs countvectorizer

I am getting significant performance difference in classifying (junk/non-junk) a large corpus of web-scraped documents when using countvectorizer (CV) vs hashvectorizer (HV) (Overall validation ...
2
votes
1answer
34 views

Difference between OrdinalEncoder and LabelEncoder

I was going through the official documentation of scikit-learn learn after going through a book on ML and came across the following thing: In the Documentation it is given about ...
0
votes
0answers
8 views

scikit-learn: High / low value for C in SVM

I am new to ML and I'm playing with scikit-learn. Looking into the user guide and documentation they say: A low C makes the decision surface smooth, while a high ...
0
votes
0answers
6 views

Which classifier to select for extracting errors from log file?

I am fairly new to data science, so I have a task to extract the error from a log file if it's return code is not equal to Zero The log file (if there is error) consists of an error, I want to get it ...
0
votes
0answers
10 views

Is it possible to group/tag sets of input features for learning?

I've been using various multi-output regression algorithms in scikit-learn successfully prior to this. Supervised regression with input-output mappings, and ...
3
votes
2answers
66 views

How can I check the correlation between features and target variable?

I am trying to build a Regression model and I am looking for a way to check whether there's any correlation between features and target variables? This is my ...
2
votes
2answers
71 views

Create a binary-classification dataset (python: sklearn.datasets.make_classification)

I would like to create a dataset, however I need a little help. The dataset is completely fictional - everything is something I just made up. Since the dataset is for a school project, it should be ...
3
votes
1answer
65 views

How to train ML model with multiple variables?

I am trying to learn Machine Learning concepts these days. I understand in a traditional ML data, we will have features and labels. I have following toy data in my mind where I have features like '...
3
votes
1answer
18 views

Implemented early stopping but came across the error SGDClassifier: Not fitted error in sklearn

Below is the simpler implementation of early stopping which i came across the book and wanted to try it. ...
1
vote
1answer
25 views

How to integrate nvidia gpu with jupyter notebook for scikit-learn

I know there are answers saying that tells how to integrate/use tensorflow or for deep learning libraries. I want to use it for classification or regression scikit-learn libraries. Is it possible. If ...
0
votes
1answer
33 views

Improving prediction accuracy with XGBoost

I have a 32x20 matrix for which I am trying to use XGBoost (Regression). I am looping through rows to produce an out of sample forecast. I'm surprised that XGBoost only returns an out of sample ...
0
votes
1answer
20 views

Downsampling the dataset to create balanced dataset for neural models

I have a classification dataset with 10k instances and 4 classes and it is unbalanced. 7000 of it belongs to first class, 2000 of it belongs to second 800 of it belongs to third class and remaining ...
0
votes
1answer
37 views

Predict compatibility of 2 people as boolean classification problem

How can I predict the compatibility of 2 people as a boolean classification problem? I want to know if below is an appropriate approach to modelling compatibility, or if I should be using "market ...
1
vote
2answers
39 views

Error in using fit() on RandomForest Classifier where X was a pandas.DataFRame object

On using fit() method on sklearn.ensemble.RandomForestClassifier I am getting a value error that says. ValueError: could not convert string to float: 'male' The ...
2
votes
1answer
67 views

Sensitivity analysis of a machine learning model

Let’s say I have a set of input variables (A, B, C and D)...
7
votes
1answer
61 views

Is max_depth in scikit the equivalent of pruning in decision trees?

I was analyzing the classifier created using a decision tree. There is a tuning parameter called max_depth in scikit's decision tree. Is this equivalent of pruning a decision tree? If not, how could I ...
1
vote
1answer
91 views
1
vote
0answers
9 views

binary classification for counting - estimating the error on counts due to error on prediction score

Ok, so I have the following set up: I have a binary classification problem and I am classifying events into signal and background. Ultimately, I want to count how many background events and how many ...
1
vote
2answers
26 views

Label Encoder encoding the same class as two integers

First I have defined classes of a label encoder with the keys of a dictionary. Then I have used that label encoder to encode some strings. But for the same string, its giving different integers. Why ...
5
votes
1answer
64 views

StandardScaler before and after splitting data

When I was reading about using StandardScaler, most of the recommendations were saying that you should use StandardScaler before ...
1
vote
0answers
34 views

Multiclass naive bays classification as probabilistic model

I have a model based on Naive-bays classifier (multinomial Naive bays) that i have fitted on data set with just one feature ( categorical observation) and a label : observation ; label funny ...
4
votes
2answers
60 views

Binary text classification with TfidfVectorizer gives ValueError: setting an array element with a sequence

I am using pandas and scikti-learn to do binary text classification using text features encoded using TfidfVectorizer on a DataFrame. Here is some dummy code that illustrates what I'm doing: ...
1
vote
1answer
42 views

Timestamps in Ridge Regression Scikit Learn

I am trying to transform data for use in regression, most likely the Ridge or Lasso technique implemented in sklearn.linear_model. My training data contains time ...
1
vote
3answers
82 views

Pass 2 different kinds of X training data to ML model simultaneously

I'm trying to classify if a book is fiction/nonfiction based on title and summary. This is 2 distinct types of information - is there a way to segment title and <...
3
votes
0answers
19 views

Recreating sklearn linear regression from coefficients and intercept

I am attempting to write my own linear regression function using the coefficients and intercept achieved using the sklearn LinearRegression model. I have 11 ...
1
vote
1answer
26 views

How to use build_analyzer in sklearn feature extraction

I'm trying to get list of n-gram tokens for text Ex: 'How to use build_analyzer in sklearn feature extraction ' output :['How', 'use', 'build_analyzer', 'sklearn', 'feature', 'extraction', 'How use'...
1
vote
0answers
51 views

How decision trees work in Python

I am new to the field of machine learning. I have just recently learnt Decision Trees and started solving Titanic Survival problem from Kaggle Competition. I understood the algorithm behind decision ...
1
vote
2answers
32 views

Sklearn SVM - how to get a list of the wrong predictions?

I am not an expert user. I know that I can obtain the confusion matrix, but I would like to obtain a list of the rows that have been classified in a wrong way in order to study them after ...
1
vote
0answers
18 views

very large difference between cross_val and (multiple) r2 model evaluation

I did submit my first kaggle kernel, on the avocado dataset kernel link, I treated it like I should predict the avocado price so I splitted the dataset in a train & test set, fitted the model and ...
1
vote
1answer
38 views

Why Extra-trees should only be used within ensemble methods?

I was reading scikit-learn documentation for Extremely Randomized Trees and I found this warning: Warning: Extra-trees should only be used within ensemble methods. Why is that?
0
votes
2answers
41 views

How to use scikit-learn normalize data to [-1, 1]?

I am using scikit-learn MinMaxScaler() to normalize to $[0, 1]$, but I want to normalize to $[-1, 1].$ What function do I have to use to normalize this way?
0
votes
0answers
16 views

How to understand error at each iteration of SKLearn GBMClassifier

This is a classification problem. After cleaning the dataset, used GBM Sklearn(neg_log_loss) for classification. used GridSearchCV for identifying best parameters. ...
0
votes
0answers
33 views

Splitting images dataset using KFold

I have a small dataset of images and I want to use cross validation to train the images using deep learning model. I want to split the folder of images into different folders(folds). I want to split ...
0
votes
0answers
25 views

Error When Passing Data To MLMulti Array From Swift

I've been trying to pass an array from Swift to a simple ML model created using a DecisionTreeClassifier from sklearn. The ...
2
votes
1answer
28 views

Python SkLearn Gradient Boost Classifier Sample_Weight Clarification

Using Python SkLearn Gradient Boost Classifier - is it true that sample_weight is modifying how the algorithm penalizes errors made on that particular class, rather than feeding more data into the ...
7
votes
2answers
109 views

Efficient dimensionality reduction for large dataset

I have a dataset with ~1M rows and ~500K sparse features. I want to reduce the dimensionality to somewhere in the order of 1K-5K dense features. ...
0
votes
1answer
36 views

Why does Bagging or Boosting algorithm give better accuracy than basic Algorithms in small datasets?

I was working with a small dataset, with 392 values, and it was kind of an imbalanced dataset, with 262 values belonging to class 1 and rest 130 to class 0. So I did the upsampling technique, ...