Category "scikit-learn"

Using StandardScaler for multiple columns

I want to use StandardScaler only on certain columns, however my code resulted in error. Here is my code: from sklearn.preprocessing import StandardScaler num_c

sklearn.model_selection.train_test_split random state

I am training a computer vision model. I divide the images in 3 datasets: training, validation and testing. So that I get always the same images in training, va

Is it possible to average the output of multiple classification models using pipeline in sklearn?

As an example, suppose there is a random forest and a logistic regression model that accept the same input data, and I want the inference result to be the avera

Issue fitting a SGD Classifier

I'm following the book Hands-on Machichine Learning by Aurelien Geron, more specifically, where it begins to go into classifiers. I'm following the code from th

Sklearn Pipeline with KernelExplainer and data to predict as DataFrame leads to error

I want to calculate shap values from a sklearn pipeline with a preprocessor and a model. When i do it with the code below I get 0 for all shape_values def creat

Cannot install Scipy in FreeBSD 13 with Python 3.10

I am trying install scipy in FreeBSD 13. I have built python 3.10 on FreebSD 13 and managed to install pandas, matplotlib and numpy on a virtual environment whi

Negative BIC values for GaussianMixture in scikit-learn (sklearn)

In scikit-learn, the GaussianMixture object has the method bic(X) that implements the Bayesian Information Criterion to choose the number of components that bet

Why the sum "value" isn't equal to the number of "samples" in scikit-learn RandomForestClassifier?

I built a random forest by RandomForestClassifier and plot the decision trees. What does the parameter "value" (pointed by red arrows) mean? And why the sum of

Decision tree regression producing multiple lines

I'm trying to make a single variable regression using decision tree regression. However when I'm plotting the results. Multiple lines show in the plot just like

How to perform Recursive Feature Elimination (RFE) with LSTM as estimator in python?

I am trying to identify the important features in a data frame containing stock data. I plan on using LSTM to predict closing prices later on. I currently have

AttributeError: 'numpy.ndarray' object has no attribute 'transform'

I want to create a sklearn pipeline that consists of two steps: Custom transformer function Keras classification model This is my data set (of course, I'm provi

Python scikit learn pipelines (no transformation on features)

I am running different machine learning models on my data set. I am using sklearn pipelines to try different transforms on the numeric features to evaluate if o

How to pass a trained model to KerasClassifier?

I have a dozen pre-trained DNNs that I wish to add to a sklearn ensemble. The issue is that it seems I can not provide pre-trained models to KerasClassifier. cl

How to pass custom weights to scikit_learn wrappers (e.g. KerasClassifier) in a multilabel classification problem

I'm building a chain classifier for a multiclass problem that uses Keras binary Classifier model in a chain. I have 17 labels as classification target and datas

Right way to use RFECV and Permutation Importance - Sklearn

There is a proposal to implement this in Sklearn #15075, but in the meantime, eli5 is suggested as a solution. However, I'm not sure if I'm using it the right w

How to create a for loop with checking appended models

I have a list of models that I iterate through in a for loop getting their performances. I've added catboost to my model list, but when I try to add it's best e

scikit-learn GridSearchCV() fit() performance improvement

I am using GridSearchCV() and its fit() method to build a model. I currently have this working, but would like to improve the accuracy of the model by supplying

ValueError: source code string cannot contain null bytes while import sklearn

I'm trying to import MinMaxScaler from sklearn.preprocessing. when I run my code this error appears that refers to the import line: ValueError: source code str

How to fit a line using RANSAC in Cartesian coordinates?

I am using a 2D Lidar and getting the data as angle and distance with respect to lidar Position. I have to create a floor plan using Lidar and the data is given

How to install sklearn on visual studio 2019?

I'm working on a sample project with python language and visual studio 2019 IDE and I want to know how/where can I install packages like "sklearn"? When I run