def create_ensemble_segment(self,sub_model_indexes, weights):
        if len(sub_model_indexes) != len(weights):
            raise Exception('Ensemble failed. Number of sub models, %d, is not equal to number of weights, %d.') \
                            % (len(sub_model_indexes), len(weights))
        else:
            #Create new data frame ensemble
            self.df_ensemble_segment = self.sub_models_segment[0].copy()
            for target in self.targets:
                self.df_ensemble_segment[target] = 0
                for submodel in sub_model_indexes:
                    self.df_ensemble_segment[target] += self.sub_models_segment[submodel][target] * weights[submodel][target]
Create ensemble for a certain segment, from the given sub models using average weights.
dataset/ETHPy150Open theusual/kaggle-seeclickfix-ensemble/Bryan/ensembles.py/EnsembleAvg.create_ensemble_segment