optimize_flat

Function optimize_flat 

Source
pub fn optimize_flat(
    log_likelihood: &[f32],
    log_counts: &[f32],
    prior: &[f32],
    opts: Option<OptimizerOpts>,
) -> Result<(Vec<f32>, Vec<f32>), Box<dyn Error>>
Expand description

Run on flattened f32 vector inputs

Wrapper around run_optimizer & optimize_tensor(optimize_tensor<B: Backend>) to run inference.

Preferred for running on any backend supported by BurnBackend and given via OptimizerOpts.

§Inputs

  • log_likelihood: column-major n_cols x n_rows log-likelihood matrix.
  • log_counts: n_rows vector of natural logarithms of the weights for log_likelihood rows.
  • prior: n_cols vector of prior counts for the Dirichlet model.
  • opts: OptimizerOpts.

§Outputs:

  • thetas: n_cols vector of inferred mixing proportions.
  • gamma_Z: flattened n_cols x n_rows column-major matrix containing inferred probabilities that the row i was generated from cluster j.