# Buggy code
def _add_distributions(
    self, distributions: Dict[str, optuna.distributions.BaseDistribution]
) -> None:
    for param_name, param_distribution in distributions.items():
        if isinstance(param_distribution, optuna.distributions.UniformDistribution):
            self._hp_params[param_name] = hp.HParam(
                param_name,
                hp.RealInterval(param_distribution.low, param_distribution.high),
            )
        elif isinstance(
            param_distribution, optuna.distributions.LogUniformDistribution
        ):
            self._hp_params[param_name] = hp.HParam(
                param_name,
                hp.RealInterval(param_distribution.low, param_distribution.high),
            )
        elif isinstance(
            param_distribution, optuna.distributions.DiscreteUniformDistribution
        ):
            self._hp_params[param_name] = hp.HParam(
                param_name,
                hp.RealInterval(param_distribution.low, param_distribution.high),
            )
        elif isinstance(
            param_distribution, optuna.distributions.IntUniformDistribution
        ):
            self._hp_params[param_name] = hp.HParam(
                param_name,
                hp.IntInterval(param_distribution.low, param_distribution.high),
            )
        elif isinstance(
            param_distribution, optuna.distributions.CategoricalDistribution
        ):
            self._hp_params[param_name] = hp.HParam(
                param_name, hp.Discrete(param_distribution.choices)
            )
        else:
            distribution_list = [
                optuna.distributions.UniformDistribution.__name__,
                optuna.distributions.LogUniformDistribution.__name__,
                optuna.distributions.DiscreteUniformDistribution.__name__,
                optuna.distributions.IntUniformDistribution.__name__,
                optuna.distributions.CategoricalDistribution.__name__,
            ]
            raise NotImplementedError(
                "The distribution {} is not implemented. "
                "The parameter distribution should be one of the {}".format(
                    param_distribution, distribution_list
                )
            )


# Traceback (TypeError)
Traceback (most recent call last):
File "tensorboard_test.py", line 13, in <module>
study.optimize(objective, n_trials=10, timeout=600, callbacks=[tensorboard_callback])
File "/home/timon/.pyenv/versions/3.7.5/lib/python3.7/site-packages/optuna/study.py", line 385, in optimize
show_progress_bar=show_progress_bar,
File "/home/timon/.pyenv/versions/3.7.5/lib/python3.7/site-packages/optuna/_optimize.py", line 73, in _optimize
progress_bar=progress_bar,
File "/home/timon/.pyenv/versions/3.7.5/lib/python3.7/site-packages/optuna/_optimize.py", line 178, in _optimize_sequential
callback(study, frozen_trial)
File "/home/timon/.pyenv/versions/3.7.5/lib/python3.7/site-packages/optuna/integration/tensorboard.py", line 41, in __call__
self._initialization(study)
File "/home/timon/.pyenv/versions/3.7.5/lib/python3.7/site-packages/optuna/integration/tensorboard.py", line 102, in _initialization
self._add_distributions(trial.distributions)
File "/home/timon/.pyenv/versions/3.7.5/lib/python3.7/site-packages/optuna/integration/tensorboard.py", line 62, in _add_distributions
param_name, hp.RealInterval(param_distribution.low, param_distribution.high)
File "/home/timon/.pyenv/versions/3.7.5/lib/python3.7/site-packages/tensorboard/plugins/hparams/summary_v2.py", line 444, in __init__
raise TypeError("min_value must be a float: %r" % (min_value,))
TypeError: min_value must be a float: 0

# Fixed code
def _add_distributions(
    self, distributions: Dict[str, optuna.distributions.BaseDistribution]
) -> None:
    real_distributions = (
        optuna.distributions.UniformDistribution,
        optuna.distributions.LogUniformDistribution,
        optuna.distributions.DiscreteUniformDistribution,
    )
    int_distributions = (optuna.distributions.IntUniformDistribution,)
    categorical_distributions = (optuna.distributions.CategoricalDistribution,)
    supported_distributions = (
        real_distributions + int_distributions + categorical_distributions
    )

    for param_name, param_distribution in distributions.items():
        if isinstance(param_distribution, real_distributions):
            self._hp_params[param_name] = hp.HParam(
                param_name,
                hp.RealInterval(
                    float(param_distribution.low), float(param_distribution.high)
                ),
            )
        elif isinstance(param_distribution, int_distributions):
            self._hp_params[param_name] = hp.HParam(
                param_name,
                hp.IntInterval(param_distribution.low, param_distribution.high),
            )
        elif isinstance(param_distribution, categorical_distributions):
            self._hp_params[param_name] = hp.HParam(
                param_name,
                hp.Discrete(param_distribution.choices),
            )
        else:
            distribution_list = [
                distribution.__name__ for distribution in supported_distributions
            ]
            raise NotImplementedError(
                "The distribution {} is not implemented. "
                "The parameter distribution should be one of the {}".format(
                    param_distribution, distribution_list
                )
            )