pub fn run_optimizer<B: Backend>(
logl_f: &[f32],
log_counts_f: &[f32],
alpha0_f: &[f32],
options: &OptimizerOpts,
device: &Device<B>,
) -> Result<(Vec<f32>, Vec<f32>), Box<dyn Error>>Expand description
Helper function to run on a generic backend
Allocates the input data on the BurnBackend and calls optimize_tensor(optimize_tensor<B: Backend>) to run inference.
burn Backend must be given as the generic <B: Backend>. Does not verify the input dimensions.
§Inputs
logl_f: flattened column-majorn_cols x n_rowslog-likelihood matrix.log_counts_f:n_rowsvector of natural logarithm of the weights forlogl_frows.alpha0_f:n_colsvector of prior counts for the Dirichlet model.options: OptimizerOptsdevice: burn Device wrapping the Backend.
§Outputs
thetas:n_colsvector of inferred mixing proportions.gamma_Z: flattenedn_cols x n_rowscolumn-major matrix containing inferred probabilities that the rowiwas generated from clusterj.
§Errors
Propagates errors, does not error on its own.