facebook / facebook/prophet

'Prophet' object has no attribute 'stan_backend' Mac OSX

Open
#2,057 2 comments 0 reactions 0 assignees View on GitHub
install py
Dominant language
Python
Stars
20.4k
Forks
4.6k
Avg merge
19h 52m
Merged PRs (30d)
1

Description

Hello all, I know this topic has been done to death a couple times but I tried a bunch of different solutions(including downgrading my PyStan and my cmdstanpy). I'm trying to learn Facebook(now Meta!) Prophet using this tutorial: https://www.youtube.com/watch?v=0E_31WqVzCY&t=1303s

My code is pretty much replicated from the youtube video:

```
## importing various libraries
import streamlit as st
import yfinance as yf

from fbprophet import Prophet
from fbprophet.plot import plot_plotly
from datetime import date
from plotly import graph_objs as go

START = "2015-01-01"
TODAY = date.today().strftime("%Y-%m-%d")

st.title("Stock Prediction Algorithm")

stocks = ("AAPL", "GOOG", "MSFT", "GME")
selected_stocks = st.selectbox("Select dataset for prediction", stocks)
slider_year = st.slider("Years of Prediction:", 1, 10)
period = slider_year * 365

@st.cache
def load_data(ticker):
data = yf.download(ticker, START, TODAY)
data.reset_index(inplace=True)
return data

data_load_state = st.text("Loading Data")
data = load_data(selected_stocks) ## call the function specified abpve
data_load_state.text("Data has been loaded")

st.subheader('Raw Data')
st.write(data.tail())

def raw_Plot():
fig = go.Figure()
fig.add_trace(go.Scatter(x=data["Date"], y=data["Open"], name = "Stock_Open"))
fig.add_trace(go.Scatter(x=data["Date"], y=data["Close"], name = "Stock_Close"))
fig.layout.update(title_text = "Time Series Data", xaxis_rangeslider_visible=True)
st.plotly_chart(fig)

raw_Plot()

df_train = data[['Date','Close']]
df_train = df_train.rename(columns = {"Date": "ds", "Close": "y"})

model = Prophet()
model.fit(df_train)
futureModel = model.make_future_dataframe(periods=period)
forecast = model.predict(futureModel)

st.subheader("Forecasted Data")
st.write(forecast.tail())
```

And I keep getting the same error, which is Prophet object has no attribute stan_backend.

My device specifics are as follows:
Mac OS Monterey
MacBook Pro (13-inch, 2019, Two Thunderbolt 3 ports)
Processor 1.4 GHz Quad-Core Intel Core i5

My apologies if I've done something incorrect in this post, I am really new to opening issues. ``

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.