Skip to content

Instantly share code, notes, and snippets.

@davmre
Created March 4, 2019 23:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davmre/6cabbe7ff9162b9bd79a37866fd5a5ae to your computer and use it in GitHub Desktop.
Save davmre/6cabbe7ff9162b9bd79a37866fd5a5ae to your computer and use it in GitHub Desktop.
temperature_effect = tfp.sts.LinearRegression(
design_matrix=tf.reshape(temperature - np.mean(temperature),
(-1, 1)), name='temperature_effect')
hour_of_day_effect = tfp.sts.Seasonal(
num_seasons=24,
observed_time_series=demand,
name='hour_of_day_effect')
day_of_week_effect = tfp.sts.Seasonal(
num_seasons=7,
num_steps_per_season=24,
observed_time_series=demand,
name='day_of_week_effect')
residual_level = tfp.sts.Autoregressive(
order=1,
observed_time_series=demand, name='residual')
model = tfp.sts.Sum([temperature_effect,
hour_of_day_effect,
day_of_week_effect,
residual_level],
observed_time_series=demand)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment