예제 #1
0
 def __init__(self, start_date, end_date, population):
     self._ensure_date_order(start_date, end_date, name="end_date")
     self._start_date = start_date
     self._end_date = end_date
     self._population = self._ensure_population(population)
     # Summary of information
     self.info_dict = {
         self.START: start_date,
         self.END: end_date,
         self.N: population,
         self.ODE: None,
         self.RT: None
     }
     self._ode_dict = {self.TAU: None}
     self.day_param_dict = {}
     self.est_dict = {
         **{metric: None
            for metric in Evaluator.metrics()}, self.TRIALS: None,
         self.RUNTIME: None
     }
     # Init
     self._id_dict = None
     self._enabled = True
     self._model = None
     self._record_df = pd.DataFrame()
     self.y0_dict = {}
     self._estimator = None
예제 #2
0
 def __init__(self, model, first_date, tau=None, metric="RMSLE", n_jobs=-1):
     self._model = self._ensure_subclass(model, ModelBase, name="model")
     self._first = self._ensure_date(first_date, name="first_date")
     self._metric = self._ensure_selectable(metric,
                                            Evaluator.metrics(),
                                            name="metric")
     self._n_jobs = cpu_count(
     ) if n_jobs == -1 else self._ensure_natural_int(n_jobs, name="n_jobs")
     # Tau value [min] or None
     self._tau = self._ensure_tau(tau, accept_none=True)
     # {"0th": output of self.add()}
     self._info_dict = {}
 def __init__(self, model, data, tau, metric, quantiles):
     self._model = self._ensure_subclass(model, ModelBase, name="model")
     self._ensure_dataframe(data, name="data", columns=self.DSIFR_COLUMNS)
     self._tau = self._ensure_tau(tau, accept_none=False)
     self._metric = self._ensure_selectable(metric, Evaluator.metrics(), name="metric")
     # time steps (index), variables of the model
     df = model.convert(data, tau)
     self._taufree_df = df.copy()
     # Initial values
     self._y0_dict = df.iloc[0].to_dict()
     # Total population
     self._population = df.iloc[0].sum()
     # Step numbers
     self._step_n = df.index.max()
     # Parameter range
     self._range_dict = model.guess(data, tau, q=quantiles)
     # Max values of the variables
     self._max_dict = {v: df[v].max() for v in model.VARIABLES}