Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from travis to github actions #298

Merged
merged 5 commits into from
Dec 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/main_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Main CI

on: [push]

jobs:
build:

runs-on: ubuntu-latest # We could run on other OS but we would have to change the command to install libsndfile
strategy:
matrix:
python-version: [3.7, 3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install libsndfile
run: |
sudo apt-get install libsndfile1
RomainGoussault marked this conversation as resolved.
Show resolved Hide resolved
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install -r dev-requirements.txt

- name: Lint with flake8
run: |
flake8 --max-line-length=120
- name: Run unit tests
run: |
pytest -v --cov=mplc tests/unit_tests.py
- name: Run end-to-end tests
run: |
pytest -v --cov=mplc --cov-append tests/ml_perf_end_to_end_tests.py
pytest -v --cov=mplc --cov-append tests/contrib_end_to_end_test.py

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
env_vars: OS,PYTHON
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions mplc/doc/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ Eventually, all the scenarios can be run, and repeated, by calling the `.run()`
### Experiment's parameters
Few parameters can be set:
- `experiment_name`: String, default `'experiment'`. Name of the experiment, will be used for the save path. The full experiment name will be followed by creation date/time, and by a hash if the experiment name already exists.
- `nb_repeat`: int, Number of repetition for the experiment, in which each scenario will be run
- `nb_repeats`: int, Number of repetition for the experiment, in which each scenario will be run
- `scenario_list`: list of scenarios to be run during the experiment. Scenario can also be added via the `.add_scenario()` method
- `is_save`: boolean. If set to True, the experiment will be save on disk.

Expand Down Expand Up @@ -487,7 +487,7 @@ scenario0 = Scenario(4, [0.25]*4)
scenario1 = Scenario(10, [0.1]*10)
scenario2 = Scenario(4, [0.8, 0.1, 0.05, 0.05])

exp = Experiment(experiment_name='my_experiment', nb_repeat=10, scenarios_list=[scenario0, scenario1])
exp = Experiment(experiment_name='my_experiment', nb_repeats=10, scenarios_list=[scenario0, scenario1])
exp.add_scenario(scenario2)

exp.run()
Expand Down
18 changes: 5 additions & 13 deletions tests/contrib_end_to_end_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,16 @@ def test_titanic_contrib(self):
"""

titanic_scenario = Scenario(2, [0.1, 0.9], epoch_count=3, minibatch_count=1, dataset_name='titanic',
contributivity_methods=["Federated SBS linear", "Shapley values"])
exp = Experiment(experiment_name='end_to_end_test_contrib_titanic', nb_repeat=1,
contributivity_methods=["Federated SBS linear", "Federated SBS quadratic",
"Shapley values"])
exp = Experiment(experiment_name='end_to_end_test_contrib_titanic', nb_repeats=2,
scenarios_list=[titanic_scenario])
exp.run()

df = test_utils.get_latest_dataframe("*end_to_end_test*")

# Two contributivity methods for each partner --> 4 lines
assert len(df) == 4

for contributivity_method in df.contributivity_method.unique():

current_df = df[df.contributivity_method == contributivity_method]

small_dataset_score = current_df.loc[current_df.dataset_fraction_of_partner == 0.1, "contributivity_score"]
big_dataset_score = current_df.loc[current_df.dataset_fraction_of_partner == 0.9, "contributivity_score"]

assert small_dataset_score.values < big_dataset_score.values
# 2 contributivity methods X 2 parters x 2 repeats = 12
assert len(df) == 12

def test_mnist_contrib(self):
"""
Expand Down