Comments (27)
I hadn't seen dygraphs
! Looks neat. Let's get this into the 0.2 release.
from prophet.
@lgaliano Familiar with plotly. Good for quickly converting ggplot2 to JavaScript. For a built-in function like this it might as well be written natively in a JavaScript format.
from prophet.
@wjhrdy We can also use dyEvent
for marking change points.
from prophet.
@jaredlander , @seanjtaylor Not sure if you noticed, but plot(m, forecast)
works directly with plotly, so you could also do ggplotly(plot(m, forecast))
if you were looking for interactivity (but prophet_plot_components(m, forecast)
won't work without a few changes to generate the components with facet_grid()
)
from prophet.
To produce interactive forecasts, I have been working on Prophetly to integrate Prophet with Plotly.
It's currently in development phase, but I would be happy to have some feedback and discussion.
from prophet.
Great! Be sure to make it on the v0.2 branch.
from prophet.
For Python, I would expect Plotly to be the best choice for interactive plots. I did a plot of the forecast here: https://nbviewer.jupyter.org/gist/Olof-Hojvall/d5cbbfdab8f69ce26e11a46750104158 I tried to follow the design of the existing forecast plots.
Would this be an interesting solution @bletham ? If so I could make a PR for it.
from prophet.
@mkrasmus I think the issue is that it looks like you included the period at the end of the sentence as part of the command. If you just do
dyplot.prophet(m, forecast)
(no period at the end) it should work.
from prophet.
It's a really cool package. All of these htmlwidgets
packages do some great stuff and really extend our viz capabilities.
from prophet.
I also find it very useful to add shaded regions for the holidays.
This can be accomplished with this code:
for (i in 1:nrow(holidays)) {
dyBase <- dyBase %>% dyShading(from = holidays$ds[i] + holidays$lower_window[i],
to = holidays$ds[i] + holidays$upper_window[i])
dyBase <- dyBase %>% presAnnotation(holidays$ds[i], text = holidays$holiday[i])
}
from prophet.
@seanjtaylor Adding dygraphs would be great, looking forward to it in 0.2. Thanks!
from prophet.
Plotly is also a great alternative for interactive graphs, and is both available in R and Python...
from prophet.
df_for_plotting ??
from prophet.
@GanJianhao that's an internal prophet
function.
from prophet.
The v0.2 release is coming up soon, and this will need a PR to make it in. Anyone interested?
I think we'd want to pull the ggplot / dygraphs / plotly / ... code out of prophet.R into their own files so as to not clutter prophet.R with a dozen different plotting functions (almost there as is).
from prophet.
I'll make a pull request. I think this is a really useful way to explore regressors and features in your data.
from prophet.
Sorry I didn't make it into v0.2 here is the pull request: #320
from prophet.
Thanks to @wjhrdy for the PR! This is now in the v0.3 branch and can be used like
dyplot.prophet(m, forecast)
With time we can add component plots in dygraphs also, so I'll leave this issue open for that.
from prophet.
The dygraphs plot of the forecast is now available in v0.3, so I'll go ahead and close this and we can open a new issue if we want to expand dygraph plotting to components plots in the future.
from prophet.
Is dyplot.prophet(m,forecast) supported in R only? I tried this in python and it doesn't work for me.
from prophet.
It is in R only, I didn't realize there was a python interface to dygraphs. Re-opening, if anyone would like to translate what was done in R (https://github.com/facebook/prophet/blob/master/R/R/plot.R#L391) into Python that would be extremely helpful.
from prophet.
@Olof-Hojvall that sounds great, I've been using plotly for some other stuff and it's been working very nicely there. I'd definitely merge that.
from prophet.
Documented in 4e5e223
from prophet.
Hi - apologies if this question doesn't fit in here - I am just wondering if there is a way to share the interactive dygraph (after saving it as an local html file) to someone else (with no R or Python on their machines) in the organisation?
Thanks,
Seeker
from prophet.
Hi - apologies if this question doesn't fit in here - I am just wondering if there is a way to share the interactive dygraph (after saving it as an local html file) to someone else (with no R or Python on their machines) in the organisation?
Thanks,
Seeker
@seekerknow It should be a self-contained HTML file so you could share the file with anyone who has a modern browser.
from prophet.
Hi I'm following the quick start guide for R:
library('prophet')
# First we read in the data and create the outcome variable. As in the Python API, this is a dataframe with columns ds and y, containing the date and numeric value respectively. The ds column should be YYYY-MM-DD for a date, or YYYY-MM-DD HH:MM:SS for a timestamp. As above, we use here the log number of views to Peyton Manning’s Wikipedia page, available here.
df <- read.csv('raw/example_wp_log_peyton_manning.csv')
# We call the prophet function to fit the model. The first argument is the historical dataframe. Additional arguments control how Prophet fits the data and are described in later pages of this documentation.
m <- prophet(df)
# Predictions are made on a dataframe with a column ds containing the dates for which predictions are to be made. The make_future_dataframe function takes the model object and a number of periods to forecast and produces a suitable dataframe. By default it will also include the historical dates so we can evaluate in-sample fit.
# R
future <- make_future_dataframe(m, periods = 365)
tail(future)
# As with most modeling procedures in R, we use the generic predict function to get our forecast. The forecast object is a dataframe with a column yhat containing the forecast. It has additional columns for uncertainty intervals and seasonal components.
# R
forecast <- predict(m, future)
tail(forecast[c('ds', 'yhat', 'yhat_lower', 'yhat_upper')])
# You can use the generic plot function to plot the forecast, by passing in the model and the forecast dataframe.
# R
plot(m, forecast)
# You can use the prophet_plot_components function to see the forecast broken down into trend, weekly seasonality, and yearly seasonality.
# R
prophet_plot_components(m, forecast)
# An interactive plot of the forecast using Dygraphs can be made with the command dyplot.prophet(m, forecast).
library(dygraphs)
dyplot.prophet(m, forecast).
But end up with the following error message:
Error: unexpected symbol in "dyplot.prophet(m, forecast)."
Anyone else get the same?
from prophet.
@mkrasmus I think the issue is that it looks like you included the period at the end of the sentence as part of the command. If you just do
dyplot.prophet(m, forecast)(no period at the end) it should work.
After doing dyplot.prophet(m, forecast), how can I get the output directory and file? Or how can I set the output directory and file name? I want to upload the output to a site.
Thanks.
from prophet.
Related Issues (20)
- Python3 setuptools error
- ImportError: cannot import name 'main' from 'cmdstanpy.install_cxx_toolchain' HOT 1
- Cross validation creating error when y data ends before cutoff end + horizon - appeared after update from 0.7.1 to 1.1.5
- forecaster.preprocess() may introduce unwanted behavior for NaN history values in 1.1.5 HOT 2
- How to set up an error term to follow Student t-distribution?
- Adding 2 predictions with their respective confidence intervals
- Time zone issue when fitting prophet in R HOT 1
- Minimum Supported Python version is 3.8, not 3.7
- Fitting hangs in Prophet 1.1.5
- weired x label in model.plot_components(forecast)
- ries
- Hierarchical Model
- Model fit behaves very differently between `datetime64[ns]` and `datetime64[ms]`.
- Amplifying the amplitude of seasonality
- regressor_coefficients not finding regr_names HOT 1
- sample_model() not loading
- Forecast is off by 1
- Prophet Optimization error HOT 1
- Can't seem to forecast values correctly for future dates (few values are coming zero and few are not matching the historical pattern)
- Facebook Prophet ignores manually passed changepoints
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prophet.