diff --git a/.github/workflows/lint_benchmarks.yml b/.github/workflows/lint_benchmarks.yml index 43ce014..60c3ac4 100644 --- a/.github/workflows/lint_benchmarks.yml +++ b/.github/workflows/lint_benchmarks.yml @@ -2,9 +2,14 @@ name: Lint on: workflow_call: + inputs: + linter: + type: string + description: Linter to use for the benchmarks. For now only supports flake8 and ruff. + default: flake8 jobs: - linter-flake8: + linter: runs-on: ubuntu-latest # Cancel in-progress workflows when pushing @@ -20,7 +25,11 @@ jobs: with: python-version: 3.8 - - name: Lint with flake8 + - name: Lint with ${{ inputs.linter }} run: | - pip install flake8 - flake8 . + pip install ${{ inputs.linter }} + if [ "${{ inputs.linter }}" = "ruff" ]; then + ruff check . + else + flake8 . + fi diff --git a/.github/workflows/test_benchmarks.yml b/.github/workflows/test_benchmarks.yml index cf4d154..a87135f 100644 --- a/.github/workflows/test_benchmarks.yml +++ b/.github/workflows/test_benchmarks.yml @@ -17,7 +17,7 @@ on: type: string python_version: description: Python version to use for the tests. - default: "3.10" + default: "3.12" required: false type: string extra_args: @@ -89,7 +89,7 @@ jobs: then user=${BENCHOPT_BRANCH%@*} branch=${BENCHOPT_BRANCH##*@} - pip install -U git+https://github.com/$user/benchopt@$branch + pip install -U "benchopt @ git+https://github.com/$user/benchopt@$branch" elif [[ "$BENCHOPT_VERSION" == "latest" ]] then pip install -U benchopt diff --git a/datasets/simulated.py b/datasets/simulated.py index ac5c3fe..fe2189f 100644 --- a/datasets/simulated.py +++ b/datasets/simulated.py @@ -17,7 +17,6 @@ class Dataset(BaseDataset): (1000, 500), (5000, 200), ], - 'random_state': [27], } # List of packages needed to run the dataset. See the corresponding @@ -29,8 +28,16 @@ def get_data(self): # to `Objective.set_data`. This defines the benchmark's # API to pass data. It is customizable for each benchmark. + # Get a random seed to generate the data. The seed is generated from + # the `get_seed` method, which ensures that the same seed is used + # across different runs of the benchmark, and different solvers. + # The use of `use_repetition=True` ensures that the seed changes across + # different repetitions of the benchmark, which can be useful to + # generate different data for each repetition. + seed = self.get_seed(use_repetition=True) + # Generate pseudorandom data using `numpy`. - rng = np.random.RandomState(self.random_state) + rng = np.random.RandomState(seed) X = rng.randn(self.n_samples, self.n_features) y = rng.randn(self.n_samples)