optuna / optuna-examples

Examples for https://github.com/optuna/optuna
MIT License
634 stars 172 forks source link

Modify simple examples based on the Optuna code conventions #218

Closed nabenabe0928 closed 8 months ago

nabenabe0928 commented 8 months ago

Motivation

This PR refactors PR#216. Primary changes in this PR is to modify the codes so that the examples will follow the Optuna code conventions.

Description of the changes

The typical code conventions are the following:

  1. Multi-objective function returns a tuple of objective values,
  2. Make the comments clearer without the context, e.g. the first line in the main block of multi_objective/quadratic_simple.py should use more general nouns like "the first objective" rather than obj1, obj2, and
  3. Specify the finished trial number if we use timeout.
github-actions[bot] commented 8 months ago

This pull request has not seen any recent activity.

toshihikoyanase commented 8 months ago

flake8 found some coding-style violations in quadratic_simple_constraint.py. Could you fix them, please?

Run flake8 .
./quadratic_simple_constraint.py:5:100: E501 line too long (102 > 99 characters)
./quadratic_simple_constraint.py:6:100: E501 line too long (101 > 99 characters)
./quadratic_simple_constraint.py:8:100: E501 line too long (105 > 99 characters)
./quadratic_simple_constraint.py:10:100: E501 line too long (109 > 99 characters)
./quadratic_simple_constraint.py:[11](https://github.com/optuna/optuna-examples/actions/runs/6571297355/job/17850176657?pr=218#step:6:12):100: E501 line too long (114 > 99 characters)
./quadratic_simple_constraint.py:[13](https://github.com/optuna/optuna-examples/actions/runs/6571297355/job/17850176657?pr=218#step:6:14):47: W291 trailing whitespace
./quadratic_simple_constraint.py:30:100: E501 line too long (108 > 99 characters)
6     E501 line too long (102 > 99 characters)
1     W291 trailing whitespace
nabenabe0928 commented 8 months ago

flake8 found some coding-style violations in quadratic_simple_constraint.py. Could you fix them, please?

Run flake8 .
./quadratic_simple_constraint.py:5:100: E501 line too long (102 > 99 characters)
./quadratic_simple_constraint.py:6:100: E501 line too long (101 > 99 characters)
./quadratic_simple_constraint.py:8:100: E501 line too long (105 > 99 characters)
./quadratic_simple_constraint.py:10:100: E501 line too long (109 > 99 characters)
./quadratic_simple_constraint.py:[11](https://github.com/optuna/optuna-examples/actions/runs/6571297355/job/17850176657?pr=218#step:6:12):100: E501 line too long (114 > 99 characters)
./quadratic_simple_constraint.py:[13](https://github.com/optuna/optuna-examples/actions/runs/6571297355/job/17850176657?pr=218#step:6:14):47: W291 trailing whitespace
./quadratic_simple_constraint.py:30:100: E501 line too long (108 > 99 characters)
6     E501 line too long (102 > 99 characters)
1     W291 trailing whitespace

Thank you! Done!

not522 commented 8 months ago

@Alnusjaponica Could you review this PR?

toshihikoyanase commented 8 months ago

@Alnusjaponica Thank you for your thorough review. I have no further comments, so please merge after your review.