Skip to content

Commit

Permalink
fix: actually use wasmstan in wasmstan example
Browse files Browse the repository at this point in the history
  • Loading branch information
sd2k committed Nov 15, 2024
1 parent 0552ec4 commit e4399f9
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions examples/forecasting/examples/prophet_wasmstan.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
//! Example of using the Prophet model with the cmdstan optimizer.
//!
//! To run this example, you must first download the Prophet Stan model
//! and libtbb shared library into the `prophet_stan_model` directory.
//! The easiest way to do this is to run the `download-stan-model`
//! binary in the `augurs-prophet` crate:
//!
//! ```sh
//! $ cargo run --features download --bin download-stan-model
//! $ cargo run --example prophet_cmdstan
//! ```
use std::{collections::HashMap, time::Duration};
//! Example of using the Prophet model with the wasmstan optimizer.
use std::collections::HashMap;

use augurs::prophet::{cmdstan::CmdstanOptimizer, Prophet, Regressor, TrainingData};
use augurs::prophet::{wasmstan::WasmstanOptimizer, Prophet, Regressor, TrainingData};

fn main() -> Result<(), Box<dyn std::error::Error>> {
tracing_subscriber::fmt::init();
Expand Down Expand Up @@ -41,13 +31,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
]))
.unwrap();

let cmdstan = CmdstanOptimizer::with_prophet_path("prophet_stan_model/prophet_model.bin")?
.with_poll_interval(Duration::from_millis(100))
.with_refresh(50);
// If you were using the embedded version of the cmdstan model, you'd use this:
// let cmdstan = CmdstanOptimizer::new_embedded();

let mut prophet = Prophet::new(Default::default(), cmdstan);
let wasmstan = WasmstanOptimizer::new();
let mut prophet = Prophet::new(Default::default(), wasmstan);
prophet.add_regressor("foo".to_string(), Regressor::additive());
prophet.add_regressor("bar".to_string(), Regressor::additive());

Expand Down

0 comments on commit e4399f9

Please sign in to comment.