Found input variables with inconsistent numbers of samples

0 votes

Hi All,

I am implementing linear regression by Extract the rating as to your target variable ‘y’ and all numerical parameters as your predictors ‘x’. Please find the below steps taken by me
read the CSV into data frame df
extracted 'rating' into y

y=df['rating'].values
df_1=df
df_1.drop(['name','mfr','type','ManufacturerFullName'], axis=1, inplace=True)
df_1.drop(['rating'], axis=1, inplace=True)
x=df_1.values
from sklearn.model_selection import train_test_split
x_train, y_train, x_test, y_test=train_test_split(x,y_rating,test_size=0.75)
from sklearn.linear_model import LinearRegression
model=LinearRegression()
model.fit(x_train,y_train)
Jul 12, 2020 in Machine Learning by sagar
• 120 points

edited Jul 13, 2020 by MD 5,301 views

1 answer to this question.

0 votes

Hi@sagar,

You have converted your Dataframe into an array. You don't need to do this. In your code, you don't have y_rating. But you used this variable. I suggest you first, design your model in your mind what you want. If you will get the same issue, then paste your full code along with the error.

answered Jul 13, 2020 by MD
• 95,460 points

Related Questions In Machine Learning

0 votes
2 answers
0 votes
0 answers

ValueError: Found input variables with inconsistent numbers of samples: [11, 3988]

After reshaping also I am getting the ...READ MORE

Aug 27, 2020 in Machine Learning by sairam
• 160 points

edited Aug 27, 2020 by MD 5,307 views
0 votes
1 answer

ValueError: Found input variables with inconsistent numbers of samples: [616, 308]

Hi@Alshwarya, I think there is a problem with your ...READ MORE

answered Sep 23, 2020 in Machine Learning by MD
• 95,460 points
4,279 views
0 votes
1 answer
0 votes
1 answer

Use different distance formula other than euclidean distance in k means

K-means is based on variance minimization. The sum-of-variance formula ...READ MORE

answered Jun 21, 2018 in Data Analytics by Sahiti
• 6,370 points
1,647 views
0 votes
1 answer

Overfitting vs Underfitting

In statistics and machine learning, one of ...READ MORE

answered Jul 11, 2018 in Data Analytics by CodingByHeart77
• 3,750 points
1,182 views
+1 vote
1 answer

How to handle Nominal Data?

Nominal data is basically data which can ...READ MORE

answered Jul 24, 2018 in Data Analytics by Abhi
• 3,720 points
646 views
+2 votes
2 answers

How to handle outliers

There are multiple ways to handle outliers ...READ MORE

answered Jul 24, 2018 in Data Analytics by Abhi
• 3,720 points
946 views
+1 vote
2 answers

ValueError: Found input variables with inconsistent numbers of samples: [1, 1000]

Hi@akhtar, Here you used x as your feature ...READ MORE

answered Apr 14, 2020 in Machine Learning by MD
• 95,460 points

edited Aug 11, 2021 by Soumya 57,911 views
0 votes
1 answer

problem with Found input variables with inconsistent numbers of samples: [1204, 134]

Hi@Alessandro, Here you used x as your feature parameter ...READ MORE

answered Jul 20, 2020 in Machine Learning by MD
• 95,460 points
5,144 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP