optuna / optuna-dashboard

Real-time Web Dashboard for Optuna.
https://optuna-dashboard.readthedocs.io/en/latest/
Other
477 stars 83 forks source link

Add TableArtifactViewer for jsonl file #887

Closed keisuke-umezawa closed 2 weeks ago

keisuke-umezawa commented 1 month ago

Contributor License Agreement

This repository (optuna-dashboard) and Goptuna share common code. This pull request may therefore be ported to Goptuna. Make sure that you understand the consequences concerning licenses and check the box below if you accept the term before creating this pull request.

Reference Issues/PRs

https://github.com/optuna/optuna-dashboard/pull/877

What does this implement/fix? Explain your changes.

Add TableArtifactViewer for jsonl file

sample

import logging
import math
import os
from typing import Tuple

import optuna
from optuna_dashboard._app import create_app

host = "127.0.0.1"
port = 8080

optuna.logging.set_verbosity(logging.CRITICAL)

def create_optuna_storage() -> optuna.storages.InMemoryStorage:
    storage = optuna.storages.InMemoryStorage()

    # Single-objective study
    study = optuna.create_study(study_name="single-objective", storage=storage)

    def objective_single(trial: optuna.Trial) -> float:
        x1 = trial.suggest_float("x1", 0, 10)
        x2 = trial.suggest_float("x2", 0, 10)
        x3 = trial.suggest_categorical("x3", ["foo", "bar"])
        return (x1 - 2) ** 2 + (x2 - 5) ** 2

    study.optimize(objective_single, n_trials=100)

    return storage

def main() -> None:
    storage = create_optuna_storage()
    base_path = "./artifacts"
    os.makedirs(base_path, exist_ok=True)
    artifact_store = optuna.artifacts.FileSystemArtifactStore(base_path=base_path)
    app = create_app(storage, artifact_store, debug=True)
    app.run(host=host, port=port, reloader=True)

if __name__ == "__main__":
    main()
codecov[bot] commented 4 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 69.58%. Comparing base (747098b) to head (cc0ab0f). Report is 13 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #887 +/- ## ======================================= Coverage 69.58% 69.58% ======================================= Files 35 35 Lines 2377 2377 ======================================= Hits 1654 1654 Misses 723 723 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

keisuke-umezawa commented 3 weeks ago

@porink0424 I followed your comments, and fixed conflicts. Could you review it again?