コード例 #1
0
ファイル: space.py プロジェクト: zhaohb/polyaxon
    def parse_y(self, metrics):
        if not metrics:
            return metrics
        y_values = []
        for value in metrics:
            if V1Optimization.maximize(self.config.metric.optimization):
                y_values.append(float(value))
            else:
                y_values.append(-float(value))

        return np.array(y_values)
コード例 #2
0
    def get_bracket_suggestions(
        self, bracket_iteration: int, configs=None, metrics=None
    ):
        """Reduce the experiments to restart."""
        # Get the number of experiments to keep
        n_configs_to_keep = self.get_num_runs_to_keep(
            num_runs=len(configs), bracket_iteration=bracket_iteration,
        )

        # Order the experiments
        experiments = zip(configs, metrics)
        experiments = sorted(
            experiments,
            key=lambda x: x[1],
            reverse=V1Optimization.maximize(self.config.optimization),
        )
        # Keep n experiments config
        return [xp[0] for xp in experiments[:n_configs_to_keep]]