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 csv file #877

Closed keisuke-umezawa closed 1 month ago

keisuke-umezawa commented 2 months 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

NA

What does this implement/fix? Explain your changes.

Make artifact viewer compatible with CSV files.

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()

You can see artifact loader on study page.

スクリーンショット 2024-05-12 14 31 02 スクリーンショット 2024-05-12 14 31 10
porink0424 commented 1 month ago

@keisuke-umezawa Also, This is kind of tiny problem though, the full-screen modal has different size of radius in the upper corners and lower corners.

329827823-fe5ce7d8-58dc-46e2-a025-3912ff62300b
keisuke-umezawa commented 1 month ago

@porink0424 Thank you for reviewing. I followed your comment. Could you review it again?