I can't show the complete code.
this is where the problem is:
model.fit(X_train, y_train)
x_range = np.linspace(df[drop1].min(),df[drop1].max(), 100)
print("xrangeshape",x_range)
print("xrange",np.shape(x_range))
x_range=x_range.squeeze()
print("xrangereshaped",np.shape(x_range))
y_range = model.predict(x_range.reshape(100,2))
print("yrange",y_range)
print("yrange",np.shape(y_range))
y_range=np.array(y_range).squeeze()
print("yrangereshaped",np.shape(y_range))
print("yrange",y_range)
that results in this:
xrange (100, 2)
xrangereshaped (100, 2)
yrange (100, 2)
yrangereshaped (100, 2)
what can I do to fix this? it doesnt give errors, but the image doesnt show propperly. After some time ... I tried this ... but still get errors
I chagned some things … (just guessing:…) and got this error:
ValueError: X has 1 features, but LinearRegression is expecting 2 features as input.
this is what I changed:
x_range = np.linspace(df[drop1].min(),df[drop1].max(), 100)
print("xrangeshape",x_range)
print("xrange",np.shape(x_range))
x_range=x_range.squeeze()
x_range=x_range.reshape(200,1)
print("xrangereshaped",np.shape(x_range))
y_range = model.predict(x_range.reshape(-200,1))
print("yrange",y_range)
print("yrange",np.shape(y_range))
y_range=np.array(y_range).squeeze()
print("yrangereshaped",np.shape(y_range))
print("yrange",y_range)
What needs to be done to make it work?