I am working with linear regression (SKlearn) and when predicting a value I am getting an error. I'm not sure what to do and have tried switching up the format in which I input the prediction value but so far I have drawn a blank.
Here's my code:
import pandas as pd import numpy as np from sklearn.linear_model import LinearRegression data = pd.read_csv("data.csv") print(data.head()) X = data['Machine Age (Months)'].values y = data['Mean Time Between Failure (Days)'].values X.shape # (30,) y.shape # (30,) X = [X] y = [y] model = LinearRegression() model.fit(X,y) prediction = model.predict([[30]]) when running this code i get this error:
matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)->(n?,m?) (size 30 is different from 1) here's the data I'm importing (i made it a CSV file)
https://drive.google.com/file/d/10fEjJj2znOmRufq3cFuc0CB_t2HAgudI/view?usp=sharing
any help would be appreciated :)
y = [y]ValueError: Found input variables with inconsistent numbers of samples: [1, 30]