id
stringlengths
7
11
source
stringclasses
1 value
category
stringclasses
11 values
title
stringlengths
15
214
text
stringlengths
70
30.5k
url
stringlengths
57
160
tags
stringlengths
3
113
created_at
int64
1.22B
1.79B
se_78933603
stackoverflow
MACHINE_LEARNING
Calculate the number of points in a given radius by X and Y coordinates
Calculate the number of points in a given radius by X and Y coordinates I have a python code where, when given a list of points (X and Y coordinate pairs) in a dataframe and a specified circle radius I would like the code to go through each point, treat it as the the center of the circle, and find how many other point...
https://stackoverflow.com/questions/78933603/calculate-the-number-of-points-in-a-given-radius-by-x-and-y-coordinates
python, scikit-learn, coordinates, kdtree, radius
1,725,048,279
se_78924517
stackoverflow
MACHINE_LEARNING
Saving model hyperparameters as dictionary: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Saving model hyperparameters as dictionary: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) I am tuning some sklearn and tensorflow models, I get the hyperparameters as a dictionary, e.g., {'l1': 0.001, 'lr':0.001} and I save them in a larger dictionary, within my tuning function: def optunize_...
https://stackoverflow.com/questions/78924517/saving-model-hyperparameters-as-dictionary-json-decoder-jsondecodeerror-expect
python, json, tensorflow, scikit-learn, slurm
1,724,865,118
se_78933232
stackoverflow
MACHINE_LEARNING
Keep training pytorch model on new data
Keep training pytorch model on new data I'm working on a text classification task and have decided to use a PyTorch model for this purpose. The process mainly involves the following steps: Load and process the text. Use a TF-IDF Vectorizer. Build the neural network and save the TF-IDF Vectorizer and model to predict ...
https://stackoverflow.com/questions/78933232/keep-training-pytorch-model-on-new-data
python, scikit-learn, pytorch, nlp, python-polars
1,725,040,079
se_65057140
stackoverflow
MACHINE_LEARNING
Difference between transform and fit_transform
Difference between transform and fit_transform I have been doing a course on intermediate machine learning from Kaggle. In the explanation, in order to label categorical data they have used LabelEncoder library from sklearn.preprocessing. Here, for training dataset they have used fit_transform and for validadtion dat...
https://stackoverflow.com/questions/65057140/difference-between-transform-and-fit-transform
machine-learning, scikit-learn, cluster-analysis, preprocessor, kaggle
1,606,625,692
se_78912810
stackoverflow
MACHINE_LEARNING
Error: Exception while trying to deploy a Flask App using 'scikit-learn' on Vercel
Error: Exception while trying to deploy a Flask App using 'scikit-learn' on Vercel I am using a Flask application in the file named as app.py in my root directory and another python file to create the ML model named as regressor.py. I tried deploying the repository on Vercel numerous times but got the same err...
https://stackoverflow.com/questions/78912810/error-exception-while-trying-to-deploy-a-flask-app-using-scikit-learn-on-verc
python, flask, scikit-learn, regression, vercel
1,724,644,349
se_47717818
stackoverflow
MACHINE_LEARNING
Train score diminishes after polynomial regression degree increases
Train score diminishes after polynomial regression degree increases I'm trying to use linear regression to fit a polynomium to a set of points from a sinusoidal signal with some noise added, using linear_model.LinearRegression from sklearn. As expected, the training and validation scores increase as the degree of th...
https://stackoverflow.com/questions/47717818/train-score-diminishes-after-polynomial-regression-degree-increases
python, machine-learning, scikit-learn, regression, polynomial-approximations
1,512,748,416
se_68738254
stackoverflow
MACHINE_LEARNING
How to Inverse pca.components_ to original values
How to Inverse pca.components_ to original values I am doing PCA using temperature data (below), samples in row and features(1000 hPa, 925 hPa... etc) in columns array([[ 25. , 22.2, 19. , ..., -51.9, -50.3, -41.1], [ 26.8, 22.8, 18.4, ..., -53.1, -49.5, -41.1], [ 26.4, 23.4, 19.4, ..., -56.7, -49....
https://stackoverflow.com/questions/68738254/how-to-inverse-pca-components-to-original-values
python, scikit-learn, pca
1,628,669,374
se_78814203
stackoverflow
MACHINE_LEARNING
Pandas-Profiling conflicts with scikit-learn
Pandas-Profiling conflicts with scikit-learn When i try to install pandas profiling in my jupyter notebook then i encounter an error as ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. scikit...
https://stackoverflow.com/questions/78814203/pandas-profiling-conflicts-with-scikit-learn
pandas, scikit-learn, pip, joblib, pandas-profiling
1,722,391,975
se_59974146
stackoverflow
MACHINE_LEARNING
Installing an old version of scikit-learn
Installing an old version of scikit-learn Problem Statment I'm trying to run some old python code that requires scikit-learn 18.0 but the current version I have installed is 0.22 and so I'm getting a warning/invalid data when I run the code. What I've Tried I tried installing the specific version both in the term...
https://stackoverflow.com/questions/59974146/installing-an-old-version-of-scikit-learn
python, windows, scikit-learn, pip, conda
1,580,325,616
se_78922994
stackoverflow
MACHINE_LEARNING
Pipeline does not apply the functions when I add a scaler
Pipeline does not apply the functions when I add a scaler I am trying to deploy the model as a .pkl file. When making the pipeline, i am facing some problems. Here is the code that causes no trouble: from sklearn.pipeline import FunctionTransformer, make_pipeline, Pipeline from sklearn.compose import TransformedTarget...
https://stackoverflow.com/questions/78922994/pipeline-does-not-apply-the-functions-when-i-add-a-scaler
python, scikit-learn, scikit-learn-pipeline
1,724,843,321
se_43640546
stackoverflow
MACHINE_LEARNING
how to make RandomForestClassifier faster?
how to make RandomForestClassifier faster? I am trying to implement bag of word model from kaggle site with a twitter sentiments data which has around 1M raw. I already clean it but in last part when I applied my features vectors and sentiments to Random Forest classifier it is taking so much time.here is my code... ...
https://stackoverflow.com/questions/43640546/how-to-make-randomforestclassifier-faster
python-3.x, machine-learning, scikit-learn, random-forest
1,493,226,595
se_62658215
stackoverflow
MACHINE_LEARNING
ConvergenceWarning: lbfgs failed to converge (status=1): STOP: TOTAL NO. of ITERATIONS REACHED LIMIT
ConvergenceWarning: lbfgs failed to converge (status=1): STOP: TOTAL NO. of ITERATIONS REACHED LIMIT I have a dataset consisting of both numeric and categorical data and I want to predict adverse outcomes for patients based on their medical characteristics. I defined a prediction pipeline for my dataset like so: X = d...
https://stackoverflow.com/questions/62658215/convergencewarning-lbfgs-failed-to-converge-status-1-stop-total-no-of-iter
python, machine-learning, scikit-learn, logistic-regression
1,593,522,500
se_66793419
stackoverflow
MACHINE_LEARNING
fit() vs fit_predict() methods in sklearn KMeans
fit() vs fit_predict() methods in sklearn KMeans There are two methods when we make a model on sklearn.cluster.KMeans. The first is fit() and the other is fit_predict(). My understanding is that when we use the fit() method on a KMeans model, it gives an attribute labels_, which basically holds the info on which obser...
https://stackoverflow.com/questions/66793419/fit-vs-fit-predict-methods-in-sklearn-kmeans
python, scikit-learn, k-means
1,616,649,007
se_67818319
stackoverflow
MACHINE_LEARNING
How to output mean and stdv of Gaussian Process Classifier in sklearn?
How to output mean and stdv of Gaussian Process Classifier in sklearn? Im fitting some data for a classification task using Gaussian Process Classifiers in sklearn. I know that for the Gaussian Process Regressor one can pass return_std in y_test, std = gp.predict(x_test, return_std=True) to output the standard deviat...
https://stackoverflow.com/questions/67818319/how-to-output-mean-and-stdv-of-gaussian-process-classifier-in-sklearn
python, scikit-learn, classification, gaussian-process
1,622,710,190
se_78914739
stackoverflow
MACHINE_LEARNING
module 'sklearn' has no attribute 'model_selection'
module 'sklearn' has no attribute 'model_selection' Why does the code below return the error module 'sklearn' has no attribute 'model_selection' import sklearn xtrain, xtest, ytrain, ytest = sklearn.model_selection.train_test_split(x,y, test_size = 0.2) but this one works fine: from sklearn.model_sel...
https://stackoverflow.com/questions/78914739/module-sklearn-has-no-attribute-model-selection
python, scikit-learn, python-import
1,724,679,522
se_78735036
stackoverflow
MACHINE_LEARNING
Figure out which words a Naive Bayes classificator uses for deciding
Figure out which words a Naive Bayes classificator uses for deciding I'm doing text classification with Naive Bayes in Python and want to figure out which words are used for deciding to what class a text belongs. I have found this answer https://stackoverflow.com/a/62097661/3992979, but it doesn't help me as my vector...
https://stackoverflow.com/questions/78735036/figure-out-which-words-a-naive-bayes-classificator-uses-for-deciding
python, scikit-learn, naivebayes
1,720,694,525
se_78373933
stackoverflow
MACHINE_LEARNING
Can't install imports in VsCode using 'pip install' and extra python extensions
Can&#39;t install imports in VsCode using &#39;pip install&#39; and extra python extensions I am trying to make a machine learning algorithm that when you enter a math equation you say if the answer is right or not. But when I run it the terminal says... File "******** - **Vs Code\Python\math.py", line 2, in <module> ...
https://stackoverflow.com/questions/78373933/cant-install-imports-in-vscode-using-pip-install-and-extra-python-extensions
python, scikit-learn, import, vscode-extensions
1,713,890,701
se_78914845
stackoverflow
MACHINE_LEARNING
How to remove contour labels from PartialDependenceDisplay plot
How to remove contour labels from PartialDependenceDisplay plot I'm using the PartialDependenceDisplay function from sklearn to visualize the results from a random forest classification. Is there any way to remove the contour labels that are included in the figure? For the purpose of this question it seems easiest to ...
https://stackoverflow.com/questions/78914845/how-to-remove-contour-labels-from-partialdependencedisplay-plot
python, scikit-learn
1,724,680,960
se_73209365
stackoverflow
MACHINE_LEARNING
DaskLGBMClassifier.fit() error: &#39;Future&#39; object has no attribute &#39;get_params&#39;
DaskLGBMClassifier.fit() error: &#39;Future&#39; object has no attribute &#39;get_params&#39; I'm trying LGBM's Dask API and when I fit DaskLGBMClassifier I get the following error: 'Future' object has no attribute 'get_params' I tried to deug it working on the original code. The variable model that you can see in th...
https://stackoverflow.com/questions/73209365/dasklgbmclassifier-fit-error-future-object-has-no-attribute-get-params
python, machine-learning, scikit-learn, dask, lightgbm
1,659,450,835
se_78912816
stackoverflow
MACHINE_LEARNING
Installing old version of scikit-learn: ModuleNotFoundError: No module named &#39;numpy&#39;
Installing old version of scikit-learn: ModuleNotFoundError: No module named &#39;numpy&#39; I have an old Python project that uses scikit-learn version 0.22.2.post1. Unfortunately I am unable to update to a newer version of scikit-learn as the training data has long been lost, and I understand that the version of sci...
https://stackoverflow.com/questions/78912816/installing-old-version-of-scikit-learn-modulenotfounderror-no-module-named-nu
python, numpy, scikit-learn, pip, python-3.9
1,724,644,471
se_66606044
stackoverflow
MACHINE_LEARNING
No module named &#39;sklearn.linear_model.base&#39;
No module named &#39;sklearn.linear_model.base&#39; from flask import Flask, render_template, request import pickle import numpy as np #Load the Random Forest Classifier model filename = 'first-innings-score-lr-model' regressor = pickle.load(open(filename, 'rb')) error Traceback (most recent call last): File "D:...
https://stackoverflow.com/questions/66606044/no-module-named-sklearn-linear-model-base
python, scikit-learn
1,615,577,223
se_30984019
stackoverflow
MACHINE_LEARNING
how handle categorical data in sklearn GMM mixture model
how handle categorical data in sklearn GMM mixture model Is there a way to feed in categorical observations in sklearn GMM module? My data looks somewhat like: User,Siet_category,user_segment UserA,Sports:News,efk-457 UserB,Music:Entertainment,asl-567 UserC,Sports:News,asl-567 UserD,Sports:News,efk-457 user_segment ...
https://stackoverflow.com/questions/30984019/how-handle-categorical-data-in-sklearn-gmm-mixture-model
python, machine-learning, scikit-learn
1,434,987,092
se_48891538
stackoverflow
MACHINE_LEARNING
One-hot-encoding with missing categories
One-hot-encoding with missing categories I have a dataset with a category column. In order to use linear regression, I 1-hot encode this column. My set has 10 columns, including the category column. After dropping that column and appending the 1-hot encoded matrix, I end up with 14 columns (10 - 1 + 5). So I train ...
https://stackoverflow.com/questions/48891538/one-hot-encoding-with-missing-categories
python, scikit-learn, one-hot-encoding
1,519,149,754
se_78845582
stackoverflow
MACHINE_LEARNING
Convert Pandas dataframe of objects to a dataframe of vectors
Convert Pandas dataframe of objects to a dataframe of vectors I have a Pandas dataframe (over 1k of rows). There are numbers, objects, strings, and Boolean values in my dataframe. I want to convert each 'cell' of the dataframe to a vector, and work with the resulting vectors. I then plan to compare each row of vectors...
https://stackoverflow.com/questions/78845582/convert-pandas-dataframe-of-objects-to-a-dataframe-of-vectors
python, pandas, dataframe, vector, scikit-learn
1,723,063,155
se_78896943
stackoverflow
MACHINE_LEARNING
Accessing the values used to impute and normalize new data based upon scikit-learn ColumnTransformer
Accessing the values used to impute and normalize new data based upon scikit-learn ColumnTransformer Using scikit-learn I'm building machine learning models on a training set, and then evaluating them on a test set. On the train set I perform data imputation and scaling with the ColumnTransformer, then build a logisti...
https://stackoverflow.com/questions/78896943/accessing-the-values-used-to-impute-and-normalize-new-data-based-upon-scikit-lea
python, machine-learning, scikit-learn, imputation
1,724,243,093
se_65418378
stackoverflow
MACHINE_LEARNING
ValueError: A given column is not a column of the dataframe
ValueError: A given column is not a column of the dataframe Everyone I am trying to create a pipeline using the scikit-learn. Basically, I have a jupyter-notebook that loading data using pandas, split dataset to train and test the model. My problem occur in the line: clf.fit(X_train, y_train) you can see the whole cod...
https://stackoverflow.com/questions/65418378/valueerror-a-given-column-is-not-a-column-of-the-dataframe
pandas, scikit-learn, jupyter-notebook
1,608,691,541
se_33459864
stackoverflow
MACHINE_LEARNING
How do I make KernelDensity normalize to 1?
How do I make KernelDensity normalize to 1? I'm using the KernelDensity module from sklearn.neighbors, but the y-axis values are weird. Does anyone know how I can fix this? I would like the y-axis to correspond to the percent probability. X = data[:, np.newaxis] X_plot = np.linspace(0, 20, 1000)[:, np.newaxis] kde...
https://stackoverflow.com/questions/33459864/how-do-i-make-kerneldensity-normalize-to-1
python, scikit-learn, kernel-density
1,446,359,860
se_78873685
stackoverflow
MACHINE_LEARNING
Applying log transformation to a column
Applying log transformation to a column I have encoded Gender column by OneHotEncoder. I want to apply log transformation to only Female[0] column but it is applying log to all the columns — why? My code: import pandas as p from sklearn.preprocessing import FunctionTransformer, OneHotEncoder from sklearn.compose impor...
https://stackoverflow.com/questions/78873685/applying-log-transformation-to-a-column
pandas, machine-learning, scikit-learn
1,723,697,930
se_78903794
stackoverflow
MACHINE_LEARNING
Random Forest Test split
Random Forest Test split I have trained Random forest model using June dataset to predict status_value of an employee and using 0.3 split for test_size. I am including code snippets as the code it self works well without any errors X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=...
https://stackoverflow.com/questions/78903794/random-forest-test-split
machine-learning, scikit-learn, random-forest
1,724,367,278
se_78892162
stackoverflow
MACHINE_LEARNING
Different solution using scikit-learn and cvxpy
Different solution using scikit-learn and cvxpy I am trying to code a logistic regression model using the CVXPY library. The code I have written so far "works" in the sense that it can be executed, it does not yield any error message and provides a solution. However, this solution does not match the solution provided ...
https://stackoverflow.com/questions/78892162/different-solution-using-scikit-learn-and-cvxpy
python, scikit-learn, logistic-regression, cvxpy
1,724,152,911
se_16381577
stackoverflow
MACHINE_LEARNING
scikit-learn DBSCAN memory usage
scikit-learn DBSCAN memory usage UPDATED: In the end, the solution I opted to use for clustering my large dataset was one suggested by Anony-Mousse below. That is, using ELKI's DBSCAN implimentation to do my clustering rather than scikit-learn's. It can be run from the command line and with proper indexing, performs t...
https://stackoverflow.com/questions/16381577/scikit-learn-dbscan-memory-usage
python, scikit-learn, cluster-analysis, data-mining, dbscan
1,367,730,241
se_78890391
stackoverflow
MACHINE_LEARNING
how use sklearn python get predicion
how use sklearn python get predicion I have an table and I want pass the features = "train_1, train_2, train_3, train_4" and target_result = result_cor. I want know when the values are = "1 or 2" in my predicion: follow my data follow my code: from enum import auto from sklearn.svm import LinearSVC from sklearn.model_...
https://stackoverflow.com/questions/78890391/how-use-sklearn-python-get-predicion
python, machine-learning, scikit-learn
1,724,120,299
se_75918536
stackoverflow
MACHINE_LEARNING
Scikit-Learn LOOCV vs doing it manually give different results, why?
Scikit-Learn LOOCV vs doing it manually give different results, why? So i have built a model for a small dataset and since it was a small dataset, i made a Leave-One-out Cross-Validation (LOOCV) check for its accuracy. so in short, i would remove one sample manually, train the model, predict the left out sample and sa...
https://stackoverflow.com/questions/75918536/scikit-learn-loocv-vs-doing-it-manually-give-different-results-why
python, machine-learning, scikit-learn, metrics, cross-validation
1,680,518,288
se_78893734
stackoverflow
MACHINE_LEARNING
sklearn.metrics.accuracy_score is very slow
sklearn.metrics.accuracy_score is very slow I need to measure accuracy of my model's prediction for binary classification (0 and 1 outputs). I am testing my model with many different values of threshold, and my testing dataset is quite big (50-100 million of examples), so I need a fast way to compute model's accuracy....
https://stackoverflow.com/questions/78893734/sklearn-metrics-accuracy-score-is-very-slow
python, performance, scikit-learn
1,724,174,856
se_78893376
stackoverflow
MACHINE_LEARNING
Data Shape Issues in SKL Pipeline using TFIDF
Data Shape Issues in SKL Pipeline using TFIDF I am stumped on an issue with Python/Sci-Kit Learn/Pipelines. I am receiving an error that the shape of the data as it passes through the pipeline is not what is expected. Specific error: blocks[0,:] has incompatible row dimensions. Got blocks[0,6].shape[0] == 4, expected ...
https://stackoverflow.com/questions/78893376/data-shape-issues-in-skl-pipeline-using-tfidf
python, machine-learning, scikit-learn, pipeline, tf-idf
1,724,169,178
se_78893397
stackoverflow
MACHINE_LEARNING
Use PCA with Python Polars
Use PCA with Python Polars I'm trying to use PCA (from the scikit-learn library) with Polars. I'm following this Kaggle notebook, which uses Pandas, where they set an index for clustering. However, Polars doesn't have the concept of an index or multi-index. Here’s my current approach: pca = PCA().fit( customer_data...
https://stackoverflow.com/questions/78893397/use-pca-with-python-polars
python, scikit-learn, python-polars
1,724,169,390
se_66126736
stackoverflow
MACHINE_LEARNING
how to display/view `sklearn.utils.Bunch` data set?
how to display/view `sklearn.utils.Bunch` data set? I am going through a tutorial that uses sklearn.utils.Bunch as a data set: cal_housing = fetch_california_housing() I'm running this on a Databricks notebook. I've read through the documentation that I can find like https://scikit-learn.org/stable/modules/generated/s...
https://stackoverflow.com/questions/66126736/how-to-display-view-sklearn-utils-bunch-data-set
python, scikit-learn, databricks
1,612,903,064
se_78889578
stackoverflow
MACHINE_LEARNING
Hard Voting Classifier: What happens in case of a tie (sklearn)
Hard Voting Classifier: What happens in case of a tie (sklearn) I have 9 different models for a classification problem with three possible outputs. I want to do VotingClassifier with a hard voting mechanism. Sounds easy, just count how often which class is predicted. But if I want to use the function instead of progra...
https://stackoverflow.com/questions/78889578/hard-voting-classifier-what-happens-in-case-of-a-tie-sklearn
scikit-learn, classification, voting
1,724,097,732
se_56338847
stackoverflow
MACHINE_LEARNING
How to give column names after one-hot encoding with sklearn?
How to give column names after one-hot encoding with sklearn? Here is my question, I hope someone can help me to figure it out.. To explain, there are more than 10 categorical columns in my data set and each of them has 200-300 categories. I want to convert them into binary values. For that I used first label encoder...
https://stackoverflow.com/questions/56338847/how-to-give-column-names-after-one-hot-encoding-with-sklearn
python, encoding, scikit-learn, one-hot-encoding
1,559,035,141
se_65881699
stackoverflow
MACHINE_LEARNING
SageMaker failed to extract model data archive tar.gz for container when deploying
SageMaker failed to extract model data archive tar.gz for container when deploying I am trying in Amazon Sagemaker to deploy an existing Scikit-Learn model. So a model that wasn't trained on SageMaker, but locally on my machine. On my local (windows) machine I've saved my model as model.joblib and tarred the model to ...
https://stackoverflow.com/questions/65881699/sagemaker-failed-to-extract-model-data-archive-tar-gz-for-container-when-deployi
machine-learning, scikit-learn, deployment, amazon-sagemaker
1,611,565,411
se_76796808
stackoverflow
MACHINE_LEARNING
what is &quot;Support&quot; in classification_report within sklearn?
what is &quot;Support&quot; in classification_report within sklearn? I have been wrote a code and the result was a report which you can seen blow. the code is about the number of people who survived or died in titanic. my question is what is "Support" in this report? precision recall f1-score suppo...
https://stackoverflow.com/questions/76796808/what-is-support-in-classification-report-within-sklearn
python, scikit-learn
1,690,703,224
se_78883777
stackoverflow
MACHINE_LEARNING
How to Optimize Memory Usage for Cross-Validation of Large Datasets
How to Optimize Memory Usage for Cross-Validation of Large Datasets I have a very large DF (~200GB) of features that I want to perform cross validation on a random forest model with these features. The features are from a huggingface model in the form of a .arrow file. I am trying to figure out how I can minimize the ...
https://stackoverflow.com/questions/78883777/how-to-optimize-memory-usage-for-cross-validation-of-large-datasets
python, pandas, dataframe, scikit-learn, huggingface-transformers
1,723,957,995
se_63173680
stackoverflow
MACHINE_LEARNING
What is the impurity of a sklearn regressor?
What is the impurity of a sklearn regressor? Some regressors such as DecisionTreeRegressor have the parameter min_impurity_decrease, but I cannot find any documentation as to what is meant with impurity. Is the impurity the same as the criterion parameter? So when I set criterion='mae', is the mean average error also ...
https://stackoverflow.com/questions/63173680/what-is-the-impurity-of-a-sklearn-regressor
scikit-learn, regression, decision-tree
1,596,113,836
se_78881480
stackoverflow
MACHINE_LEARNING
How to speed up training of Random Forest Regression and SVR?
How to speed up training of Random Forest Regression and SVR? I am trying to create a regression model to predict the closing price of bitcoin using the folloςing dataset: https://www.kaggle.com/datasets/prasoonkottarathil/btcinusd/data?select=BTC-2021min.csv It has over 600k records with 15 features (some that I cre...
https://stackoverflow.com/questions/78881480/how-to-speed-up-training-of-random-forest-regression-and-svr
python-3.x, machine-learning, scikit-learn, regression
1,723,872,615
se_48252006
stackoverflow
MACHINE_LEARNING
Set parameters for classifier and use it without fitting
Set parameters for classifier and use it without fitting I'm using python and scikit-learn to do some classification. Is it possible to reuse the parameters, learned by classifier? For example: from sklearn.svm import SVC cl = SVC(...) # create svm classifier with some hyperparameters cl.fit(X_train, y_train) p...
https://stackoverflow.com/questions/48252006/set-parameters-for-classifier-and-use-it-without-fitting
python, machine-learning, scikit-learn, classification
1,515,949,443
se_78072003
stackoverflow
MACHINE_LEARNING
Could not pickle the task to send it to the workers when running sklearn GridSearchCV
Could not pickle the task to send it to the workers when running sklearn GridSearchCV I am running a GridSearchCV on different models using GridSearchCV using the following code: def algorithm_pipeline(X_train_data, X_test_data, y_train_data, y_test_data, model, param_grid, cv=10, scoring_fit='a...
https://stackoverflow.com/questions/78072003/could-not-pickle-the-task-to-send-it-to-the-workers-when-running-sklearn-gridsea
python, scikit-learn, pickle, joblib
1,709,096,120
se_60223573
stackoverflow
MACHINE_LEARNING
conditional sampling from multivariate kernel density estimate in python
conditional sampling from multivariate kernel density estimate in python One can create a multivariate kernel density estimate (KDE) with scikitlearn (https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KernelDensity.html#sklearn.neighbors.KernelDensity) and scipy (https://docs.scipy.org/doc/scipy/ref...
https://stackoverflow.com/questions/60223573/conditional-sampling-from-multivariate-kernel-density-estimate-in-python
python, scikit-learn, scipy
1,581,672,882
se_78878468
stackoverflow
MACHINE_LEARNING
What is the rationale behind `TransformedTargetRegressor` always cloning the given `regressor` and how to prevent this behavior?
What is the rationale behind `TransformedTargetRegressor` always cloning the given `regressor` and how to prevent this behavior? The docs of sklearn.compose.TransformedTargetRegressor state that: regressor object, default=None Regressor object such as derived from RegressorMixin. This regressor will automatically be ...
https://stackoverflow.com/questions/78878468/what-is-the-rationale-behind-transformedtargetregressor-always-cloning-the-giv
python, scikit-learn
1,723,800,528
se_78877321
stackoverflow
MACHINE_LEARNING
Can&#39;t install any packages or create environments through Anaconda
Can&#39;t install any packages or create environments through Anaconda I've been trying to install scikit-learn through Spyder and every time I attempt, I get the same error. I also get this error when I try installing in the terminal. Is there something I'm missing? I have Miniconda 3, Spyder 5.5.5, and python 3.10.1...
https://stackoverflow.com/questions/78877321/cant-install-any-packages-or-create-environments-through-anaconda
python, scikit-learn, anaconda, conda, miniconda
1,723,770,214
se_78876251
stackoverflow
MACHINE_LEARNING
np.load fails with ValueError: cannot reshape array of size (838715,) into shape (838710,)
np.load fails with ValueError: cannot reshape array of size (838715,) into shape (838710,) I'm trying to save the scaling parameters of a dataset into a .npy file on the disk, so I avoid having to recalculate them every time I re-run the code. For now, I'm using MaxAbsScaler() from sklearn and I save the scaler's max_...
https://stackoverflow.com/questions/78876251/np-load-fails-with-valueerror-cannot-reshape-array-of-size-838715-into-shape
python, numpy, tensorflow, scikit-learn, data-processing
1,723,743,376
se_72599807
stackoverflow
MACHINE_LEARNING
How to extract the most important features from a ML model using SHAP - why are all my column names empty?
How to extract the most important features from a ML model using SHAP - why are all my column names empty? I want to find the most important features in my model using shap. I have this code: from sklearn.model_selection import train_test_split from sklearn.datasets import load_breast_cancer from sklearn.ensemble impo...
https://stackoverflow.com/questions/72599807/how-to-extract-the-most-important-features-from-a-ml-model-using-shap-why-are
python, pandas, machine-learning, scikit-learn, shap
1,655,108,903
se_78869863
stackoverflow
MACHINE_LEARNING
How fix &quot;found array with dim 4&quot;Error when using ML algorthims to classify image
How fix &quot;found array with dim 4&quot;Error when using ML algorthims to classify image I have a simple ML classification problem. I have 8 folder each one represent class so I have first load these images from folders and assign labels and then save it as csv file (code in below) def load_images_from_folder(root_f...
https://stackoverflow.com/questions/78869863/how-fix-found-array-with-dim-4error-when-using-ml-algorthims-to-classify-image
python, machine-learning, scikit-learn
1,723,623,987
se_78863903
stackoverflow
MACHINE_LEARNING
Final Predictions accuracy of my ML Binary Classification Model is horrible
Final Predictions accuracy of my ML Binary Classification Model is horrible I am competing in a Kaggle competiton (https://www.kaggle.com/competitions/playground-series-s4e8) where we have to predict whether a mushroom is poisonous or not based on the data provided. The issue I am facing is that my models perform well...
https://stackoverflow.com/questions/78863903/final-predictions-accuracy-of-my-ml-binary-classification-model-is-horrible
python, machine-learning, scikit-learn, random-forest, xgboost
1,723,505,538
se_78864148
stackoverflow
MACHINE_LEARNING
How to select a reference level for categorical variables using Scikit-Learn?
How to select a reference level for categorical variables using Scikit-Learn? I'm trying to convert a code from SAS to Python which trains a GLM. For that, I'm using the hpgenselect with the CLASS word to deal with categorical variables. In SAS I can select the reference level for any categorical variable that the mod...
https://stackoverflow.com/questions/78864148/how-to-select-a-reference-level-for-categorical-variables-using-scikit-learn
python, machine-learning, scikit-learn, sas, glm
1,723,515,595
se_66622020
stackoverflow
MACHINE_LEARNING
FastAPI {&quot;detail&quot;:&quot;Method Not Allowed&quot;}
FastAPI {&quot;detail&quot;:&quot;Method Not Allowed&quot;} I am using FAST API for my ML Model. I have a pipeline. lr_tfidf = Pipeline([('vect', tfidf), ('clf', LogisticRegression(penalty='l2'))]) Now In Fast API, when I want to predict, and display result as API, my code is app = FastAPI() ...
https://stackoverflow.com/questions/66622020/fastapi-detailmethod-not-allowed
python, scikit-learn, fastapi
1,615,706,317
se_53784971
stackoverflow
MACHINE_LEARNING
How to disable ConvergenceWarning using sklearn?
How to disable ConvergenceWarning using sklearn? I'm using GridSearchCV to optimize hyper-parameters for SVM. I set the maximum number of iterations because I can't wait several hours to get result. I know there will be convergence warnings. I just want to ignore these warnings and not show up in the terminal. Thank...
https://stackoverflow.com/questions/53784971/how-to-disable-convergencewarning-using-sklearn
python, scikit-learn, warnings
1,544,811,582
se_71352354
stackoverflow
MACHINE_LEARNING
sklearn KMeans is not working as I only get &#39;NoneType&#39; object has no attribute &#39;split&#39; on nonEmpty Array
sklearn KMeans is not working as I only get &#39;NoneType&#39; object has no attribute &#39;split&#39; on nonEmpty Array I don't know what is wrong but suddenly KMeans from sklearn is not working anymore and I don't know what I am doing wrong. Has anyone encountered this problem yet or knows how I can fix it? from skl...
https://stackoverflow.com/questions/71352354/sklearn-kmeans-is-not-working-as-i-only-get-nonetype-object-has-no-attribute
python, numpy, scikit-learn, jupyter-notebook
1,646,401,554
se_73685519
stackoverflow
MACHINE_LEARNING
&#39;Exact&#39; object has no attribute &#39;shap_values&#39;
&#39;Exact&#39; object has no attribute &#39;shap_values&#39; import shap import pandas as pd from sklearn.datasets import fetch_california_housing from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestRegressor dataset = fetch_california_housing(as_frame=True) X = dataset["dat...
https://stackoverflow.com/questions/73685519/exact-object-has-no-attribute-shap-values
python, machine-learning, scikit-learn, shap
1,662,966,033
se_77820555
stackoverflow
MACHINE_LEARNING
SHAP Partial Dependence Plot Misalignment with Train-Test Split in Linear Regression
SHAP Partial Dependence Plot Misalignment with Train-Test Split in Linear Regression I'm experiencing an issue with SHAP's partial dependence plot when using a train-test split for a linear regression model in Python. When I calculate SHAP values and plot the partial dependence for the first observation in my test set...
https://stackoverflow.com/questions/77820555/shap-partial-dependence-plot-misalignment-with-train-test-split-in-linear-regres
python, machine-learning, scikit-learn, linear-regression, shap
1,705,329,738
se_78856690
stackoverflow
MACHINE_LEARNING
Extensive regression statistics with scipy and sklearn
Extensive regression statistics with scipy and sklearn I'm working on calculating various linear regression metrics, including R^2, Pearson, Spearman, and Kendall coefficients, and also estimating MSE (Mean Squared Error) and MUE (Mean Absolute Error). I've implemented most of the equations manually but am unsure abou...
https://stackoverflow.com/questions/78856690/extensive-regression-statistics-with-scipy-and-sklearn
python, scikit-learn, scipy, statistics, linear-regression
1,723,312,197
se_78841652
stackoverflow
MACHINE_LEARNING
Why is my code giving error &quot;sklearn not defined&quot; when i have imported the library?
Why is my code giving error &quot;sklearn not defined&quot; when i have imported the library? My code: import numpy as np import pandas as pd import pickle as pk from sklearn import linear_model from sklearn.utils import shuffle data = pd.read_csv("student-mat.csv", sep=";") data = data[["G1", "G2", "G3", "studytime"...
https://stackoverflow.com/questions/78841652/why-is-my-code-giving-error-sklearn-not-defined-when-i-have-imported-the-libra
scikit-learn, nameerror
1,722,998,801
se_78844498
stackoverflow
MACHINE_LEARNING
Why does GARCH-SVM output identical predictions for conditional volatility?
Why does GARCH-SVM output identical predictions for conditional volatility? I'm using the SVR-GARCH model to predict conditional volatility, as described in the book Machine Learning for Financial Risk Management with Python: Algorithms for Modeling Risk by Abdullah Karasan. I’ve encountered an issue where my code som...
https://stackoverflow.com/questions/78844498/why-does-garch-svm-output-identical-predictions-for-conditional-volatility
python, scikit-learn, time-series, svm
1,723,044,069
se_77013878
stackoverflow
MACHINE_LEARNING
error when using SKforecast : None of [Int64Index([48, ...],\n dtype=&#39;int64&#39;, name=&#39;date_time&#39;)] are in the [index]
error when using SKforecast : None of [Int64Index([48, ...],\n dtype=&#39;int64&#39;, name=&#39;date_time&#39;)] are in the [index] i have the dataset that i used the groupby(based on date and group) and the result is like this Dataframe: | date | group | value | |:---- |:------:| -----:| | 2022-01-01 ...
https://stackoverflow.com/questions/77013878/error-when-using-skforecast-none-of-int64index48-n-dtype-int64-na
python, machine-learning, scikit-learn, xgboost
1,693,468,770
se_78842603
stackoverflow
MACHINE_LEARNING
Can&#39;t install module although dependancies are all satisfied?
Can&#39;t install module although dependancies are all satisfied? I am trying to download a module. It worked before but 2 weeks ago it gave me an error, and I can't install it again... I tried using the command: conda install -c conda-forge montreal-forced-aligner and mamba install -c conda-forge montreal-forced-alig...
https://stackoverflow.com/questions/78842603/cant-install-module-although-dependancies-are-all-satisfied
python, scikit-learn, pip, module, conda
1,723,019,381
se_78002555
stackoverflow
MACHINE_LEARNING
How to train Random Forest classifier with large dataset to avoid memory errors in Python?
How to train Random Forest classifier with large dataset to avoid memory errors in Python? I have a dataset that is 30 million rows. I have two columns: one that contains a 1 or 0 label and the other column has a list of 1280 features for each row (181 GB total). All I want to do is plug this dataset into a Random For...
https://stackoverflow.com/questions/78002555/how-to-train-random-forest-classifier-with-large-dataset-to-avoid-memory-errors
python, pandas, numpy, performance, scikit-learn
1,708,015,825
se_78836208
stackoverflow
MACHINE_LEARNING
Removing bi-grams after tokenization for TfidfVectorizer
Removing bi-grams after tokenization for TfidfVectorizer I'm attempting to remove bi-grams that are created by TfidfVectorizer. I'm using text.TfidfVectorizer so that I can use my own preprocessor function. Test strings and preprocessor function: doc2 = ['this is a test past performance here is another that has aa aa...
https://stackoverflow.com/questions/78836208/removing-bi-grams-after-tokenization-for-tfidfvectorizer
python, scikit-learn, nlp, preprocessor, tfidfvectorizer
1,722,887,200
se_59136430
stackoverflow
MACHINE_LEARNING
How does scikit-learn handle multiple n_jobs arguments?
How does scikit-learn handle multiple n_jobs arguments? I have made a pipeline in scikit-learn that looks as follows: estimators2 = [ ('tfidf', TfidfVectorizer(tokenizer=lambda string: string.split())), ('clf', SGDClassifier(n_jobs=13, early_stopping=True, class_weight='balanced')) ] parameters2 = { 'tfid...
https://stackoverflow.com/questions/59136430/how-does-scikit-learn-handle-multiple-n-jobs-arguments
python, scikit-learn, parallel-processing
1,575,280,751
se_36573046
stackoverflow
MACHINE_LEARNING
Difference between numpy.linalg.lstsq and sklearn.linear_model.LinearRegression
Difference between numpy.linalg.lstsq and sklearn.linear_model.LinearRegression As I understand, numpy.linalg.lstsq and sklearn.linear_model.LinearRegression both look for solutions x of the linear system Ax = y, that minimise the resdidual sum ||Ax - y||. But they don't give the same result: from sklearn import lin...
https://stackoverflow.com/questions/36573046/difference-between-numpy-linalg-lstsq-and-sklearn-linear-model-linearregression
python, numpy, scipy, scikit-learn, linear-regression
1,460,463,505
se_47434224
stackoverflow
MACHINE_LEARNING
General-linear polynomial model with python (for Output-Error model)
General-linear polynomial model with python (for Output-Error model) I need to create a general-linear polynomial model with python. And as definitions for this type of models vary I'd note that I refer to this reference by NI. I guess that Matlab's implementation is quite similar. I am particularly interested in c...
https://stackoverflow.com/questions/47434224/general-linear-polynomial-model-with-python-for-output-error-model
python, numpy, scipy, scikit-learn, statsmodels
1,511,352,114
se_78835812
stackoverflow
MACHINE_LEARNING
ROC curve *without* a model estimator?
ROC curve *without* a model estimator? I have created an AI Tool which extracts content from an image and then reviews that content for completeness and accuracy. I am trying to evaluate the performance of this tool and am gathering metrics to do so. I have a resulting table that looks similar to the below; the true v...
https://stackoverflow.com/questions/78835812/roc-curve-without-a-model-estimator
python, scikit-learn, classification, roc
1,722,880,398
se_40780033
stackoverflow
MACHINE_LEARNING
ValueError: The number of classes has to be greater than one (python)
ValueError: The number of classes has to be greater than one (python) When passing x,y in fit, I am getting the following error: Traceback (most recent call last): File "C:/Classify/classifier.py", line 95, in train_avg, test_avg, cms = train_model(X, y, "ceps", plot=True) File "C:/Classify/classifier.py"...
https://stackoverflow.com/questions/40780033/valueerror-the-number-of-classes-has-to-be-greater-than-one-python
python-2.7, scikit-learn, classification, svm
1,479,971,567
se_41125342
stackoverflow
MACHINE_LEARNING
sklearn logistic regression gives biased results?
sklearn logistic regression gives biased results? I am running around 1000 similar logistic regressions, with the same covariates but slightly different data and response variables. All of my response variables have a sparse successes (p(success) < .05 usually). I run LR as follows: I have a matrix of called “success...
https://stackoverflow.com/questions/41125342/sklearn-logistic-regression-gives-biased-results
python, scikit-learn, logistic-regression
1,481,644,692
se_78826890
stackoverflow
MACHINE_LEARNING
Value Error: y contains previously unseen labels: [8 9]
Value Error: y contains previously unseen labels: [8 9] I have a dataset, that I use label_encoding for data preprocessing before feed into the model. I first label_encoding all of my data, then split the data into training and testing. And I want to use "label_encoder.inverse_transform" to reverse the code, but it ha...
https://stackoverflow.com/questions/78826890/value-error-y-contains-previously-unseen-labels-8-9
python, scikit-learn
1,722,625,267
se_51144580
stackoverflow
MACHINE_LEARNING
Should BIC (Bayesian Information Criterion) be lower or higher
Should BIC (Bayesian Information Criterion) be lower or higher I am very confused about the BIC plots vs number of components in GMM. Python documentation is saying the lower the better but I read on some websites that the correct number of clusters is the first location of local maxima! Can anyone elaborate on that? ...
https://stackoverflow.com/questions/51144580/should-bic-bayesian-information-criterion-be-lower-or-higher
python, scikit-learn, bayesian
1,530,571,801
se_78785221
stackoverflow
MACHINE_LEARNING
ValueError when loading sklearn DecisionTreeClassifier pickle in Python 3.10
ValueError when loading sklearn DecisionTreeClassifier pickle in Python 3.10 I'm encountering an issue while transitioning from Python 3.7.3 to Python 3.10 due to the deprecation of the older version. The problem arises when attempting to load a pickled sklearn DecisionTreeClassifier model. Environment: Original: Pyth...
https://stackoverflow.com/questions/78785221/valueerror-when-loading-sklearn-decisiontreeclassifier-pickle-in-python-3-10
python, scikit-learn, pickle, version-compatibility
1,721,762,472
se_78821050
stackoverflow
MACHINE_LEARNING
Comparing specific linear regression functions in numpy, scipy, and sklearn: Differences in pre-processing and penalty functions
Comparing specific linear regression functions in numpy, scipy, and sklearn: Differences in pre-processing and penalty functions Looking at least-squares regression methods in various python libraries, and from their documentation and the two threads below (amongst others) is it right to say the following? scipy.lina...
https://stackoverflow.com/questions/78821050/comparing-specific-linear-regression-functions-in-numpy-scipy-and-sklearn-dif
python, numpy, scikit-learn, scipy, linear-regression
1,722,516,467
se_67940110
stackoverflow
MACHINE_LEARNING
Difference between Normalizer and MinMaxScaler
Difference between Normalizer and MinMaxScaler I'm trying to understand the effects of applying the Normalizer or applying MinMaxScaler or applying both in my data. I've read the docs in SKlearn, and saw some examples of use. I understand that MinMaxScaler is important (is important to scale the features), but what ab...
https://stackoverflow.com/questions/67940110/difference-between-normalizer-and-minmaxscaler
python, scikit-learn, normalization
1,623,427,100
se_67136674
stackoverflow
MACHINE_LEARNING
target scaling using GridSearchCV
target scaling using GridSearchCV For hyperparameter tuning, I use the function GridSearchCV from the Python package sklearn. Some of the models that I test require feature scaling (e.g. Support Vector Regression - SVR). Recently, in the Udemy course Machine Learning A-Z™: Hands-On Python & R In Data Science, the inst...
https://stackoverflow.com/questions/67136674/target-scaling-using-gridsearchcv
python, python-3.x, scikit-learn, svm, gridsearchcv
1,618,652,124
se_35539937
stackoverflow
MACHINE_LEARNING
Is there class weight (or alternative way) for GradientBoostingClassifier in Sklearn when dealing with VotingClassifier or Grid search?
Is there class weight (or alternative way) for GradientBoostingClassifier in Sklearn when dealing with VotingClassifier or Grid search? I'm using GradientBoostingClassifier for my unbalanced labeled datasets. It seems like class weight doesn't exist as a parameter for this classifier in Sklearn. I see I can use sample...
https://stackoverflow.com/questions/35539937/is-there-class-weight-or-alternative-way-for-gradientboostingclassifier-in-skl
scikit-learn, classification
1,456,078,416
se_74401221
stackoverflow
MACHINE_LEARNING
Performing voting for classification tasks
Performing voting for classification tasks I am wondering is it possible to do voting for classification tasks. I have seen plenty of blogs explaining how to use voting for regression purposes.As given below. # initializing all the model objects with default parameters model_1 = LinearRegression() model_2 = xgb.XGBReg...
https://stackoverflow.com/questions/74401221/performing-voting-for-classification-tasks
python, machine-learning, scikit-learn
1,668,162,898
se_78722098
stackoverflow
MACHINE_LEARNING
Python3 skglm - &#39;Poisson&#39; object has no attribute &#39;get_lipschitz&#39;
Python3 skglm - &#39;Poisson&#39; object has no attribute &#39;get_lipschitz&#39; Im working with count data and want to fit a poisson regression with a L1 norm. I have the following code which throws the error and is reproducable: import numpy as np import skglm import sklearn X = np.random.rand(100, 10) y = np.ra...
https://stackoverflow.com/questions/78722098/python3-skglm-poisson-object-has-no-attribute-get-lipschitz
python, numpy, scikit-learn
1,720,457,805
se_78816181
stackoverflow
MACHINE_LEARNING
How can I link the records in the training dataset to the corresponding model predictions?
How can I link the records in the training dataset to the corresponding model predictions? Using scikit-learn, I've set up a regression model to predict customers' maximum spend per transaction. The dataset I'm using looks a bit like this; the target column is maximum spend per transaction during the previous year: cu...
https://stackoverflow.com/questions/78816181/how-can-i-link-the-records-in-the-training-dataset-to-the-corresponding-model-pr
python, pandas, scikit-learn, regression
1,722,427,201
se_78813351
stackoverflow
MACHINE_LEARNING
How to boolean categorical processing?
How to boolean categorical processing? import pandas as pd from sklearn.impute import SimpleImputer from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler, OneHotEncoder, OrdinalEncoder from sklearn.pipeline import Pipeline data = pd.read_csv('Datasets/StudentScore.csv')...
https://stackoverflow.com/questions/78813351/how-to-boolean-categorical-processing
python, machine-learning, scikit-learn
1,722,366,738
se_67269495
stackoverflow
MACHINE_LEARNING
Choose naive bayes model for continous feature, multiple labels
Choose naive bayes model for continous feature, multiple labels Imagining I have a data set, whose feature values are continuous, and there are more than two possible labels (eg: rain, sunny, windy etc), which naive bayes model should I implement in sklearn? I am thinking about Gaussian or Multinomial. However, multin...
https://stackoverflow.com/questions/67269495/choose-naive-bayes-model-for-continous-feature-multiple-labels
python, machine-learning, scikit-learn, naivebayes
1,619,450,909
se_50825936
stackoverflow
MACHINE_LEARNING
Confusion matrix on images in CNN keras
Confusion matrix on images in CNN keras I have trained my model(multiclass classification) of CNN using keras and now I want to evaluate the model on my test set of images. What are the possible options for evaluating my model apart from the accuracy, precision and recall? I know how to get the precision and recall f...
https://stackoverflow.com/questions/50825936/confusion-matrix-on-images-in-cnn-keras
python, scikit-learn, keras, conv-neural-network
1,528,838,150
se_43377265
stackoverflow
MACHINE_LEARNING
Determine if text is in English?
Determine if text is in English? I am using both Nltk and Scikit Learn to do some text processing. However, within my list of documents I have some documents that are not in English. For example, the following could be true: [ "this is some text written in English", "this is some more text written in English", ...
https://stackoverflow.com/questions/43377265/determine-if-text-is-in-english
python, scikit-learn, nlp, nltk
1,492,022,492
se_78815010
stackoverflow
MACHINE_LEARNING
SVM most important coefficient doesn&#39;t have dependency on target class
SVM most important coefficient doesn&#39;t have dependency on target class I've trained an SVM classifier with my data, looked at the coefficients and then plotted the most important training feature against my target class. However, I found there to be no dependency ( x axis is the class, y axis is the most important...
https://stackoverflow.com/questions/78815010/svm-most-important-coefficient-doesnt-have-dependency-on-target-class
python, scikit-learn, svm
1,722,411,730
se_14254203
stackoverflow
MACHINE_LEARNING
Mixing categorial and continuous data in Naive Bayes classifier using scikit-learn
Mixing categorial and continuous data in Naive Bayes classifier using scikit-learn I'm using scikit-learn in Python to develop a classification algorithm to predict the gender of certain customers. Amongst others, I want to use the Naive Bayes classifier but my problem is that I have a mix of categorical data (ex: "Re...
https://stackoverflow.com/questions/14254203/mixing-categorial-and-continuous-data-in-naive-bayes-classifier-using-scikit-lea
python, machine-learning, data-mining, classification, scikit-learn
1,357,808,902
se_61752284
stackoverflow
MACHINE_LEARNING
Understanding sklearn&#39;s KNNImputer
Understanding sklearn&#39;s KNNImputer I was going through its documentation and it says Each sample’s missing values are imputed using the mean value from n_neighbors nearest neighbors found in the training set. Two samples are close if the features that neither are missing are close. Now, playing around with a toy...
https://stackoverflow.com/questions/61752284/understanding-sklearns-knnimputer
python, machine-learning, scikit-learn, data-science, imputation
1,589,288,089
se_73863640
stackoverflow
MACHINE_LEARNING
AttributeError: &#39;DecisionTreeClassifier&#39; object has no attribute &#39;feature_names_in_&#39;
AttributeError: &#39;DecisionTreeClassifier&#39; object has no attribute &#39;feature_names_in_&#39; I want to implement a decision tree for a dataset, and I am just a beginner in this field. But after I run the function, I get the error: AttributeError: 'DecisionTreeClassifier' object has no attribute 'feature_names...
https://stackoverflow.com/questions/73863640/attributeerror-decisiontreeclassifier-object-has-no-attribute-feature-names
python, scikit-learn
1,664,262,566
se_45250100
stackoverflow
MACHINE_LEARNING
KerasRegressor Coefficient of Determination R^2 Score
KerasRegressor Coefficient of Determination R^2 Score I'm building a small neural net in Keras meant for a regression task, and I want to use the same accuracy metric as the scikit-learn RandomForestRegressor: The coefficient R^2 is defined as (1 - u/v), where u is the regression sum of squares ((y_true - y_pred) ** ...
https://stackoverflow.com/questions/45250100/kerasregressor-coefficient-of-determination-r2-score
python, tensorflow, machine-learning, keras, scikit-learn
1,500,690,934
se_71955753
stackoverflow
MACHINE_LEARNING
Sklearn Pipelines + GridsearchCV + XGBoost + Learning Curve
Sklearn Pipelines + GridsearchCV + XGBoost + Learning Curve I am new to sklearn & XGBoost. I would like to use GridSearchCV to tune a XGBoost classifier. One of the checks that I would like to do is the graphical analysis of the loss from train and test. So far I have created the following code: # Create a new instanc...
https://stackoverflow.com/questions/71955753/sklearn-pipelines-gridsearchcv-xgboost-learning-curve
python, scikit-learn, data-science, xgboost, imbalanced-data
1,650,549,470
se_67733506
stackoverflow
MACHINE_LEARNING
Display all parameters of an estimator including defaults
Display all parameters of an estimator including defaults I am using Watson Studio and using a markdown notebook. In the notebook, I write the code: from sklearn.tree import DecisionTreeClassifier Tree_Loan= DecisionTreeClassifier(criterion="entropy", max_depth = 4) Tree_Loan and it displays DecisionTreeClassifier(c...
https://stackoverflow.com/questions/67733506/display-all-parameters-of-an-estimator-including-defaults
python, scikit-learn
1,622,180,916
se_78801772
stackoverflow
MACHINE_LEARNING
How can I preprocess a feature that contains a list of number codes?
How can I preprocess a feature that contains a list of number codes? I have to preprocess a feature which is basically a list of number codes enocoded as a string, and I want to encode it such that the output is an array of frequencies of each of these numbers. The features should also be preprocessed by imputing miss...
https://stackoverflow.com/questions/78801772/how-can-i-preprocess-a-feature-that-contains-a-list-of-number-codes
machine-learning, scikit-learn, classification, multilabel-classification, data-preprocessing
1,722,094,218
se_69429691
stackoverflow
MACHINE_LEARNING
GridSearchCV not choosing the best hyperparameters for xgboost
GridSearchCV not choosing the best hyperparameters for xgboost I am developing a regression model with xgboost. Since xgboost has multiple hyperparameters, I have added the cross validation logic with GridSearchCV(). As a trial, I set max_depth: [2,3]. My python code is as below. from sklearn.model_selection import Gr...
https://stackoverflow.com/questions/69429691/gridsearchcv-not-choosing-the-best-hyperparameters-for-xgboost
python, machine-learning, scikit-learn, xgboost
1,633,304,755
se_77909073
stackoverflow
MACHINE_LEARNING
Randomisation behaviour after cloning and fitting RandomizedSearchCV
Randomisation behaviour after cloning and fitting RandomizedSearchCV I have a basic nested CV loop, where an outer loop goes over an inner model-tuning step. My expectation is that each fold should draw a different random sample of hyperparameter values. However, in the example below, each fold ends up sampling the sa...
https://stackoverflow.com/questions/77909073/randomisation-behaviour-after-cloning-and-fitting-randomizedsearchcv
scikit-learn, cross-validation, random-seed
1,706,644,388
se_31909945
stackoverflow
MACHINE_LEARNING
Obtain eigen values and vectors from sklearn PCA
Obtain eigen values and vectors from sklearn PCA How I can get the the eigen values and eigen vectors of the PCA application? from sklearn.decomposition import PCA clf=PCA(0.98,whiten=True) #converse 98% variance X_train=clf.fit_transform(X_train) X_test=clf.transform(X_test) I can't find it in docs. 1.I am ...
https://stackoverflow.com/questions/31909945/obtain-eigen-values-and-vectors-from-sklearn-pca
python, scipy, scikit-learn, pca
1,439,164,287
se_78796671
stackoverflow
MACHINE_LEARNING
min_samples_leaf in GradientBoostedClassifier() having weird behavior
min_samples_leaf in GradientBoostedClassifier() having weird behavior Trying to tune the min_samples_leaf in a GradientBoostedClassifer(). I'm seeing expected results with the bias/variance tradeoff. However, just to test the boundaries, I made the min_samples_leaf > n_samples in the training dataset, expecting an err...
https://stackoverflow.com/questions/78796671/min-samples-leaf-in-gradientboostedclassifier-having-weird-behavior
python, machine-learning, scikit-learn, tree
1,721,977,530
se_77573670
stackoverflow
MACHINE_LEARNING
How do I use Sagemaker HyperparameterTuner on a SKLearn Estimator?
How do I use Sagemaker HyperparameterTuner on a SKLearn Estimator? I'm following an Amazon Sagemaker workshop to try and leverage several of Sagemaker's utilities instead of running everything off a Notebook as I'm currently doing. The thing is, in the workshop they teach you how to use HyperparameterTuner using the r...
https://stackoverflow.com/questions/77573670/how-do-i-use-sagemaker-hyperparametertuner-on-a-sklearn-estimator
amazon-web-services, machine-learning, scikit-learn, amazon-sagemaker, hyperparameters
1,701,282,433
se_44234682
stackoverflow
MACHINE_LEARNING
how to use sklearn when target variable is a proportion
how to use sklearn when target variable is a proportion There are standard ways of predicting proportions such as logistic regression (without thresholding) and beta regression. There have already been discussions about this: http://scikit-learn-general.narkive.com/4dSCktaM/using-logistic-regression-on-a-continuous-t...
https://stackoverflow.com/questions/44234682/how-to-use-sklearn-when-target-variable-is-a-proportion
python, scikit-learn
1,496,032,728