Model builders

tramp.priors.get_prior(size, prior_type, **kwargs)[source]
tramp.channels.get_channel(channel_type, **kwargs)[source]
tramp.likelihoods.get_likelihood(y, likelihood_type, **kwargs)[source]
tramp.models.glm_generative(N, alpha, ensemble_type, prior_type, output_type, **kwargs)[source]

Build a generative Generalized Linear Model

tramp.models.glm_state_evolution(alpha, prior_type, output_type, **kwargs)[source]

Build a Generalized Linear Model to be used only for State Evolution. The linear channels are Marchenko-Pastur.

class tramp.models.MultiLayerModel(layers, ids=None)[source]


tramp.algos.metrics.mean_squared_error(x_true, x_pred)[source]
tramp.algos.metrics.overlap(x_true, x_pred)[source]


class tramp.experiments.TeacherStudentScenario(teacher, student, x_ids=['x'], y_ids=['y'])[source]

Implements teacher student scenario.

  • teacher (-) – Generative teacher model

  • student (-) – Generative student model

  • x_ids (-) –

  • y_ids (-) –

class tramp.experiments.BayesOptimalScenario(model, x_ids=['x'], y_ids=['y'])[source]

Implements teacher student scenario in the Bayes Optimal setting.

  • model (-) – Same generative model for both teacher and student

  • x_ids (-) –

  • y_ids (-) –

tramp.experiments.run_experiments(run, on_progress=None, **kwargs)[source]
tramp.experiments.save_experiments(run, csv_file, on_progress=None, **kwargs)[source]
tramp.experiments.find_critical_alpha(id, a0, mse_criterion, alpha_min, alpha_max, model_builder, alpha_tol=1e-06, vtol=0.001, **model_kwargs)[source]

Find critical value of the measurment density alpha.

It performs a binary search on alpha to find the minimal value of alpha for which the mse criterion is satisfied.

  • id (str) – id of the variable to infer (signal)

  • a0 (float) – Initial value of the a message id -> prior

  • mse_criterion ({"random", "perfect"} or function) –

    Criterion on the mse:

    • ”random” : search the maximal value of alpha for which v = tau_x (no better than random guess)

    • ”perfect” : search the minimal value of alpha for which v = 0 (perfect reconstruction)

    • function : mse_criterion(v) must return False when alpha < alpha_c and True when alpha > alpha_c

  • alpha_min (float) – Minimal value for the alpha search

  • alpha_max (float) – Maximal value for the alpha search

  • alpha_tol (float,) – Tolerance on alpha, default 1e-6

  • vtol (float) – Tolerance on the variance v used in the “perfect” or “random” mse criteria

tramp.experiments.qplot(data, x, y, color=None, column=None, row=None, marker=None, linestyle=None, xlog=False, ylog=False, xlim=None, ylim=None, y_markers=None, sharex=True, sharey=True, figsize=4, y_legend=False, rename=None, font_size=12, usetex=False)[source]

Check gradients

tramp.checks.plot_belief_grad_b(belief, **kwargs)[source]