All Questions
416 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 ...
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 ...
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 ...
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 = ...
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 ...
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....
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 ...
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 ...
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'],
'...
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, ...
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 ...
-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'
...
-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 ...
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
...
-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 ...