Skip to content

TL Review interfaces.ipynb #653

@tiekneeshrimp

Description

@tiekneeshrimp

1. Spelling error

  • Issue : spell checking for "varibales" into "variables
  • Place: Under "Calibrate interface" heading documentation

2. Graph sections disjointed

  • Issue: Cases, Death, Hospitalizations graph areas are not overlapping
  • Place: Under code chunk [11] , "Use calibrated parameter estimates in ensemble_sample to sample from calibrated ensemble model
  • Code:
train_end_point = 3.3   # Use train_end_point = None if there is no calibration
if train_end_point is None:
    end_time_ensemble = 28.0
else:
    end_time_ensemble = train_end_point + 28.0
calibrated_ensemble_result = pyciemss.ensemble_sample(model_paths, solution_mappings, end_time_ensemble, logging_step_size_ensemble, num_samples, 
                                                      start_time=start_time, inferred_parameters=parameter_estimates)
display(calibrated_ensemble_result['data'].head())

# Plot the ensemble result for cases, hospitalizations, and deaths
nice_labels={"dead_state": "Deaths", 
                 "hospitalized_state": "Hospitalizations",
                 "infected_state": "Cases"
                }
schema = plots.trajectories(calibrated_ensemble_result["data"], 
                           keep=["infected_state", "hospitalized_state", "dead_state"], 
                           relabel=nice_labels,
                          )
plots.save_schema(schema, "_schema.json")
plots.ipy_display(schema, dpi=150)

-Expectation: Sections of 'cases', 'deaths', and 'hostpitalizations' should maybe overlap or touch instead of being individual chunks?
-Actual Results:
Image

3. Optimizing interface for optimal start time failed -- but still generated a graph?

  • Issue: Seems that the optimization did not succeed? "success = False". Still generated a graph, but the solution not satisfying constraints seemed to come up as a warning for all following codes that used the optimized start time
  • Place: Under code chunk [19] , "Optimize interface for optimizing start time"
initial_guess_interventions = 0.0
bounds_interventions = [[start_time], [end_time]]

risk_bound = 300.0
qoi = lambda x: obs_nday_average_qoi(x, observed_params, 1)
objfun = lambda x: -x

static_parameter_interventions = start_time_objective(
    param_name = intervened_params,
    param_value = torch.tensor([0.15]),
)
opt_result = pyciemss.optimize(
    model3,
    end_time,
    logging_step_size,
    qoi,
    risk_bound,
    static_parameter_interventions,
    objfun,
    initial_guess_interventions=initial_guess_interventions,
    bounds_interventions=bounds_interventions,
    start_time=0.0,
    n_samples_ouu=int(1e2),
    maxiter=1,
    maxfeval=10,
    solver_method="euler",
    solver_options={"step_size": logging_step_size/2},
)

print(f'Optimal policy:', opt_result["policy"])
print(opt_result)

-Expectation: i think the success message should be "True", and lowest_optimization_result: message: would have a solution output
-Actual Results:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions