[scikit-learn] Question regarding regression models
serafim loukas
seralouk at hotmail.com
Thu Jun 11 09:53:08 EDT 2020
Hi Kelden,
I answered your SO question but for the record this is what happens:
date_index is a scalar and you type date_index.columns which raises the error.
So you just need this:
def predict_price(dates,price):
date_index = np.where(date_format.columns == dates)[0][0]
x = np.zeros(len(date_format.columns))
if date_index >= 0:
x[date_index] = 1
return prediction.predict([x])[0]
predict_price('Feb 20, 2018', 1000)
Bests,
Makis
On 11 Jun 2020, at 15:12, Kelden Dorji <keldendraduldorji at gmail.com<mailto:keldendraduldorji at gmail.com>> wrote:
Hi scikit-learn,
I have a question related to regression models. Please find my question in the link below. I am still new to this and would appreciate any help. Thank you and have a nice day!
https://stackoverflow.com/questions/62325079/issues-with-regression-model-giving-inverse-relationship
Kelden Dradul Dorji
_______________________________________________
scikit-learn mailing list
scikit-learn at python.org
https://mail.python.org/mailman/listinfo/scikit-learn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20200611/a1874616/attachment.html>
More information about the scikit-learn
mailing list