I posted another one, but changed the code, and cant show everything.
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
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)
AIMPED
3
Hi @topotaman ,
IMHO you should post your question on stackoverflow, this is not related to plotly or dash.
Hello topotaman
Did you took a look the examples in the documentation?