Skip to content

Instantly share code, notes, and snippets.

@jayhuang75
Created December 21, 2021 17:37
Show Gist options
  • Select an option

  • Save jayhuang75/eb6e0cbf32b961a703ec5cc121dbb667 to your computer and use it in GitHub Desktop.

Select an option

Save jayhuang75/eb6e0cbf32b961a703ec5cc121dbb667 to your computer and use it in GitHub Desktop.
go-train-delay-ml-pipeline-main-flow
// convert to feature and target dataset
let (features, target) = pg_source_app.pipeline.feature_and_target(&df).await;
//convert feature to smartcore data matrix
let x_matrix = pg_source_app
.pipeline
.feature_to_matrix(&features.unwrap())
.await;
// convert target to class data vec<f64>
let y = pg_source_app
.pipeline
.target_to_ndarray(&target.unwrap())
.await?;
// // cross validate the model
// let result = pg_source_app.pipeline.k_fold_cross_validate(&x_matrix.unwrap(), &y).await?;
// info!("{}", format!("cross validate result: {:?}", result));
// train the model and save the model
let model_path = pg_source_app
.pipeline
.linear_regression_model_build(&x_matrix.unwrap(), &y)
.await?;
info!("{}", format!("build success linear regression model saved path: {:?}", model_path));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment