Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
22 views

Snowflake/ Snowpark "import sklearn" results in "no module found."

I'm using a python worksheet in Snowflake. When I got to information_schema.packages, scikit-learn is clearly there and installed. But when I reference 'sklearn' (don't really understand where this ...
user45867's user avatar
  • 951
0 votes
0 answers
17 views

How to solve ERROR: daal4py 2021.5.0 requires daal==2021.4.0, which is not installed?

I try to install sklearn package and getting the warning below: > File D:\ANACONDA\envs\TenserFlow\lib\site-packages\scipy\sparse\linalg\_svdp.py:24 from ._propack import _spropack # ...
Sutthida's user avatar
0 votes
1 answer
24 views

InconsistentVersionWarning: Trying to unpickle estimator StandardScaler from version 1.2.2 when using version 1.3.2

I am trying to train a machine learning model which uses the PowerTransformer from scikit-learn to transform my training data. And here is my code: from sklearn import preprocessing from sklearn....
Nayr borcherds's user avatar
0 votes
1 answer
16 views

how to setup sklearn in Spyder?

I am trying to use sklearn in Spyder, but I get error: ModuleNotFoundError: No module named 'sklearn' then I try to pip install sklearn, but I get No module named pip How to resolve this issue?
mitra yoonessi's user avatar
3 votes
1 answer
59 views

PartialDependenceDisplay.from_estimator plots having lines with 0 values

Need to evaluate the two way interaction between two variables after regressor model. Used PartialDependenceDisplay.from_estimator to plot but the contour lines inside the plot all have value 0.Not ...
new world's user avatar
2 votes
2 answers
51 views

ClassifierChain with Random Forest: Why is np.nan not supported even though Base Estimator handles it?

I'm working on a multilabel classification problem using the ClassifierChain approach with RandomForestClassifier as the base estimator. I've encountered an issue where my input matrix X contains np....
BSalvatori's user avatar
0 votes
0 answers
28 views

Problem of assigning different indexes to different unseen labels in Pyspark and Scikit-learn

I wonder if there is any algorithm or method to assign different indexes to different unseen labels, and therefore, addressing the 'cold problem' properly. For example if I use the following Pyspark ...
Ivan's user avatar
  • 126
0 votes
1 answer
32 views

Loading a pipeline with a dense-array conversion step

I trained and saved the following model using joblib: def to_dense(x): return np.asarray(x.todense()) to_dense_array = FunctionTransformer(to_dense, accept_sparse=True) model = make_pipeline( ...
JCF's user avatar
  • 309
0 votes
1 answer
42 views

Simulating scikit-learn's OneHotEncoder mixed data type error

My focus is on the caveat mentioned in OneHotEncoder's list parameter doc. list : categories[i] holds the categories expected in the ith column. The passed categories should not mix strings and ...
akalanka's user avatar
  • 595
-4 votes
0 answers
24 views

Challenges in Combining Speech, Facial Expression, and Text Data for Real-Time Mental Health Monitoring [closed]

Optimizing Real-Time Multimodal Data Integration and Machine Learning in a Mental Health App I am currently working on a college project to build an app from scratch called WellnessWave, which ...
Arya Joshi's user avatar
0 votes
1 answer
47 views

Can I force sklearn to use float32 instead of float64?

I am building a product recommender that will use the description of products to find similar products and recommend them. I am using CountVectorizer over the description to find semantically similar ...
JLd's user avatar
  • 25
1 vote
1 answer
43 views

Is it possible to transform a target variable using `ravel()` or `to_numpy()` in a `sklearn` pipeline?

I am using RStudio and tidymodels in an R markdown document. I would like to incorporate some models from scikit-learn. Getting data from the R code chunks to the Python code chunk works well, but ...
JonasEngstrom's user avatar
0 votes
0 answers
21 views

sklearn SVR taking LESS time for MORE samples

I am using an sklearn.svm.SVR for a time-series regression problem, cross-validating via TimeSeriesSplit: svr = make_pipeline( PandasSimpleImputer(strategy="constant", fill_value=0), ...
user27190899's user avatar
1 vote
1 answer
30 views

Importing a Model with Scikit Learn on Vertex

I'm trying to import a model from my local but everytime I get the same error from gcp logs. The framework is scikit-learn AttributeError: Can't get attribute 'preprocess_text' on <module '...
VertexEnjoyer's user avatar
-1 votes
0 answers
18 views

hyperopt parameter optimization: can't reproduce result

Is it correct to expect a set of hyperopt best parameters to give you the same eval metric result when you plug them back into the model? Or do I misunderstand how it works? Here is my hyperopt code: ...
user avatar
-1 votes
1 answer
51 views

Is there a way to use SciPy's differential evolution, or another library, to minimize one of a multi-output regressor's outs and bound the others?

I am using a simple RandomForestRegressor from sklearn to predict 3 outputs, and it works well. The problem is that I now need to optimize one of the outputs to be as low as possible, while ensuring ...
ddurkee's user avatar
1 vote
0 answers
44 views

Using StratifiedGroupKFold in StackingClassifier

How to specify StratifiedGroupKFold within StackingClassifier in sklearn? from sklearn.datasets import load_iris from sklearn.ensemble import RandomForestClassifier from sklearn.svm import NuSVC from ...
abhivij's user avatar
  • 107
0 votes
1 answer
162 views

How do I convert string data to numerical data using Label Encoder?

I was trying to convert string data into numerical data in a CSV excel sheet. It kept giving me an error about previously unseen labels, so I searched it up and found that we can use Label Encoder to ...
Kevin Phillips's user avatar
0 votes
0 answers
49 views

Reconciling disparity between test-accuracy and confusion matrix in tensorflow

Update: it's definitely something going on with the the predict function using a custom generator. When I fetch all the test data in one batch and run predictions on it, then create a confusion matrix ...
Dawson Kimyon's user avatar
0 votes
0 answers
48 views

Discrepancy between the training loss in the history object, and the loss calculated with mean_squared_error() from sklearn.metrics

I'm using Keras to train a model in Google Colab. During training, I achieve high performance with a small mean absolute error (MAE) as shown by the training metrics. However, when I use model.predict(...
math enthusiastic's user avatar
1 vote
1 answer
60 views

Apply Scaler() on each ID on polars dataframe

I have a dataset with multiple columns and an ID column. Each ID can have different magnitudes and varying sizes across these columns. I want to normalize the columns for each ID separately. import ...
Simon's user avatar
  • 695
0 votes
2 answers
54 views

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 ...
ConorC's user avatar
  • 3
1 vote
2 answers
106 views

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....
Simon's user avatar
  • 695
0 votes
0 answers
22 views

ImportError: cannot import name 'cpu_count' from 'joblib.externals.loky' (unknown location)

I am attempting to add a column that represents the similarity of two segments of text based on where they are located in embedding space, using the openai library to embed text. import openai import ...
PineappleThursday's user avatar
0 votes
3 answers
61 views

What does `fit_transform` do in the context of Scikit Learn PCA?

I don't understand what fit_transform does compared to fit in the context of Scikit Learn and PCA. https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.PCA.html# PCA takes some ...
user2138149's user avatar
  • 15.4k
0 votes
0 answers
16 views

Is it possible to recreate a decision tree model from known fitted parameters (table with nodes)?

I want to recreate the decision tree model based on the published already trained decision tree graph (known parameters are children_left, right, feature, threshold, values, impurity, ...
Kate Akhmad's user avatar
0 votes
1 answer
28 views

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 ...
BigBossRob's user avatar
0 votes
0 answers
21 views

create a model to predict the correct outcome for each record in the vendor data. whether to link it to an existing company or to create a new

Built an intelligent model capable of predicting the correct outcome for each record in the vendor dataset—whether to link it to an existing company or to create a new entry. Additionally, for records ...
Avinash Singh's user avatar
1 vote
0 answers
48 views

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, ...
snoisia's user avatar
  • 11
1 vote
0 answers
23 views

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?...
Aart's user avatar
  • 55
1 vote
2 answers
35 views

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....
user15346221's user avatar
0 votes
0 answers
28 views

grid search with scikit learn is not using the configured logger when n_jobs set

I'm trying to do gridsearch using scikit learn. I want to speed up the gridsearch so I set n_jobs to -1 and set parallel_backend context to loky. But when I use multiprocessing, all the logs from ...
bhagath's user avatar
0 votes
1 answer
103 views

Installing old version of scikit-learn: ModuleNotFoundError: No module named 'numpy' [duplicate]

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 ...
Justin's user avatar
  • 700
0 votes
1 answer
32 views

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 ...
Harshad's user avatar
0 votes
0 answers
37 views

Training Kernel Ridge Regression with subsets of features contributing to the final target

I'm working on a machine learning problem using Kernel Ridge Regression (KRR) in Python with scikit-learn. My goal is to train a kernel where subsets of features contribute to the target prediction. ...
Keepmining's user avatar
-2 votes
0 answers
37 views

Strange behavior with bagging classifier

Apparently, there are 2 ways of doing bagging with hyperparameter tuning. In the first approach, we pass the tuning GridsearchCV as base estimator in the BaggingRegressor. Here you can clearly see ...
Laxmiprasad Iyer's user avatar
-1 votes
0 answers
29 views

KNN imputation model returns "nan" value for all missing value cells instead of categories in categorical column

In the data preprocessing step, I use KNN imputation model to fill in imputer for missing value in categorical columns. However, my code imputes value 'nan' in all the missing value cell instead of ...
Minh Phan's user avatar
-1 votes
1 answer
41 views

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 ...
Hardik Trivedi's user avatar
0 votes
1 answer
31 views

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, ...
Petre's user avatar
  • 3
1 vote
2 answers
47 views

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-...
Mikhail Genkin's user avatar
1 vote
0 answers
69 views

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 ...
Simon's user avatar
  • 695
1 vote
1 answer
30 views

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,:] ...
Josh Willis's user avatar
0 votes
0 answers
41 views

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 ...
Álvaro Méndez Civieta's user avatar
2 votes
1 answer
47 views

Persistent Issue Importing KerasClassifier

I’ve been facing a persistent issue with importing the KerasClassifier library in my Python environment, and I’m hoping to get some advice on how to resolve it. I keep encountering an intermittent ...
Zineb Boussedra's user avatar
-1 votes
1 answer
46 views

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: ...
Cleber Souza's user avatar
0 votes
1 answer
29 views

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 ...
Ivo's user avatar
  • 1
-1 votes
1 answer
65 views

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....
youtube's user avatar
  • 406
-1 votes
0 answers
24 views

Does support in Sklearn's classification_report mean occurences within original dataset or the dataset fed into the model? [duplicate]

I implemented a machine learning model; to gain some information about the performance of the model, I looked at its classification_report from sklearn.metrics. For example, here is my classification ...
user167433's user avatar
-2 votes
1 answer
28 views

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 ...
Heet Shah's user avatar
0 votes
2 answers
32 views

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 cloned ...
a_guest's user avatar
  • 35.9k

1
2 3 4 5
567