Skip to main content

All Questions

0 votes
1 answer
42 views

Error get_features_name_out in getting back the feature name

I want to know the feature importance to my data, so I use permutation_importance. When I get the result, it seems the feature already decoded, and I want to know the name of my feauture using ...
statsbeginner's user avatar
0 votes
0 answers
69 views

How can I use sample weights with Sklearn SimpleImputer?

When imputing the na's inside of a pipeline that is fed into GridSearchCV, I would like to have each fold's na's imputed with the weighted mean. SimpleImputer can do it with the unweighted means, but ...
user26328351's user avatar
2 votes
0 answers
106 views

How to resolve TypeError: 'numpy.float64' object is not callable when calculating r2_score?

I am encountering the following error: TypeError: 'numpy.float64' object is not callable when I try to calculate the R2 score using scikit-learn's r2_score function. Below is the relevant portion of ...
Ayush Surve's user avatar
0 votes
1 answer
234 views

Difference between predict() and predict_proba() functions in scikit learn

Greetings data science community! How's going? So, I'm studying classification Tree and scikit-learning and during my studyings i come across this "issue": After training a tree (clf = ...
EduMinsky's user avatar
0 votes
2 answers
382 views

ValueError: Need 2 classes but I have 0

I need two classes but I have just one class so I got ValueError: For Logistic Regression to understand, I converted string data types to integer data type. While there are Abnormal and Normal string ...
fuzexe's user avatar
  • 1
3 votes
2 answers
705 views

How do I drop and change dtype in a Pipeline with sklearn?

I have some scraped data that needs some cleaning. After the cleaning, I want to create a "numerical and categorical pipelines" inside a ColumnTransformer such as: categorical_cols = df....
Odiseon's user avatar
  • 43
1 vote
1 answer
37 views

'Vect' not defined sklearn logistic regression error message

So I have this pipeline i used for a text classifier that works fine. from sklearn.feature_extraction.text import TfidfTransformer from sklearn.feature_extraction.text import CountVectorizer from ...
Barri's user avatar
  • 44
0 votes
1 answer
124 views

Is it possible to have Dask return a default value if a delayed object uses too much memory?

Is it possible to have Dask return a default value if a delayed object uses too much memory? I want to evaluate a list of machine learning pipelines on large datasets in parallel. I am doing this in a ...
Zechiel's user avatar
1 vote
1 answer
45 views

What object is a sklearn.pipeline.Pipeline that applies a ColumnTransformer actually fitting on when fit(X, Y) is called on it

I am trying to get an idea of the inner workings of a scikit learn Pipeline. Consider the below data set and pipeline construction. data = pd.DataFrame({ 'Name': ['Alice', 'Bob', 'Charlie'], '...
gebruiker's user avatar
  • 117
0 votes
1 answer
125 views

Cross_val_score returns huge numbers

Ln = LinearRegression() Ln.fit(X_train, y_train) print(np.mean(cross_val_score(Ln, X_train, y_train, scoring= "neg_mean_absolute_error", cv= 2))) The results I get back are huge numbers, ...
Who_amI's user avatar
  • 11
0 votes
0 answers
74 views

Counting circular and square stars in numpy array

SOLVED (by @AaronKeesing) If the goal is to predict numeric values, linear regression should be applied. But instead I went with logistic regression for binary classification. The exercise is stated ...
Husted42's user avatar
-1 votes
1 answer
61 views

i want to fit a model in sklearn but it throws an error. below are the lines of code i used

I used the lines of code below to fit a model in sklearn. linearmodel =LinearRegression() linearmodel.fit(x_train, y_train) but I get this error: ValueError: could not convert string to float: 'Male' ...
Hanatu's user avatar
  • 3
-1 votes
1 answer
966 views

Scikit Learn KernelDensity and GridSearchCV

I am new to data science and doing a project about Kernel Density Estimation, specifically about finding the best bandwidth and kernel function to use. I want to use Scikit Learn's KernelDensity which ...
Liel's user avatar
  • 49
0 votes
1 answer
453 views

how to build a custom scaler with sklearn standard scaler

i wanted to only standardize my non dummy columns and i used this code to solve my problem : from sklearn.base import BaseEstimator, TransformerMixin from sklearn.preprocessing import StandardScaler ...
sowfi's user avatar
  • 1
-1 votes
1 answer
464 views

Polynomial Features Error: X has 10 features, but PolynomialFeatures is expecting 9 features as input

Today i'm modeling a dataframe using PolinomialFeatures from sklearn but I keep encountering this error: ValueError: X has 10 features, but PolynomialFeatures is expecting 9 features as input. Coming ...
Daniel Martinez's user avatar

15 30 50 per page
1
2 3 4 5
28