Exemple #1
0
    def monteCarloIndicator(self, estim_param, estimate, space_dict, assg_map):
        '''
        Calculates indicators from the MC runs
        '''
        start_index = estim_param.tint_eval_start * len(space_dict)
        end_index = (estim_param.tint_eval_start +
                     len(estim_param.tint_eval_dict)) * len(space_dict)

        if estim_param.MC_iterations > 1:
            IndDist = np.zeros((len(estim_param.tint_dict) * len(space_dict),
                                estim_param.MC_iterations))
            for iteration in range(estim_param.MC_iterations):
                IndDist[:, iteration] = np.asarray(
                    DNL.apply_assg(assg_map, estimate.demand_distr[:,
                                                                   iteration]))

            ind_mean = np.mean(IndDist[start_index:end_index, :], axis=1)
            ind_std = np.std(IndDist[start_index:end_index, :], axis=1)
            ind_dist = IndDist[start_index:end_index, :]

        else:
            ind_mean = np.asarray(
                DNL.apply_assg(np.asarray(assg_map),
                               estimate.demand_distr))[start_index:end_index]
            ind_std = None
            ind_dist = ind_mean

        return ind_mean, ind_std, ind_dist
Exemple #2
0
    def monteCarloIndicator(self, estim_param, estimate, space_dict, assg_map):
        """
        Calculates indicators from the MC runs
        """
        start_index = estim_param.tint_eval_start * len(space_dict)
        end_index = (estim_param.tint_eval_start + len(estim_param.tint_eval_dict)) * len(space_dict)

        if estim_param.MC_iterations > 1:
            IndDist = np.zeros((len(estim_param.tint_dict) * len(space_dict), estim_param.MC_iterations))
            for iteration in range(estim_param.MC_iterations):
                IndDist[:, iteration] = np.asarray(DNL.apply_assg(assg_map, estimate.demand_distr[:, iteration]))

            ind_mean = np.mean(IndDist[start_index:end_index, :], axis=1)
            ind_std = np.std(IndDist[start_index:end_index, :], axis=1)
            ind_dist = IndDist[start_index:end_index, :]

        else:
            ind_mean = np.asarray(DNL.apply_assg(np.asarray(assg_map), estimate.demand_distr))[start_index:end_index]
            ind_std = None
            ind_dist = ind_mean

        return ind_mean, ind_std, ind_dist