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
25 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
12 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
29 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
23 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
17 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
45 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
35 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
25 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
25 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
50 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
36 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
37 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
16 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
vote
1answer
56 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
44 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
104 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
212 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
47 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 ~...
3
votes
1answer
86 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 ...
1
vote
1answer
40 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 ...
1
vote
0answers
64 views

Worse performance after Hyperparameter tuning

I first construct a base model (using default parameters) and obtain MAE. ...
4
votes
1answer
99 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
10 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
43 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
11 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
29 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?
0
votes
1answer
43 views

Different values of mean absolute error when using GridSearchCV for max_leaf_nodes vs manually optimising max_leaf_nodes

I am trying out hyperparameter tuning vs manually selecting the best parameter (max_leaf_nodes) on a decision tree model with mean absolute error as the scoring. In ...
0
votes
1answer
63 views

Why does min-max scaler result in lower accuracy with regression tree?

I have a dataset that contains 7 features. Values are not too large. I trained scikit-learn's RandomForestRegressor for predicting the target variable. The $R^2$ ...
0
votes
0answers
24 views

Should the test dataset be scaled with respect to its distribution or with respect to the distribution of the training dataset? [duplicate]

I have applied data scaling techniques on my training dataset during training. For evaluation, when scaling the test dataset, should it be scaled using the scalers fitted to the training dataset or ...
4
votes
2answers
85 views

KNN accuracy going worse with chosen k

This is my first ever KNN implementation. I was supposed to use (without scaling the data initially) linear regression and KNN models for predicting the loan status(Y/N) given a bunch of parameters ...
4
votes
3answers
2k views

can't understand the Architecture of Neural Network

Please explain how Z1 is working I just want to know why W is of shape (4,3) I understand that there are four Weights we are performing (4,3)*(3,1) + (4,1) but I don't understand what is 3 in (4,3) ...
0
votes
0answers
8 views

Ordering of sklearn's confusion_matrix()

Trying to figure out how to sort integer labels on a 102X102 (oxford102 UK flower dataset) confusion matrix graph that I plot with plot_confusion_matrix from mlxtend. I see that basically conf_mat and ...
1
vote
1answer
24 views

relaying on feature during training that won't (necessarily) be available during prediction

I'm doing a little project of bugs prediction. My goal is to predict which bug will be (eventually) assigned to which relevant group (this is my label obviously). For training, I'm relaying on a bugs ...
0
votes
1answer
43 views

Is Cross validation and GridSearchCV required every time we train a model?

I have a repetitive process that will build a model weekly based on the previous week's data. So while in development I tried GridSearchCV and cross-validation to ...
0
votes
0answers
11 views

Do sklearn Pipelines automatically split big datasets in chunks for the transform method?

Do sklearn Pipelines automatically split big datasets in chunks for the transform method? Each transformer in the pipe has a transform method. It seems as sklearn by default pushes all X_train into ...
2
votes
1answer
32 views

Can I add new features in an existing dataset using function transformers in scikit-learn

I have written a code that can add 3 new columns into a NumPy array, using function transformer(1 st column is element-wise +, 2nd is element-wise *, 3rd is element-wise /. Just need to know if in ...
1
vote
0answers
30 views

Normalization before PCA in NLP domains?

I'm working on a basic bag-of-words toy NLP pipeline for sentiment analysis using scikit-learn. From research of other questions here, it seems that the main applicable scaler for before PCA is the ...
0
votes
1answer
38 views

Does Cross Validation require splitting/shuffling and fitting of data beforehand?

I am trying to evaluate a logistic regression classifier using k-fold cross validation. I wanted to know if I need to shuffle data before hand when using cross_validate_predict and if I need to fit ...
0
votes
1answer
26 views

Measure of Separation for fuzzy clustering

Is there a measure of separation such as the Sillohete score for fuzzy clustering? I understand the logic for Hard-clustering algorithms but not sure about fuzzy. Is there a Python package for that ...
0
votes
0answers
39 views

How to interpret predict_proba() when predicting one class?

When we try to predict a test set that contains just one class, the.predict_proba() method returns a 2D array with 2 columns instead of 1. My guess is that it ...
0
votes
1answer
20 views

How should a stateless data transformation be applied in regard to train/test split?

I want to apply spatial sign transformation to my data, but unlike other transformations this one is stateless. I am using sklearn and normallly i would first use ...
0
votes
0answers
38 views

Why am I getting good validation scores, but poor test scores in Kaggle competition

I am participating in a Kaggle multiclass classification competition. The submissions will be scored based on the 'logloss' score. I am using Keras and Scikit libraries and a deep learning network ...
0
votes
0answers
27 views

keras: How to connect Resnet 50 pre trained model to decision tree algorithm for classification?

can we extract features from Resnet50 pre trained model and connect it to Sci-kit learn decision tree for classification.

1 2
3
4 5
40