I am trying to create one Machine Learning model using LinearRegression model but I am getting the below error

0 votes

 training data (input and output) for Measuring temperature using crickets

x_train =[44.000,46.400,43.600,35.000,35.000,32.600,28.900,27.700,25.500,20.375,12.500,37.000,37.500,36.500,36.200] #Cricket Chirp per 1

y_train =[80.500,78.500,78.000,73.500,70.500,68.000,66.000,65.000,61.500,57.000,55.000,76.250,74.000,74.000,72.500]  # Temp in F

 Training based on training data (input and output) for Measuring temperature using crickets

x=x_train

y=y_train

opt = np.polyfit(x, y, 1)

y_pred = int(opt[0]) * x + opt[1]

opt_rmse = math.sqrt(metrics.mean_squared_error(y_pred, y))

slope = opt[0]

bias = opt[1]

#print("y_pred", y_pred, "y ", y)

print("Optimal Training RMSE =", opt_rmse, "for solution", opt)

the error is

ValueError: Found input variables with inconsistent numbers of samples: [0, 15]

Sep 2, 2021 in Machine Learning by anonymous

edited Mar 4, 2025 369 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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