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
0
votes
0answers
32 views

SVM Hyperparamter tunning using GridSearchCV

I am trying to hyper tune the Support Vector Machine classier to accurately predict classes which have higher degree of overlapping.The objective is to get the precise value of C which would be ...
0
votes
0answers
38 views

Is it possible to cluster unseen data using transductive algorithms like DBSCAN, OPTICS, Spectral Clustering, Agglomerative clustering

I am trying to solve a clustering problem. In general for K-Means clustering we fit the data and whenever we have a new data/sample we use ...
1
vote
0answers
25 views

Logistic Regression : shouldn't weighting by the number of instances give the same result ? What could explain the discrepency?

I am performing a logistic regression in a standard supervised framework (Data Set X, target y). The dataset X is composed of a handfull of categorical variables (that I one-hot encode), thus it ...
0
votes
0answers
16 views

How does regularization work?

Could any explain how regularization works with the noise point. Like in this image, the $2^{nd}$ graph is where the decision surface is good, where the noise points are close to the actual points.
0
votes
1answer
47 views

When should I use 'rbf' and 'polynomial' kernel trick in machine learning algo?

I have a problem about hate-speech classification using support-vector machine algorithm. The task is to identify the sentence that contains 'positive' or 'negative' sentiment. Which is the best ...
1
vote
0answers
86 views

Plotting SVM hyperplane margin

I'm trying to understand how to plot SVM hyperplane and its margins by this example: https://scikit-learn.org/stable/auto_examples/svm/plot_svm_margin.html And I got stuck at the plotting the ...
1
vote
1answer
30 views

When should you use Ensemble?

I have been working on a project as a part of my studies(computer/data science). I tried to make the best classifier I can with what I learned, and recently I have tried to upgrade this classifier ...
0
votes
0answers
18 views

Change in matrix of features format after one hot encoding

I have a dataset with 10 independent variables (2 categorical and 8 numerical) and one dependent variable. I used one hot encoding on the categorical dataset and the multiple linear regression ...
0
votes
0answers
60 views

Oversampling on Sequence(Text) data

Has anyone been able to perform synthetic oversampling on Sequential data? From what I've read and understand, the oversampling/undersampling techniques that are currently used are only applicable on ...
0
votes
1answer
87 views

How do I split a data set into train and test sets using

I have the following matrices for training a model: INPUT FEATURES MATRIX $$ X = \begin{bmatrix} | & | & & |\\ X_1 & X_2 & ... & X_m\\ | & | & & | \end{bmatrix}; ~ ...
0
votes
1answer
20 views

Stop words list to use for CountVectorization

The sci-kit learn library by defaults provides two options either no stop words or one can specify stop_words=english to include a list of predefined English words I am using Naive Bayes for SMS spam ...
2
votes
1answer
92 views

Why does classifier (XGBoost) “after PCA” runtime increase compared to “before PCA”

The short version: I am trying to compare different classifiers for a certain dataset from kaggle, and am trying to also compare these classifiers between before using PCA (form sklearn) to after ...
0
votes
0answers
12 views

Model on non-iid data performing badly

I am on this lecture about non-iid data where we generated a timeseries data using the function below: ...
0
votes
0answers
12 views

Which multiclass classification to use for this problem with 9k+ classes?

Need help with which machine learning algorithm/model to use for this problem. The dataset is of product categorization for Amazon. Feature Columns are PRODUCT NAME, PRODUCT DESCRIPTION, BULLET_POINTS,...
0
votes
1answer
65 views

Unable to generate confusion matrix

I am using keras flow from directory for image segmentation. Following are my codes ...
0
votes
0answers
18 views

Is there a quicker solution to Sklearn MAE?

I am attempting to run RandomForestRegressor on this fairly large dataset: ...
1
vote
1answer
16 views

In scikit-learn's LDA implementation, how can I sort the topics by frequency over the entire corpus?

I've used scikit-learn to perform LDA topic modeling, and I'd ultimately like to sort the topics by saliency/frequency over the entire corpus, but I'm unsure how to do as such. I've used pyldavis ...
0
votes
0answers
27 views

inbuilt python module for regression of multivariate

I am working on the following problem: In linear regression, I have used the python sklearn.linear_model LinearRegression by calling ...
2
votes
1answer
22 views

Random forest regression model improvement

I am working with vehicle occupancy prediction and I am very much new to this, I have used random forest regression to predict the occupancy values. Random forest jupyter notebook have around 48 M ...
2
votes
1answer
16 views

I am curious about the interpretation of the elastic Net coefficient

I want to discover the importance of variables in data through sklearn's Elactic Net. But I don't understand the exact meaning of coefficient. When training, I used alpha: 0.01585598, l1_ratio: 1.000. ...
0
votes
0answers
83 views

Should I use or tune `reg_lambda` or `reg_alpha` hyperparameters when using a tree booster in XGBoost

XGBoost has 3 types of boosters: tree boosters (gbtree, dart) linear booster (gbliner) ...
1
vote
1answer
59 views

Getting both results and probabilities running scikit learn random forest

I have a scikit learn RandomForestClassifier that returns 0s and 1s: ...
0
votes
0answers
19 views

Using multiple TF-IDF to create a feature

I have around 200k comments and I extracted the top 200 words (without stop words) out of their content. Each comment is linked to a specific date. I would like to ask a very stupid question: Is it ...
0
votes
1answer
26 views

Scikit-learn estimator not changing predictions when random_state variable changes

I am trying to compute prediction intervals for a classifier I trained in scikit-learn. Even after setting a new random_state parameter in my pipeline, this does ...
2
votes
1answer
69 views

Possible to use predict_proba without normalizing to 1?

I'm using xgboost multi-class classifier to predict a collection of things likely to fail. I want to run that prediction, and report anything that the classifier ...
1
vote
0answers
14 views

Clustering dataset with and without estimating means (no EM algorithm)

Given a dataset $D$ of the form $$ D = \{ (x_0,y_0), (x_1,y_1),\ldots,(x_{n},y_n) $$ sampled from a Gaussian mixture model with identity covariance matrices, I want to understand what are my options ...
1
vote
0answers
17 views

How do the authors get this updating formula for all $\beta$ in $\beta$-divergence

I'm reading the paper Algorithms for nonnegative matrix factorization with the β-divergence by Cédric Févotte and Jérôme Idier. Package scikit-learn uses their algorithm for module sklearn....
0
votes
1answer
13 views

How to interprete the feature significance and the evaluation metrics in classification predictive model?

Consider a experiment to predict the Google-Play apps rating using a Random-Forest classifier with scikit-learn in Python. Three attributes 'Free', 'Size' and 'Category' are utilized to predict the ...
0
votes
0answers
36 views

text classification - does number of features matters?

I'm working on a multi-class text classification project that aims to assign a "new bug" to his "final group assignee" To do that I was able to extract ~17000 samples and divided ...
0
votes
1answer
31 views

Visualise KMeans clusters in 2d, when number of input features is greater than 2

I am using KMeans clustering in Python (Scikit-learn) with around 70 input features per sample and a little over 1,000 samples. It is performing rather well, which is good. However, I would quite like ...
0
votes
0answers
13 views

Forecast methodology for geographic variables that are somewhat related

I'm creating time series forecasts for different geographies and wanted an expert opinion on how I can take into account geographic relationship to improve my model. Is there an algorithm that's ...
0
votes
1answer
31 views

Is it reasonable to do train/test splitting based upon information/entropy?

I want to divide my time series dataset into training and test sets. The data is seasonal and very noisy. When I randomly split, the test and train samples do not resemble in their ...
0
votes
1answer
107 views

GridSearchCV is Giving me ValueError: number of labels does not match number of samples

I'm trying to run a grid CV parameter search using sklearn.model_selection.GridSearchCV. I keep getting a ValueError that is really confusing me. Below I've included the code for the pipeline I ...
0
votes
0answers
72 views

Novelty prediction Using DBSCAN on "unseen data"

I am trying to build an unsupervised learning model, which will be able to predict outliers on "unseen data." The algorithm I chose is DBSCAN (Density-based spatial clustering of ...
0
votes
0answers
99 views

keras Tokenizer usage on a whole dataframe

I've a dataframe where all its content is text based. After separated it into features and labels, my next obvious step was to Tokenize it. However, I can't understand how to ...
0
votes
0answers
18 views

Year/Month as a feature in Random Forest Classifier

I need to include a Maturity Date feature in my scikit-learn RandomForestClassifier model. Since the day is too specific, I'm thinking of having a number with the ...
-1
votes
1answer
83 views

Why does my model only predict 0?

I am using the River python package to work with streaming data. After building a model I face an issue, every data value predicts as 0. The data includes categorical and null values. I have used the ...
0
votes
0answers
49 views

Improving score accuracy for multi class classification

I'm working on a multi-class text classification project. My goal is simple: given a "bug", I'd like to predict to which final group owner it will be assigned to. I've 6 classes overall and ...
2
votes
3answers
110 views

predictive modelling using Random Forest

I have created a random forest classification model in skicit-learn, but I am unsure how to finalize my forecast. I have built the model and it is showing good results on the testing data. I get a ...
2
votes
1answer
329 views

Number of features of the model must match the input. Model n_features is 740 and input n_features is 400

i am getting this error predicting from random classifier, could anybody point me to where i am going wrong in this? (background information: yes, i am trying to do sentence classification with 2 ...
0
votes
1answer
55 views

sklearn text analysis - dealing with missing values

I'm working on a multi-class text classification project. My goal is simple: given a "bug", I'd like to predict to which final group owner it will be assigned to. I was able to achieve ~...
2
votes
1answer
121 views

When and how to use StandardScaler with target data for pre-processing

I am trying to figure out when and how to use scikit-learn's StandardScaler transformer, and how I can apply it to the target variable as well. I've read this post ...
0
votes
1answer
85 views

Should I shuffle my `train_test_split` if my time series contains lagged features?

I understand that it is not recommended to shuffle your training and test sets for time series, else the model will not be able to understand the time dependency of the features. However, I am now ...
0
votes
1answer
128 views

Worse performance after Hyperparameter tuning

I first construct a base model (using default parameters) and obtain MAE. ...
3
votes
1answer
120 views

When using KNeighborsClassifier, what is the motivation of using weights="distance"?

When using KNeighborsClassifier, what is the motivation of using weights="distance"? According to the scikit-learn ...
0
votes
0answers
11 views

Feature selection suggestions like VIF and Selectkbest?

I would appreciate if anyone of you could suggest me feature selection libraries/methods like sklearn's VIF and selectkbest. I read about these two uptill now but I am unable to find any more similar ...
0
votes
1answer
66 views

【Sklearn】Understanding GridSearchCV.best_score_

Can anyone give a brief explanation on what best_score_ means? I assume the score is higher the better. Is there a range for the score for example (0,1)? Thanks.
0
votes
0answers
16 views

Results interpretation of AgglomerativeClustering labelling

First of all I would like to say that I'm quite new to python and even more new to scikit, and I'm also a self learner, so please forgive my banal question, but it doesn't look banal to me. So, I have ...
1
vote
1answer
46 views

tSNE function is tensorboard and sklearn behave widely different

Perplexity: 20 Learning rate: 10 N_iters: 250 tensorboard returns a scatter plot like this: sklearn tSNE returns a scatter plot like this: The data is the exact same. What am I doing wrong?

1 2 3
4
5
41