Utils¶
Model builders¶
-
tramp.models.
glm_generative
(N, alpha, ensemble_type, prior_type, output_type, **kwargs)[source]¶ Build a generative Generalized Linear Model
Metrics¶
Experiments¶
-
class
tramp.experiments.
TeacherStudentScenario
(teacher, student, x_ids=['x'], y_ids=['y'])[source]¶ Implements teacher student scenario.
- Parameters
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.
- Parameters
model (-) – Same generative model for both teacher and student
x_ids (-) –
y_ids (-) –
-
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.
- Parameters
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