Skip to content

Instantly share code, notes, and snippets.

View davmre's full-sized avatar

Dave Moore davmre

View GitHub Profile

Keybase proof

I hereby claim:

  • I am davmre on github.
  • I am dmoore (https://keybase.io/dmoore) on keybase.
  • I have a public key whose fingerprint is 6162 22A0 13EB 39B1 58C8 5F83 77EC 2B7F 6E47 BD09

To claim this, I am signing this object:

@davmre
davmre / co2_model.py
Created March 4, 2019 23:29
Structural Time Series model of monthly atmospheric CO2 data from Mauna Loa
import tensorflow_probability as tfp
trend = tfp.sts.LocalLinearTrend(observed_time_series=co2_by_month)
seasonal = tfp.sts.Seasonal(
num_seasons=12, observed_time_series=co2_by_month)
model = tfp.sts.Sum([trend, seasonal], observed_time_series=co2_by_month)
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,