What's the deal with Deno? We talk with a major contributor to find out. Listen now.

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.

Filter by
Sorted by
Tagged with
1
vote
2answers
29 views

What makes the validation set a good representative of the test set? [closed]

I am developing a classification model using an imbalanced dataset. I am trying to use different sampling techniques to improve the model performance. For my baseline model, I defined an AdaBoost ...
0
votes
1answer
31 views

Clustering with TF-IDF and Cosine Similarity [closed]

I'm trying to cluster tf-idf vectors based on their cosine similarity, as such, I was experimenting with taking a given vector, calculating the mean cosine similarity with other vectors in the cluster,...
2
votes
2answers
46 views

how to find parameters used in decision tree algorithm

I use a machine learning algorithm, for example decision tree classifier similar to this: ...
-2
votes
0answers
20 views

AttributeError returning feature importance from GridSearchCV

I'm trying to return feature importance for my LinearSVM. However, I get this error: AttributeError: 'LinearSVC' object has no attribute 'feature_importances_' My ...
3
votes
0answers
65 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 ...
4
votes
1answer
85 views

Why you shouldn't upsample before cross validation

I have an imbalanced dataset and I am trying different methods to address the data imbalance. I found this article that explains the correct way to cross validate when oversampling data using SMOTE ...
1
vote
4answers
145 views
+50

Is it possible to get worse model after optimization?

I am trying recently to optimize models but for some reason, whenever I try to run the optimization the model score in the end is worse than before, so I believe I do something wrong. in order to ...
0
votes
0answers
26 views

ValueError: bad input shape

I have multilabel problem. I was using onevsrestclassifier and now i want to use onevsoneclassifier. ...
0
votes
0answers
17 views

How to change Linear model in SGDClassifier scikit learn?

The SGDClassifier of scikit learn defines it as "Linear classifiers (SVM, logistic regression, etc.) with SGD training.". I understand from this that any Linear classifier can be used here. ...
1
vote
0answers
20 views

Getting inf% accuracy for Random Forest model with scikit learn

I have pandas dataframe with 8000 observations and with many different columns -some of them are dates and hours that were converted into dummies (get_dummies) and some are numerical,and y label which ...
1
vote
1answer
39 views

Predicting game scores using sklearn

I am using onehotencoding and RandomForestRegressor to predict scores of a set of soccer games. How can I use it into ...
0
votes
2answers
28 views

Why we need to have the test set remains consistent across multiple runs?

In the book "hands-on machine learning with scikit-learn and tensorflow: concepts, tools, and techniques to build intelligent systems" , more specifically in chapter 2 , the writer is ...
0
votes
1answer
21 views

sklearn KNN imputation

Can I use sklearn's KNN imputer to fit the model to my training set and impute missing values in the test set using the neighbours from training set ? Is it allowed ? Or , Should I only fit and ...
0
votes
3answers
77 views

Why is the accuracy of a LinearSVC not the same as the SDGClassifier?

I'm fine tuning parameters for a linear support vector machine. There are multiple ways to do it, but I wanted to compare LinearSVC and SDGClassifier in terms of time. I expected the accuracy score to ...
0
votes
0answers
15 views

SVD Kernel and Linear Algebra Kernel, is there a conceptual difference?

Is the term kernel used in Sklearn to execute the SVD machine learning algorithm conceptually related to the notion of a kernel in linear algebra ( null space )? Or do they happen to use this same ...
1
vote
1answer
20 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 ...
0
votes
2answers
20 views

Hello, when i'm training my model with 80% data and testing with 20% data the accuracy is 49% and without split it's 99%

Hello, when i'm training my model with 80% data and testing with 20% data the accuracy is 49%. And when i'm training my data without splitting it's giving around 99%. I'm confused. Please help me with ...
0
votes
0answers
9 views

ValueError: output_type='binary', but y.shape = (30, 3)

I have a custom estimator that i implemented myself and i am not able to use cross_val_score(), which i believe it has something to do with my ...
1
vote
0answers
16 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 ...
0
votes
1answer
26 views

How to include validation set in the pipeline to tune parameters for an SVM?

I have a dataset already divided into train, test and validation set. How can I insert the validation in my pipeline? Code: ...
0
votes
1answer
20 views

How to treat data transformation choices as hyperparemeters?

While reading the book hands-on ML by Aurelien Geron, I came across this line- Treat your data transformation choices as hyperparameters, especially when you are not sure about them (e.g., if you’re ...
0
votes
1answer
35 views

MultiLabelBinarizer() with inverse_transform()

I have multilabel labels. Elements in a label mean voting. Here is how labels look: ...
1
vote
0answers
12 views

Use predicted data to improve Multinomial Naive Bayes model for text classification [closed]

For a small project, I am making use of Naïve Bayes Multinomial Model to do some text classification. It has shown some very promising results, especially since I don't have a lot of Training data. ...
1
vote
0answers
12 views

Redo preprocess on unknown row

I'm trying to write a script to get the most similar rows in a certain dataframe, based on a single row. Using scikit-learn The method I need is ...
0
votes
1answer
27 views

Encoding categorical data with pre-determined dictionary

in case feature encoding, if I'd like to encode my values based on my pre-determined dictionary, how do I do that? For instance, say, I've values as ...
0
votes
2answers
69 views

sklearn - How to create a sequential pipeline

Update: The examples in this post were updated I am reposting this question here after not getting a clear answer in a previous SO post I am looking for a help building a data preprocessing pipleline ...
1
vote
1answer
26 views

Group K-fold with target stratification

I have a pd.DataFrame ...
1
vote
0answers
20 views

Stacking - Appropriate base and meta models

When implementing stacking for model building and prediction (For example using sklearn's StackingRegressor function) what is the appropriate choice of models for the base models and final meta model?...
0
votes
0answers
8 views

sklearn SimpleImputer using mean from different column groups?

I'm looking at the SimpleImputer, in particular in here, and I would like to do the imputation on different columns. My data has 3 different sample groups, and I would like to do ...
0
votes
1answer
15 views

Plotting Learning Curve

I was drawing learning curve for a classification model. But I am not being able to plot train set, test set and validation set in the same graph. Can anybody help me to find this out? Here is my code ...
-1
votes
0answers
5 views

Confusion Matrix ValueError: Found input variables with inconsistent numbers of samples: [3, 360] [migrated]

I'm trying to train a data set and output a confusion matrix after the dataset has been trained. Here is the code ...
1
vote
1answer
26 views

Plotting multiple precision-recall curves in one plot

I have an imbalanced dataset and I was reading this article which looks into SMOTE and RUS to address the imbalance. So I have defined the following 3 models: ...
0
votes
0answers
10 views

What is the proper order for the following steps: splitting, hyper-parameter optimization and feature elimination?

I am asking this question because I am working on the Ames Iowa House Sale Price dataset on Kaggle. I am using Scikit-Learn. To be more specific, my question is whether I should perform analysis and ...
2
votes
0answers
31 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. ...
1
vote
1answer
22 views

SVR - RMSE is much worse after normalizing the data

I'm building a model using a custom kernel SVR that looks into a few of my dataframe's features and checks the proximity/distance between each pair of datapoints. The features are weigthed and the ...
1
vote
1answer
37 views

Multiclass Classification and log_loss

I hope I can make this clear with few lines of code/explanation. I've a 16K list of texts, labelled over 30 different classes that were ran through different classifiers; my Prediction and the Ground ...
2
votes
2answers
54 views

Scikit learn linear regression - learning rate and epoch adjustment

I am trying to learn linear regression using ordinary least squares and gradient descent from scratch. I read the documentation for the Scikit learn function and I do not see a means to adjust the ...
0
votes
1answer
67 views

Machine Learning: Predicting target based on a feature

I have a df looks as follow: -It is very likely that the same feature1Xfeature2Xfeature3 combination will appear multiple times....
0
votes
0answers
16 views

Apply two different Sklearn classifiers to two different subsets of the same data

I have a dataset that I need to run through a classification Pipeline. The dataset has 2 types of rows: described: description column POPULATED non-described: <...
0
votes
2answers
38 views

Is my model overfitting?

I'm currently building my first model with sklearn to predict whether a customer will renew a subscription. I'm using a random forest because I've heard that they are robust to overfitting. The ...
1
vote
0answers
24 views

Normalisation of features extracted from audio files

I am building CNN and SVM models which take in MFCC features as input. The MFCC matrices shape is (13, n). The 13 rows are coefficients and n columns represent n time frames. So each row in the matrix ...
2
votes
2answers
81 views

How can I label (predict) an unseen set of data based on an existing model?

I'm working on a learning multi-label classification project, for which I've taken 16K lines of text and kind of manually classified them achieving around 94% of accuracy/recall (out of three models). ...
0
votes
1answer
25 views

What is C in sklearn Logistic Regression?

In sklearn.linear_model.LogisticRegression, there is a parameter C according to docs Cfloat, default=1.0 Inverse of ...
0
votes
0answers
14 views

Multiple target prediction for a Regression Problem

I am doing my master's thesis on Indoor positioning system using BLE rssi. I have prepared a dataset with 4 features (rssi values from 4 ble rssi scanners). Target columns are x-coordinate and y-...
0
votes
2answers
27 views

Data scaling for training and test sets

when we are scaling the data i needed some clarification. so for preventing data leakage we split the train and test sets and then perform the scaling on them separately, correct? so while scaling or ...
0
votes
0answers
13 views

How to Approach Creating an Accurate Multiclass Multinomial Naive Bayes with Unbalanced Data

I have used sklearn to create a basic multiclass naive bayes text classifier. I have 3 classes and around 800 rows of data. Class A has 564 rows, Class B has 159, and Class C has 82. As you can see ...
0
votes
1answer
29 views

regarding lasso.score in lasso modeling using scikit-learn

I once saw the following code segment of using lasso model based on scikit-learn ...
4
votes
3answers
263 views

Reducing the size of a dataset

I am trying to classify gestures. I am using Python's scikit learn library classification algorithms for that. I have collected depth images for this purpose. 200 samples are collected for each ...
0
votes
0answers
19 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 <...
0
votes
2answers
22 views

sklearn KNN fit throws out error : value too large for dtype('float64')

I have cleaned the data from nan values and infinite values, the only feature which has a large float is the column 8 (it's a sum) I have no Idea how to fix this last error, I tried all previous ...

1
2 3 4 5
33