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
1 answer
26 views

Dummy Variable trap in Linear Regression

The dummy variable trap is a common problem with linear regression when dealing with categorical variables, since one hot encoding introduces redundancy, so if we have m categories in our categorical ...
  • 11
0 votes
0 answers
14 views

Sklearn SVM slower than when run in GridSearchCV

Problem: Running SVM in GridSearchCV is faster than running without it and supplying only 1 value of C and no CV. The AUC on the test set is lower when SVM is run outside of GridSearchCV. Background:...
0 votes
1 answer
16 views

Finding observations that are most similar in some regards but most different in others

I have a data set of about ~75 administrative regions. Among many other variables are four specific demographic variables, and a number which represents per-person funding from a government grant. I ...
  • 1
2 votes
1 answer
172 views

Is there a way to map words to their synonyms in tfidf?

I have the following code: ...
1 vote
1 answer
11 views

Why is max_features ordered by term frequency instead of inverse document frequency

In the docs: https://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.TfidfVectorizer.html it is explained that max_features is ordered by ...
0 votes
0 answers
6 views

Combining DeepXDE (physics-informed neural networks) with other tensorflow models

I would like to stack two models from scikit-learn and tensorflow. I have tried to make an illustration of what I want to do. What I am looking for is the actual wrapper. Does scikit-learn have any ...
1 vote
1 answer
17 views

How to Predict future temperatures based on past data with years

Hello everyone I am new to Machine learning and predicting. I just want to know if I can predict future temperatures based on past year's data and how I can do it Thanks. here is the pic of the ...
0 votes
0 answers
13 views

why when I find the best accuracy for logistic regression then it give me this error (AttributeError: split not found)

after run this code I face the split not found error. ...
0 votes
1 answer
19 views

Impact of many zeros in LightGBM Regressor training set

I have a LightGBM Regressor model with 15 features. 5 of these features have 98.7% NA for the training set. All five of the features are NA for each row. I impute the missing values with zero before I ...
  • 1
1 vote
1 answer
25 views

Naive Bayes implementation using SkLearn documentation

I am studying Naive Bayes classification method from Data Mining Concept and Technique by Han, Kamber, Pei. There is an example of how to find out the class probability using Naive Bayes classifier. ...
  • 309
-1 votes
1 answer
29 views

Sklearn vs Pytorch vs Tensorflow vs Keras

I just need to understand the differences between sklearn, pytorch, tensorflow and keras in terms which implements traditional machine learning algorithms ( Linear regression , knn, decision trees, ...
0 votes
0 answers
34 views

High diversity between val_accuracy and evaluation results

I'm working on a multiclass text classification problem. After splitting the data to train and validation data frames, I've performed text augmentation to balance the data (only on the train data of ...
  • 135
-2 votes
0 answers
21 views

Is tree.DecisionTreeClassifier in python choosing the best classifier? [closed]

I was looking at this tutorial. http://www.cse.msu.edu/~ptan/dmbook/tutorials/tutorial6/tutorial6.html ...
  • 9
0 votes
0 answers
12 views

Adjusting the parameters for Isomap and Spectral Embedding/Eigenmap in sklearn?

I read around the basic ideas of these reduction methods, but I have no idea on how I would adjust the parameters for these so that it still reflects the original data as accuratley as possible. What ...
  • 11
2 votes
0 answers
61 views

Feature selection and model performance

Featuretools provides an automated way to generate features from your data, by providing relationships within your data and applying their so-called deep feature synthesis. It generates features like ...
  • 121
0 votes
0 answers
27 views

Predict the next 10 minutes using ML

I want to predict if there will be a goal in the next 10 minutes of a football game given current match stats. The dataset is unbalanced so I tried to undersample the most popular class with ...
  • 101
0 votes
0 answers
15 views

Sklearn Lightgbm 3.3.2 API

I have a model object from a model and am trying to pass in the dataframe for scoring, it is kicking me an error: ...
  • 101
0 votes
0 answers
12 views

Sklearn Bisecting Kmeans prediction issue with processor?

I'm trying to predict a query vector to observe which cluster it belongs to using the SKlearns Bisecting K means algorithm. I get an issue with my console saying Windows fatal exception: int divide by ...
  • 11
3 votes
0 answers
46 views

Does ROC AUC different between crossval and test set indicate overfitting or other problem?

I am training a composite model (XGBoost, Linear Regression, and RandomForest) to predict injured people probability. Well, the results of cross-validation with 5 folds. Well, I can see any problem ...
0 votes
1 answer
36 views

Does the linearregression() handle the dummy Variable trap?

As the title says, Does the linearregression() handle the dummy Variable trap by itself ? or do I need to program its solution implicitly? Also, does the dummy ...
0 votes
0 answers
13 views

best clustering algorithm or model for clustering areas on map?

I have a database that has information such as Latitude, longitude, plus other information such as sightseeing locations, restaurants and shopping centers, if it's rural or suburb,... It also has ...
  • 1
0 votes
0 answers
11 views

what does this mean?: The integer labels for cluster membership of each sample

I'm not sure of what this means: The integer labels for cluster membership of each sample. it's the y return of y kmeans ...
1 vote
1 answer
46 views

Combining sklearn pipelines with different output shape

As part of a data preprocessing step, I'm trying to create a "master pipeline" from two separate pipelines, one for numerical features and one for datetime features. The numerical pipeline ...
0 votes
0 answers
26 views

Sklearn pipeline and custom transformers to remove specific value from columns

I'm trying to use sklearn pipelines and custom transformers to do outlier removal. What I want to do is identify outliers using an IQR-filter, set the outlier values to 'OUTLIER' (not NaN), and then ...
0 votes
0 answers
25 views

How does LinearRegression() selects the most significant features in multiple linear regression?

There 5 ways to build a multiple linear regression through selecting the most significant features, examples are : All in , Backward Elimination and Forward Selection. However, in the ...
0 votes
0 answers
19 views

Data type conversion as part of sklearn pipeline

I'm currently learning and implementing sklearn pipelines. As an early step in the pipeline, I want to convert some data types that are wrong from the import (primarily object to numerical and object ...
0 votes
1 answer
34 views

Different result of classification with same classifier and same input parameters

I did a binary classification using "Random Forest". The code block is ...
  • 309
0 votes
0 answers
8 views

How to improve computational performances in GaussianProcessRegressor?

I need to fit my GaussianProcessRegressor with a lot of data. In particular, I start fitting the GP with few data, and I add more at each step. Since I need to ...
  • 1
1 vote
1 answer
22 views

Select threshold (cut-off point )for binary classification by desired fpr persentage value

I want to recreate catboost.utils.select_threshold(desc) method for CalibratedClassifierCV model. In Catboost I can select ...
  • 31
0 votes
1 answer
38 views

Why does my model's output look correct pattern-wise but with a consistent offset?

I'm having an issue where my AutoML model's output is having a consistent offset from the test dataset (image below). I'm wondering if anybody has any input on what could be causing this? My initial ...
  • 101
0 votes
0 answers
29 views

How Can I print the values of Tfidf vectorizer?

I have a code like this model = make_pipeline(TfidfVectorizer(),MultinomialNB()) Now I was giving data to the model like this ...
  • 11
1 vote
0 answers
39 views

KNN using Mahalanobis distance gives low score [closed]

I want to get average score of all possible K but the average accuracy I'm getting is much lower than what's given to me. ...
1 vote
0 answers
82 views

Equal error rate for multiclass (non-binary) classifier

In many biometrics identification papers they measure they performance by computing Equal Error Rate (EER). When dealing with verification problem, or any other binary classification problem - the ...
0 votes
0 answers
12 views

Any ideas on emulating a random forest using Z3?

I have an sklearn random forest with 2 estimators and an argmax post-processing function. Any ideas on how I can duplicate this random forest in z3-py?
1 vote
0 answers
32 views

How to generate labels for the text data given in excel files?

I have a data given like this How do I convert this kind of data into a organized dataset like news group dataset https://scikit-learn.org/0.19/datasets/twenty_newsgroups.html
0 votes
1 answer
22 views

How can I join the regions from individual estimators in a random forest?

I have an sklearn random forest which contains 3 estimators or trees. For a particular sample, I’ve used the “decision path” feature to extract the individual estimators’ decisions which are a set of ...
0 votes
0 answers
163 views

y_true takes value in {} and pos_label is not specified: either make y_true take value in {0, 1} or {-1, 1} or pass pos_label explicitly

I want to run "4_forgery_detection_result.ipynb" from an available code. In this cell of the code, ...
  • 1
0 votes
0 answers
7 views

LassoCV model training with 150+ features

I'm trying to fit a dataset of about 150 features using LassoCV. Right now I'm using this loop to try and find the best value for alpha (get_tts is just a function to retrieve test/train sets): ...
0 votes
0 answers
10 views

SVM's support vectors decision function representataion

I am currently using SVM for my project with 'rbf' kernel. What i understand from the theory is that the decision function value ...
  • 165
0 votes
0 answers
21 views

Is it possible to extract precise decision boundaries from a random forest for a multiclass classification?

I have a random forest (argmax post-processor) with 3 trees and 10 input features. The final outcome of the random forest is either true or false depending on the combination of the feature values. Is ...
1 vote
4 answers
31 views

What's more important - accuracy on training or accuracy on cross validation?

I optimized a knn algorithm in sklearn with a grid search. However, my accuracy on the training data decreased 1% while my cross validation accuracy increased 0.7%. Is the model better after the grid ...
0 votes
0 answers
15 views

LightGBM Price Prediction always INF but RMSE 0.19

I have a real state dataset from Belgium: https://raw.githubusercontent.com/Joffreybvn/real-estate-data-analysis/master/data/clean/belgium_real_estate.csv And I want to use LightGBM for price ...
0 votes
1 answer
31 views

Using 'Mlxtend' with 'TensorFlow' or 'Pytorch'

Is it possible to create a simple stacking implementation for regression with 'Mlxtend' using models created by 'TensorFlow' or 'Pytorch' however the documentation only supports examples that contain '...
1 vote
1 answer
19 views

What is the role of epoch in this Geron's code?

I am reading Hands-On ML 2nd Edition. In page 142 there is the following code as an example of Early Stopping: ...
0 votes
1 answer
35 views

Denoising in ML Pipeline

Say I split my raw data into train and test sets. Should I clean them first and denoise the datasets before I start creating new features or, should I create new features for both the train and test ...
0 votes
1 answer
57 views

Optimize a non-linear function in Python

I am trying to optimize a function using scipy.optimize, but it does not converge. I have a trading strategy with a default stop-loss based on the lowest price over 20 days. I want to optimize this ...
0 votes
0 answers
13 views

What is this method of feature selection called, is it a good idea, and if so how might I implement it?

I hope you don't mind me asking a few questions in one - they're all related somewhat. I'm working on a simple classification problem (Titanic, you guessed it) and I'm trying to grind out the last ...
0 votes
1 answer
26 views

Time Series Data Imputation

I am studying time series analysis to apply on a new project. Well, I am confronting a dilemma that I need some help. When I read an old version of ggplot2 book (https://ggplot2-book.org/), I guess ...
2 votes
1 answer
41 views

How to build single pipeline with multiple estimators supporting fit and predict?

I have a ML problem where I want to divide the prediction task into subproblems (where I believe specialized models will do better). All these predictions tasks operate independently and will use the ...
  • 53
1 vote
1 answer
25 views

Getting equal distributions of data from different input sets

I am new to ML. I am trying to create a training dataset that is equally distributed between multiple lists, each of which have a different kind of data. How can I do this? I looked into ...

1
2 3 4 5
44