Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find the optimal changepoint value #11

Open
kevb10 opened this issue Aug 11, 2019 · 0 comments
Open

Find the optimal changepoint value #11

kevb10 opened this issue Aug 11, 2019 · 0 comments
Projects

Comments

@kevb10
Copy link
Owner

kevb10 commented Aug 11, 2019

Documentation here

tldr; a higher value makes the model more flexible while a lower value makes it less flexible

This will have to be different for every stock.

delphi-oracle/stocker.py

Lines 338 to 359 in 5c95102

def changepoint_prior_analysis(self, changepoint_priors=[0.001, 0.05, 0.1, 0.2], colors=['b', 'r', 'grey', 'gold']):
# Training and plotting with specified years of data
global predictions
train = self.stock[
(self.stock['Date'] > (max(self.stock['Date']) - pd.DateOffset(years=self.training_years)).date())]
# Iterate through all the changepoints and make models
for i, prior in enumerate(changepoint_priors):
# Select the changepoint
self.changepoint_prior_scale = prior
# Create and train a model with the specified cps
model = self.create_model()
model.fit(train)
future = model.make_future_dataframe(periods=180, freq='D')
# Make a dataframe to hold predictions
if i == 0:
predictions = future.copy()
future = model.predict(future)

@kevb10 kevb10 added this to To do in Prediction via automation Aug 11, 2019
@kevb10 kevb10 pinned this issue Aug 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Prediction
  
To do
Development

No branches or pull requests

1 participant