Skip to content

Commit

Permalink
MTN Objective.to_dict > Objective.get_objective + workflows (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
Badr-MOUFAD authored Jun 28, 2023
1 parent 1956422 commit d55ab45
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 69 deletions.
78 changes: 10 additions & 68 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,71 +15,13 @@ on:
- cron: '42 7 * * *'

jobs:
test-benchmark:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
- os: macos-latest
env:
CONDA_ENV: 'test_env'
VERSION_PYTHON: ${{ matrix.version_python }}
BENCHOPT_BRANCH: benchopt:main
BENCHOPT_DEBUG: 1

defaults:
run:
# Need to use this shell to get conda working properly.
# See https://github.com/marketplace/actions/setup-miniconda#important
shell: bash -l {0}

steps:
- uses: actions/checkout@v2
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: ${{ env.CONDA_ENV }}
python-version: 3.8
# Use miniforge to only get conda-forge as default channel.
miniforge-version: latest

- run: conda info

- name: Install OpenMP
if: matrix.os == 'macos-latest'
run: |
brew install libomp
- name: Install benchopt and its dependencies
run: |
conda info
conda install -yq pip
# Get the correct branch of benchopt
user=${BENCHOPT_BRANCH%:*}
branch=${BENCHOPT_BRANCH##*:}
pip install -U git+https://github.com/$user/benchopt@$branch
- name: Test
run: |
export OMP_NUM_THREADS=1
benchopt test . --env-name bench_test_env -vl
benchopt test . --env-name bench_test_env -vl --skip-install
linter-flake8:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Lint with flake8
run: |
pip install flake8
flake8 .
benchopt_dev:
uses: benchopt/template_benchmark/.github/workflows/test_benchmarks.yml@main
with:
benchopt_branch: benchopt@main
benchopt_release:
uses: benchopt/template_benchmark/.github/workflows/test_benchmarks.yml@main
with:
benchopt_version: latest
lint:
uses: benchopt/template_benchmark/.github/workflows/lint_benchmarks.yml@main
3 changes: 2 additions & 1 deletion objective.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@


class Objective(BaseObjective):
min_benchopt_version = "1.3"
name = "Sparse Logistic Regression"

parameters = {
Expand Down Expand Up @@ -39,5 +40,5 @@ def compute(self, beta):
def _get_lambda_max(self):
return abs(self.X.T @ self.y).max() / 2

def to_dict(self):
def get_objective(self):
return dict(X=self.X, y=self.y, lmbd=self.lmbd)

0 comments on commit d55ab45

Please sign in to comment.