facebook / prophet

Tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth.
https://facebook.github.io/prophet
MIT License
18.51k stars 4.53k forks source link

Set a certain value of a parameter in the future time series for Prophet #687

Closed FancyPandaSoftworks closed 6 years ago

FancyPandaSoftworks commented 6 years ago

So recently I am experimenting with Prophet, a time-series analysis.

My data is transaction data, so you have the days, date, product name, product type, the price, original price and discount.

I am able to predict the sales of the data, but now I am wondering whether it is possible to determine the sales of the product when I let's say, put the discount value for the product to 20% only for the next following month.

Multiple discount values are used over the course of years, and now I want to test with the discount value to determine the best discount value for next month.

Since the dataset for Prophet is y,ds I am not sure whether I can use Prophet for these kinds of analysis.

This is (a part of) my current code to create a prophet plot:

#forecast is my prophet dataframe with 2 variables: ds and y.
m <- prophet(forecast)

#Future dataframe for 30 days
future <- make_future_dataframe(m, periods = 30)

#Dataframe with predicted values
forecasting <- predict(m, future)

#How can I set my discount value so Prophet takes it into account for future 
prediction
#Todo

#PLot the time series analysis
dyplot.prophet(m, forecasting)

Any suggestions how the model can predict based on (for this time:) the given discount value?

nelsonauner commented 6 years ago

Prophet only uses timestamps as a predictor. I'd recommend taking the output prediction of prophet and putting that into another model, like scikit-learn or statsmodels

FancyPandaSoftworks commented 6 years ago

Hey there,

I checked these models and I realize they are python codes.

Since I have never coded in Python, it would take too much time now to learn it.

Do you have any recommendation to do this in R?

Nelson Auner notifications@github.com 於 2018年9月25日 週二 02:07 寫道:

Prophet only uses timestamps as a predictor. I'd recommend taking the output prediction of prophet and putting that into another model, like scikit-learn or statsmodels

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/facebook/prophet/issues/687#issuecomment-424164933, or mute the thread https://github.com/notifications/unsubscribe-auth/APJIFNsm14i4ubm45h9Ykjti8jtzUCxvks5ueXPZgaJpZM4W3cTt .

ghost commented 6 years ago

This would be possible, although I have my reservations. If you have a time-independent business, and the timing of the discount doesn't really matter, then you shouldn't use Prophet to predict the amount of sales. In that case, you're dealing with a regression problem and I'd recommend something else (RF, etc.).

But if you have a time-dependency on the amount of sales due to varying discounts (e.g. Black Friday) Prophet would be able to predict the amount of sales. See the tutorial (Sales equals #hits on Wikipedia): https://facebook.github.io/prophet/docs/quick_start.html

I'd recommend first to evaluate the predictability of the amount of sales dependent on the discount with classic regression. The time-part (Prophet) comes later.

FancyPandaSoftworks commented 6 years ago

This would be possible, although I have my reservations. If you have a time-independent business, and the timing of the discount doesn't really matter, then you shouldn't use Prophet to predict the amount of sales. In that case, you're dealing with a regression problem and I'd recommend something else (RF, etc.).

But if you have a time-dependency on the amount of sales due to varying discounts (e.g. Black Friday) Prophet would be able to predict the amount of sales. See the tutorial (Sales equals #hits on Wikipedia): https://facebook.github.io/prophet/docs/quick_start.html

I'd recommend first to evaluate the predictability of the amount of sales dependent on the discount with classic regression. The time-part (Prophet) comes later.

Hey,

Since all retails would have discounts during the whole year, so I want to focus on that. This is why I need datetime, month and day(Monday, Tuesday) included so I can determine the optimal sales.

Do you mean use RF first to look whether discount impacts amount of sales, and then look at other time based variable?

ghost commented 6 years ago

Do you mean use RF first to look whether discount impacts amount of sales, and then look at other time based variable?

Yes, that's what I meant.

nelsonauner commented 6 years ago

@FancyPandaSoftworks Check out Stack Overflow, like https://stats.stackexchange.com/questions/313851/time-series-forecasting-in-r

There's several questions that do exactly what you're asking. If you have questions, try to find an R mentor or post on Stack Overflows.