コード例 #1
0
 def on_get_lpi(self, req: Request, resp: Response, experiment_name: str):
     """
     Handle GET requests for plotting lpi plots on plots/lpi/:experiment
     where ``experiment`` is the user-defined name of the experiment.
     """
     experiment = ExperimentClient(retrieve_experiment(experiment_name),
                                   None)
     resp.body = experiment.plot.lpi().to_json()
コード例 #2
0
 def on_get_partial_dependencies(self, req: Request, resp: Response,
                                 experiment_name: str):
     """
     Handle GET requests for plotting partial dependencies on
     plots/partial_dependencies/:experiment where ``experiment`` is the user-defined name of the
     experiment.
     """
     experiment = ExperimentClient(retrieve_experiment(experiment_name),
                                   None)
     resp.body = experiment.plot.partial_dependencies().to_json()
コード例 #3
0
    def on_get_trial_in_experiment(self, req: Request, resp: Response,
                                   experiment_name: str, trial_id: str):
        """
        Handle GET requests for trials/:experiment/:trial_id where ``experiment`` is
        the user-defined name of the experiment and ``trial_id`` the id of the trial.
        """
        experiment = retrieve_experiment(experiment_name)
        trial = retrieve_trial(experiment, trial_id)

        response = build_trial_response(trial)
        resp.body = json.dumps(response)
コード例 #4
0
    def on_get_experiment(self, req: Request, resp: Response, name: str):
        """
        Handle GET requests for experiments/:name where `name` is
        the user-defined name of the experiment
        """
        verify_query_parameters(req.params, ["version"])
        version = req.get_param_as_int("version")
        experiment = retrieve_experiment(name, version)

        status = _retrieve_status(experiment)
        algorithm = _retrieve_algorithm(experiment)
        best_trial = _retrieve_best_trial(experiment)

        response = build_experiment_response(experiment, status, algorithm, best_trial)
        resp.body = json.dumps(response)
コード例 #5
0
    def on_get_trials_in_experiment(self, req: Request, resp: Response,
                                    experiment_name: str):
        """
        Handle GET requests for trials/:experiment where ``experiment`` is
        the user-defined name of the experiment.
        """
        verify_query_parameters(req.params, SUPPORTED_PARAMETERS)

        status = req.get_param("status", default=None)
        verify_status(status)
        version = req.get_param_as_int("version")
        with_ancestors = req.get_param_as_bool("ancestors", default=False)

        experiment = retrieve_experiment(experiment_name, version)
        if status:
            trials = experiment.fetch_trials_by_status(status, with_ancestors)
        else:
            trials = experiment.fetch_trials(with_ancestors)

        response = build_trials_response(trials)
        resp.body = json.dumps(response)