Run all models.

        Returns
        -------
        model
            Best model
        dict
            Metrics of the models
320546
def run_models(self):
        

        self.linear_regression()
        self.lasso_regression()
        self.ridge_regression()
        self.elastic_net_regression()
        self.random_forest()
        self.ann()

        # Index of the model with max score
        best_model_index = self.max_scores.index(max(self.max_scores))

        # Store name of the optimal model
        self.best_model_name = self.model_names[best_model_index]

        # Store optimal model
        self.best_model = self.models[best_model_index]

        return self.metrics
885312
def run(self, **kwargs):
        '''
        
        '''
        self.report_start()
        for bench in self.benchmarks:
            bench = bench(before=self.report_before_method,
                      after=self.report_after_method,
                      after_each=self.report_progress,
                      debug=self.debug,
                      **kwargs)
            self.report_before_class(bench)
            bench.run()
            self.report_after_class(bench)
            self.runned.append(bench)
        self.report_end()
1148947
def run(self):
        
        for cellindex in self.RANK_CELLINDICES:
            self.cellsim(cellindex)

        COMM.Barrier()
531746
def _load_transition_models(self):
        
        self.transitions = []
        for transition in self.state.transitions.values():
            self._add_model(self.transitions, transition, TransitionModel)
668717
def run_plugins(self):
        
        for obj in self.loader.objects:
            # Reserve a slot in the output_dict in order to ensure that the
            # items are in the correct order.
            self.output_dict[obj.output_options['name']] = None
            self.thread_manager.add_thread(obj.main, obj.options['interval'])
494909
def execute(self):
        
        self.prepare_models()
        self.prepare_worker()
        if self.options.print_options:
            self.print_options()
        self.run()
1056530
def run(self):
        '''
        
        '''
        self.utils = salt.loader.utils(self.opts, proxy=self.proxy)
        if salt.utils.platform.is_windows():
            # Calculate function references since they can't be pickled.
            if self.opts['__role'] == 'master':
                self.runners = salt.loader.runner(self.opts, utils=self.utils)
            else:
                self.runners = []
            self.funcs = salt.loader.minion_mods(self.opts, utils=self.utils, proxy=self.proxy)

        self.engine = salt.loader.engines(self.opts,
                                          self.funcs,
                                          self.runners,
                                          self.utils,
                                          proxy=self.proxy)
        kwargs = self.config or {}
        try:
            self.engine[self.fun](**kwargs)
        except Exception as exc:
            log.critical(
                'Engine \'%s\' could not be started!',
                self.fun.split('.')[0], exc_info=True
            )
297921
def relieve_all_models(self):
        
        map(self.relieve_model, list(self.__registered_models))
        self.__registered_models.clear()
223757
def _execute_model(self, feed_dict, out_dict):
        
        network_out = self.sess.run(list(out_dict.values()), feed_dict=feed_dict)
        run_out = dict(zip(list(out_dict.keys()), network_out))
        return run_out
108711
def run(self):
    
    session_groups = self._build_session_groups()
    session_groups = self._filter(session_groups)
    self._sort(session_groups)
    return self._create_response(session_groups)
1161994
def run(self):
        
        from zengine.lib.cache import WFSpecNames

        if self.manager.args.clear:
            self._clear_models()
            return

        if self.manager.args.wf_path:
            paths = self.get_wf_from_path(self.manager.args.wf_path)
        else:
            paths = self.get_workflows()

        self.count = 0

        self.do_with_submit(self.load_diagram, paths, threads=self.manager.args.threads)

        WFSpecNames().refresh()

        print("%s BPMN file loaded" % self.count)
164802
def runs(self):
        
        return tuple(_Run(r, self) for r in self._element.r_lst)
131291
def run(self):
        
        self._runtime_initialize()

        if len(self._flattened_nodes) == 0:
            logger.warning("WARNING: Nothing to do. Try checking your model "
                           "configs and model specification args")
            return []
        else:
            logger.info("")

        selected_uids = frozenset(n.unique_id for n in self._flattened_nodes)
        result = self.execute_with_hooks(selected_uids)

        result.write(self.result_path())

        self.task_end_messages(result.results)
        return result.results
1239224
def get_app_model_classes(self):
        
        models = []
        for m in self.models:
            mod, cls = m.rsplit('.', 1)
            mod = import_module(mod)
            models.append(getattr(mod, cls))
        return models
691807
def find_best_plan(self):
        
        for plan in self.plans:
            for strat in self.strategy:
                self.run_plan(plan, strat)
342601
def best_model_fit(self):
        

        self.best_model.fit(self.baseline_in, self.baseline_out)

        self.y_true = self.baseline_out                             # Pandas Series
        self.y_pred = self.best_model.predict(self.baseline_in)     # numpy.ndarray

        # Set all negative values to zero since energy > 0
        self.y_pred[self.y_pred < 0] = 0

        # n and k values for adj r2 score
        self.n_test = self.baseline_in.shape[0]   # Number of points in data sample
        self.k_test = self.baseline_in.shape[1]   # Number of variables in model, excluding the constant

        # Store best model's metrics
        self.best_metrics['name']   = self.best_model_name
        self.best_metrics['r2']     = r2_score(self.y_true, self.y_pred)
        self.best_metrics['mse']    = mean_squared_error(self.y_true, self.y_pred)
        self.best_metrics['rmse']   = math.sqrt(self.best_metrics['mse'])
        self.best_metrics['adj_r2'] = self.adj_r2(self.best_metrics['r2'], self.n_test, self.k_test)

        # Normalized Mean Bias Error
        numerator = sum(self.y_true - self.y_pred)
        denominator = (self.n_test - self.k_test) * (sum(self.y_true) / len(self.y_true))
        self.best_metrics['nmbe']   = numerator / denominator

        # MAPE can't have 0 values in baseline_out -> divide by zero error
        self.baseline_out_copy  = self.baseline_out[self.baseline_out != 0]
        self.baseline_in_copy   = self.baseline_in[self.baseline_in.index.isin(self.baseline_out_copy.index)]
        self.y_true_copy = self.baseline_out_copy                             # Pandas Series
        self.y_pred_copy = self.best_model.predict(self.baseline_in_copy)     # numpy.ndarray
        self.best_metrics['mape']   = np.mean(np.abs((self.y_true_copy - self.y_pred_copy) / self.y_true_copy)) * 100

        return self.best_metrics
1352990
def _run(self):
        
        try:
            start_time = time.time()

            # Collect Data
            self.collect()

            end_time = time.time()
            collector_time = int((end_time - start_time) * 1000)

            self.log.debug('Collection took %s ms', collector_time)

            if 'measure_collector_time' in self.config:
                if self.config['measure_collector_time']:
                    metric_name = 'collector_time_ms'
                    metric_value = collector_time
                    self.publish(metric_name, metric_value)
        finally:
            # After collector run, invoke a flush
            # method on each handler.
            for handler in self.handlers:
                handler._flush()