# In[20]: utility_term_factory = utility_term_estimation.UtilityAggregatorFactory() # # Evaluation # In[21]: train_measures = evaluation.Measures( x, loss, u, sample_predictive_y, optimal_h_bayes_estimator=optimal_h_bayes_estimator, y_mask=training_mask, GAIN_OPTIMAL_H_NUMERICALLY=GAIN_OPTIMAL_H_NUMERICALLY, RISK_OPTIMAL_H_NUMERICALLY=RISK_OPTIMAL_H_NUMERICALLY, EVAL_NSAMPLES_UTILITY_TERM_THETA=EVAL_NSAMPLES_UTILITY_TERM_THETA, EVAL_NSAMPLES_UTILITY_TERM_Y=EVAL_NSAMPLES_UTILITY_TERM_Y, EVAL_MAX_NITER=EVAL_MAX_NITER, EVAL_SGD_PREC=EVAL_SGD_PREC) test_measures = evaluation.Measures( x, loss, u, sample_predictive_y, optimal_h_bayes_estimator=optimal_h_bayes_estimator, y_mask=testing_mask, GAIN_OPTIMAL_H_NUMERICALLY=GAIN_OPTIMAL_H_NUMERICALLY,
# In[182]: utility_term_factory = utility_term_estimation.UtilityAggregatorFactory() # # Evaluation # In[183]: measures = evaluation.Measures( torch.tensor(schools_dat["y"], dtype=torch.float32), loss, u, sample_predictive_y, optimal_h_bayes_estimator=optimal_h_bayes_estimator, y_mask=utility_term_mask, # all data points GAIN_OPTIMAL_H_NUMERICALLY=GAIN_OPTIMAL_H_NUMERICALLY, RISK_OPTIMAL_H_NUMERICALLY=RISK_OPTIMAL_H_NUMERICALLY, EVAL_NSAMPLES_UTILITY_TERM_THETA=EVAL_NSAMPLES_UTILITY_TERM_THETA, EVAL_NSAMPLES_UTILITY_TERM_Y=EVAL_NSAMPLES_UTILITY_TERM_Y, EVAL_MAX_NITER=EVAL_MAX_NITER, EVAL_SGD_PREC=EVAL_SGD_PREC) # # VI # In[136]: # intialization torch.manual_seed(SEED) np.random.seed(SEED)