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
1
vote
0answers
24 views

Issue with miscount on test train split in Python

Problem Hey everyone. I think I am missing something incredibly easy, but because I am wokring in resampling for the first time it is giving me all sorts of inadequacy. I performed an ADASYN up sample ...
1
vote
1answer
45 views

Using PCA as features for production

I struggle with figuring out how to proceed with taking PCA into production in order to test my Models with unknown samples. I'm using both an One-Hot-Encoding an an TF-IDF in order to classify my ...
2
votes
1answer
31 views

How to set class_weight parameter for cost sensitive learning?

I'm dealing with a binary classification problem with a balanced data set, however false positives are much more costly than false negatives. Let's just say that an FP is in general 3 times more ...
1
vote
1answer
40 views

Comparing TFIDF vectors of different shapes

I'm working on a project using TF-IDF vectors and agglomerative clustering -- the idea is that the corpus of documents increases over time, and when a new document is added, the mean cosine similarity ...
0
votes
0answers
17 views

How Do I Plot a Nonlinear Decision Boundary? [duplicate]

I finished training my Sci-Kit Learn Logistic Regression model and it is performing at 100% accuracy. However, when I went to plot the decision boundary, I got a bit confused. I am not running the ...
1
vote
0answers
20 views

Performing Regression on Text and Image together in the most efficient way

I have a dataset with texts and images. The texts are present in a CSV file, which I am able to read using Pandas. The CSVs contain the image names, and I have the corresponding pngs which are ...
0
votes
0answers
440 views

UserWarning: No contour levels were found within the data range

I am running the exact example give in this SVM example of Scikit learn without any modification. I get the following warning. ...
1
vote
0answers
21 views

How can I use a validation set to tune the hyperparameters of an XGBClassifier?

I'm currently building a ranking model using an XGBClassifier. I have training, testing, and validation sets. I want to use the validation set to tune the hyperparameters of the XGBClassifier before ...
-1
votes
1answer
198 views

ROC Curve and AUC value of SVM model

I am new to ML. I have a question so I am evaluating my SVM model. Example: ...
0
votes
1answer
54 views

Does GridSearchCV not save the best parameters?

So I tuned the hyperparameters using GridSearchCV, fitted the model to the data, and then used best_params_. I'm just curious ...
1
vote
1answer
25 views

Is it possible to use a pretrained scikit learn model to make predictions on a dataset with different features (than those used during training)

Say we have a model trained on dataset A, which has a number of features, as usual. We then persist that model to disk and use it when we need to run inference (make predictions). Usually we run ...
0
votes
0answers
29 views
1
vote
1answer
17 views

Classifying based on irregular number of features

Ok, so I am trying to classify a rather large data set where the training set has some peculiar issues... There are a different number of features available for each row. For example, I might have 10 ...
1
vote
0answers
23 views

I'm worried that I'm training my model wrong

So I'm trying to classify some fashion mnist like photos into either boots or sneakers. I'm using a perception from sklearn to do so. The data set is a CSV containing pixel values. The model is ...
-1
votes
1answer
40 views

Interpreting MSE in regression Trees

I am using regression tree to predict target variable(continuous). I've use one-hot encoding for all categorical features and applied standard scaler to all numerical features. After all that I train ...
1
vote
1answer
19 views

Encoding Tags for Random Forest

I have the following data set: I want to use attributes Tags and Authors to classify each record into their respective Rating. In order to do so I want to use a random forest classifier. My concern ...
3
votes
1answer
99 views

Calibration using predict_proba vs class_weight

I am making a Random Forest Classifier to determine whether a sentence is "positive" (1), "negative"(-1) or "neutral"(0). However, I prefer having false negative than ...
0
votes
1answer
340 views

How to refit GridSearchCV on Multiclass problem

I'm trying to use GridSearchCV for my Multiclass problem. For starters, wanted to test it on KNeighborsClassifier. First, here's the code where I define the function which uses GridSearchCV: ...
0
votes
0answers
5 views

Can the Entropy Given On a Decision Tree Be Explained As the Probability Of A Binary Dependent Variable

I'm not certain how to interpret the entropy output--though I have used the Gini criterion before and interpreted it as the probability of reaching 100% on any given leaf the tree splits on.Though ...
1
vote
1answer
32 views

adding a feature as “generic”

I am using sklearn and python, to build a "malicious" login identifier. Reading some documents and examples, I chose the RandomForest classifier, then I decided to use the following features:...
2
votes
1answer
215 views

how to prevent machine crash while searching for hyper parameters of XGBoost with GridSearchCV

I am searching for best hyper parameters of XGBRegressor using GridSearchCV. Here is the code: ...
1
vote
1answer
32 views

Fitting probabilities in scikit-learn RandomForestClassifier

This is a newbie questions, so please bear with me. Given this random forest model: ...
0
votes
0answers
16 views

SKLEARN SGDClassifier prediction accuracy hint?

There is a function predict but is it possible to also hint how much is the predicted category probable? Like prediction of category 1 with 90% confidence, or 2 with 30% confidence etc. Without this I ...
2
votes
2answers
52 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 ...
0
votes
1answer
316 views

Clustering Tweet Data using DBSCAN Algorithm

I am doing a tweet clustering using DBSCAN algorithm. I use all the preprocessing steps and convert sentences to vector format before applying the algorithm. ...
1
vote
1answer
133 views

Running scikit-learn with large volume

I need to run a Random Forest process with scikit-learn. To train the model, I have a database table with 10 million rows of features. The question is: what is the ...
1
vote
1answer
681 views

Convert Neural network to Keras Classifier

I am training a Neural Network for Multi-Class classification. After succesfully training it and validating the model through cross validation, I would like to use this network inside a voting ...
0
votes
1answer
87 views

What is the shape of the vector after it passes through the TfidfVecorizer fit_transform() method?

I am trying to understand what happens inside the IDF part of the TFIDF vectorizer. The official sci-kit Learn page says that the shape is (4,9) for a corpus of 4 documents having 9 unique features. ...
0
votes
1answer
65 views

SKLEARN GridSearchCV hinting higher accuracy than Pipeline but with same parameters as Pipeline estimators

I have pipeline estimators like this: ...
3
votes
1answer
121 views

Confusion matrix in sklearn

If you look at this: ...
2
votes
1answer
215 views

SelectFromModel vs RFE - huge difference in model performance

Note: I have already looked at Difference between RFE and SelectFromModel in Scikit-Learn post and my query is differnt from that post Expectation: SelectFromModel ...
2
votes
1answer
42 views

DecisionTreeRegressor under the hood of GradientBoostingClassifier

I'm inspecting the weak estimators of my GradientBoostingClassifier model. This model was fit on a binary class dataset. I noticed that all the weak estimators under this ensemble classifier are ...
1
vote
0answers
98 views

SVM on BERT-Embeddings with very small dataset does not converge

I am trying to reproduce the results from this paper where they use a linear SVM on top of BERT-Embeddings for text-classification. They use the average of the token-embeddings which results in a 768 ...
1
vote
2answers
36 views

How can I use multiple features in basic sentiment analysis in scikit-learn?

I've tried to reduce the problem to it's absolute basics. Assume I have data (csv) as such: ...
2
votes
1answer
269 views

Normal distribution and Random Forest

I have big table in dataframe (600k rows) which has y column (the variable I want to predict) and other 4 other columns that are the X. I have run RF regressor and I got score of 0.87 when I run it ...
0
votes
1answer
47 views

accuracy at a false positive rate of 1%

I need to calculate the accuracy but at a false positive rate of 1%. I am not sure if it is the normal accuracy that we can calculate with sklearn or I need a customized formula?
0
votes
1answer
37 views

Correctness of a ROC Curve

I've built a Decision Tree Classifier to practice with the sklearn library. My first task was to shuffle the iris dataset and split it keeping only the last 10 elements for the test. Then, after the ...
1
vote
1answer
252 views

How to explain MAE/MSE at each node of decision tree for regression in sklearn python? [closed]

If the mean value at any node is 60 and MSE = 169 so RMSE is 13. Can I conclude that the error at my node is 60 +-13 i.e my values in this particular sample split ranges from 60-13 to 60+13. If not , ...
1
vote
1answer
58 views

How to control for Co-variate shift in test data set compared to train data for regression task?

I am working on a regression project. But I am facing the problem of covariate shift in features due to time delay.Test data was collected a year later due to which there has been some change in ...
1
vote
1answer
70 views

Multiclass ROC Curve using DecisionTreeClassifier

I built a DecisionTreeClassifier with custom parameters to try to understand what happens modifying them and how the final model classifies the instances of the iris dataset. Now My task is to create ...
1
vote
2answers
191 views

Loss function in GradientBoostingRegressor

I was looking at the Scikit-Learn documentation for GradientBoostingRegressor. Here it says that we can use 'ls' as a loss function which is least squares regression. But i am confused since least ...
1
vote
1answer
22 views

Random selection of variables in each run of python sklearn decision tree (regressio )

When I put random_state = None and run Decision tree for regression in python sklearn, it takes different variables to build tree each time? Shouldn't there be only ...
0
votes
1answer
91 views

How to choose between Tensorflow and Pytorch?

Recently I've been working on a pretty vanilla ANN model in Python with sklearn (and its preprocessing pipeline), mostly in jupyterhub notebooks if that matters. I am considering changing the ...
1
vote
1answer
78 views

Why does reducing the n_estimators in RandomForestClassifier improve accuracy? [closed]

I am taking a course that introduced me to sklearn.ensemble.RandomForestClassifier. At first it uses n_estimators with the default value of 10 and the resulting ...
2
votes
1answer
45 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: ...
1
vote
1answer
42 views

how print f1-score with scikit´s accuracy_score or accuracy of confusion_matrix?

I would like to print the f1-score. I got confused about the wording f1-accuracy score and accuracy score. What is the difference of these 2 scikit-learn metrics and how can I print the f1-score out ...
5
votes
2answers
158 views

Sklearn: applying cost complexity pruning along with pipeline

I have a data set with categorical variables. I have defined a decision tree algorithm and transformed these columns to numerical equivalent using one hot encoding functionality in sklearn: Create ...
1
vote
1answer
29 views

Python : data type handling by sklearn and impact on memory usage and performance

I am currently working on reducing the memory usage of my data (Pandas DataFrame). This is going quite well : downcasting floats into smaller floats, integers into smaller ones and transforming string ...
-1
votes
1answer
33 views

Is there any advantage of limiting the value of a feature in neural networks

In a machine learning algorithm, I have a feature that has a value in the range 0-20 it is very rarely value goes over 20 and if does I clamp it 20. Does it help the neural network model somehow using ...
1
vote
0answers
38 views

How to implement large-scale Poisson Regression in Python

I am trying to implement a Poisson Regression in Python to predict rates. I am dealing with a ton of data (too much to store in a DataFrame), which means that using the standard statsmodels.api GLM ...

1
3 4
5
6 7
37