1
$\begingroup$

I am analyzing the avocado dataset to predict the future prices of avocado depending on the region and type (organic/conventional).

I've trained my model which seems to be working. The test results look good.

Here is what my data looks like after processing: the date (which I turned into the index column), total volume, type (label encoded to 1s and 0s), and 54 columns for the 54 regions that I one-hot encoded.

However, I'm not sure how to generate data for future prediction given specific X feature values. Basically I want the end user to provide a (future) date, a type, a region, and my model would predict the price of the avocado. For example, I want to predict the price of organic avocado for Albany in 3 months. I know that my model could forecast for a certain date, based on the prices of the past date. But how would it work when I assign the region and type feature to a specific value? Is it even feasible? Should I be using another model? I know that I could train a LSTM model for each of the 54 regions, but I'm sure there is a better way...

Sorry if this is a trivial question, I'm a beginner and I've been stuck on this for days and would really appreciate any help/guidance!

$\endgroup$

1 Answer 1

0
$\begingroup$

I'm not really sure if I understood you correctly, but let's talk about it.

You are trying to predict only one value, that is price, right? And what is your feature set? is it only date, type and region?

Remember, to predict a value you should always have known feature set. If you have a feature that is not known, then this is not the right way to do it.

What you can also do is, predict multiple values. Not sure if this is helpful in your case, but you can use something like MultiOutputRegressor to predict multiple times based on a model. So you can have date, type and region as features and predict anything else that is missing. Be aware though that this would usually reduce the prediction accuracy.

See here: sklearn.MultiOutputRegressor

So if you want to predict for future dates, based on previous dates. You can either have feature sets of one month data, and always predict for the next one month. So you have a feature set of 30 days, and you predict 30 times, for each days in the future.

Or you can predict only for one day, and train with your predicted data, then predict the next day and so on. So one by one.

You should try both of these ways to see which one would give you a better results.

Hope these helps.

$\endgroup$
2
  • $\begingroup$ Thanks for helping out and sorry for being unclear. Yes I am trying to predict only the price. Given a date, I don't want the model to predict the other two features, since I want to assign the region and type myself. It sounds like the MultiOutputRegressor will do the job. I will look into it. Thanks so much! $\endgroup$
    – IngridX
    Jul 31, 2019 at 16:05
  • $\begingroup$ Yes in that case MultiOutputRegressor might be the way to go. Try it out. And if it was helpful choose my reply as answer :) $\endgroup$ Jul 31, 2019 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.