From 252494ba4edf90442a94b003d7d40b813f4950bd Mon Sep 17 00:00:00 2001 From: Md Mijanur Rahman Date: Sat, 16 Mar 2024 23:03:20 +0100 Subject: [PATCH 01/11] Update README.md with results table --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 75fc208d..bd08cc52 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,9 @@ We use the classification models available in [tsai library](https://timeseriesa ## Results You can find the results in the following table: - + + + ## Authors From 81fccebf309339d73a923d17c0c7ce603eb6c151 Mon Sep 17 00:00:00 2001 From: Md Mijanur Rahman Date: Sat, 16 Mar 2024 23:03:57 +0100 Subject: [PATCH 02/11] Add GitHub Actions workflow to update README with test results --- .github/workflows/update_readme.yaml | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/update_readme.yaml diff --git a/.github/workflows/update_readme.yaml b/.github/workflows/update_readme.yaml new file mode 100644 index 00000000..9ba2018e --- /dev/null +++ b/.github/workflows/update_readme.yaml @@ -0,0 +1,29 @@ +name: Update README + +on: + push: + branches: + - main + +jobs: + update-readme: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Replace results in README + run: | + results=$(cat results/best_runs.md) # Read the results + + # Replace the results in the README + awk -v r="$results" '// {print; print r; f=1} // {f=0} !f' README.md > temp && mv temp README.md + + - name: Commit and push if it changed + run: | + git diff + git config --global user.email "md.rahman.ce@gmail.com" + git config --global user.name "Md Mijanur Rahman" + git commit -am "Update README with test results" || exit 0 + git push \ No newline at end of file From d7c69bf561685ef474e14746a5429a16e692c063 Mon Sep 17 00:00:00 2001 From: Md Mijanur Rahman Date: Sat, 16 Mar 2024 22:04:13 +0000 Subject: [PATCH 03/11] Update README with test results --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bd08cc52..deeaa434 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,12 @@ We use the classification models available in [tsai library](https://timeseriesa You can find the results in the following table: - +| Dataset | GRU_FCN | LSTM | LSTM_FCN | +|:----------------------|----------:|-----------:|-----------:| +| ECG200 | 0.91 | nan | 0.92 | +| HandMovementDirection | nan | nan | 0.486486 | +| Handwriting | nan | nan | 0.0752941 | +| ItalyPowerDemand | nan | 0.559767 | 0.910593 | From d22f2db171300ea38f4f48b451e3d296d035d3a2 Mon Sep 17 00:00:00 2001 From: Md Mijanur Rahman Date: Sat, 16 Mar 2024 23:20:02 +0100 Subject: [PATCH 04/11] Add script to generate table of best runs from mlruns --- results/gen_result.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 results/gen_result.py diff --git a/results/gen_result.py b/results/gen_result.py new file mode 100644 index 00000000..7ef9f244 --- /dev/null +++ b/results/gen_result.py @@ -0,0 +1,24 @@ +""" +We will generate a table here with the results of the experiments from mlruns +""" + +import mlflow + +def get_best_runs(): + + mlflow.set_tracking_uri("file:../mlruns") + all_runs = mlflow.search_runs(search_all_experiments=True) + columns = ['tags.mlflow.runName', 'params.model_name', 'metrics.accuracy'] + all_runs = all_runs[columns] + best_runs = all_runs.groupby(['tags.mlflow.runName', 'params.model_name']).agg({'metrics.accuracy': 'max'}).reset_index() + best_runs = best_runs.pivot(index='tags.mlflow.runName', columns='params.model_name', values='metrics.accuracy').reset_index() + best_runs.columns.name = None + best_runs = best_runs.rename(columns={'tags.mlflow.runName': 'Dataset'}) + # save as markdown file + with open('best_runs.md', 'w') as f: + f.write(best_runs.to_markdown(index=False)) + + +if __name__ == "__main__": + get_best_runs() + \ No newline at end of file From 90b841857135294e9fa78215d92c3d7a2daeade6 Mon Sep 17 00:00:00 2001 From: Md Mijanur Rahman Date: Sat, 16 Mar 2024 23:20:14 +0100 Subject: [PATCH 05/11] Update workflow to run on test2 branch and add Python setup and script execution --- .github/workflows/update_readme.yaml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update_readme.yaml b/.github/workflows/update_readme.yaml index 9ba2018e..57b76c77 100644 --- a/.github/workflows/update_readme.yaml +++ b/.github/workflows/update_readme.yaml @@ -3,7 +3,7 @@ name: Update README on: push: branches: - - main + - test2 jobs: update-readme: @@ -13,6 +13,23 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install mlflow + + - name: Run script + run: python results/gen_result.py + + - name: Commit results if it changed + run: | + git diff --exit-code --quiet results/best_runs.md || (git add results/best_runs.md && git commit -m "Update best runs") + - name: Replace results in README run: | results=$(cat results/best_runs.md) # Read the results From 98029580be4d899c769c9db357a5dc2c78431b25 Mon Sep 17 00:00:00 2001 From: Md Mijanur Rahman Date: Sat, 16 Mar 2024 23:27:07 +0100 Subject: [PATCH 06/11] Update gen_result.py to set tracking URI dynamically --- results/gen_result.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/results/gen_result.py b/results/gen_result.py index 7ef9f244..41792909 100644 --- a/results/gen_result.py +++ b/results/gen_result.py @@ -3,10 +3,13 @@ """ import mlflow +import git -def get_best_runs(): +basePath = git.Repo('.', search_parent_directories=True).working_tree_dir +mlflow.set_tracking_uri(f"file:{basePath}/mlruns") - mlflow.set_tracking_uri("file:../mlruns") +def get_best_runs(): + all_runs = mlflow.search_runs(search_all_experiments=True) columns = ['tags.mlflow.runName', 'params.model_name', 'metrics.accuracy'] all_runs = all_runs[columns] From e3c036e906fac5a497b8a41b4a94911a362f79c8 Mon Sep 17 00:00:00 2001 From: Md Mijanur Rahman Date: Sat, 16 Mar 2024 23:27:11 +0100 Subject: [PATCH 07/11] Update Python version to 3.10 --- .github/workflows/update_readme.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update_readme.yaml b/.github/workflows/update_readme.yaml index 57b76c77..7ed1f9fb 100644 --- a/.github/workflows/update_readme.yaml +++ b/.github/workflows/update_readme.yaml @@ -16,7 +16,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: 3.8 + python-version: 3.10 - name: Install dependencies run: | From 68c8b3e6b410fdc29637889f7b89da939a9bff64 Mon Sep 17 00:00:00 2001 From: Md Mijanur Rahman Date: Sat, 16 Mar 2024 23:27:54 +0100 Subject: [PATCH 08/11] Update Python version to 3.9 --- .github/workflows/update_readme.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update_readme.yaml b/.github/workflows/update_readme.yaml index 7ed1f9fb..70ba30a0 100644 --- a/.github/workflows/update_readme.yaml +++ b/.github/workflows/update_readme.yaml @@ -16,7 +16,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: 3.10 + python-version: 3.9 - name: Install dependencies run: | From e53966c7bd7cd973ea3076d1ed2542570db4a6a7 Mon Sep 17 00:00:00 2001 From: Md Mijanur Rahman Date: Sat, 16 Mar 2024 23:29:59 +0100 Subject: [PATCH 09/11] Update dependencies and install mlflow and tabulate --- .github/workflows/update_readme.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update_readme.yaml b/.github/workflows/update_readme.yaml index 70ba30a0..88ac830f 100644 --- a/.github/workflows/update_readme.yaml +++ b/.github/workflows/update_readme.yaml @@ -21,7 +21,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install mlflow + pip install mlflow tabulate - name: Run script run: python results/gen_result.py From 79e81d6734c901ed4c84aacc0561dde48aa59176 Mon Sep 17 00:00:00 2001 From: Md Mijanur Rahman Date: Sat, 16 Mar 2024 22:30:44 +0000 Subject: [PATCH 10/11] Update README with test results --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bd08cc52..deeaa434 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,12 @@ We use the classification models available in [tsai library](https://timeseriesa You can find the results in the following table: - +| Dataset | GRU_FCN | LSTM | LSTM_FCN | +|:----------------------|----------:|-----------:|-----------:| +| ECG200 | 0.91 | nan | 0.92 | +| HandMovementDirection | nan | nan | 0.486486 | +| Handwriting | nan | nan | 0.0752941 | +| ItalyPowerDemand | nan | 0.559767 | 0.910593 | From d7d2f3cdf8957b162f860056ee55e8fc8720b2d1 Mon Sep 17 00:00:00 2001 From: Md Mijanur Rahman Date: Sat, 16 Mar 2024 23:35:15 +0100 Subject: [PATCH 11/11] branch changed to main --- .github/workflows/update_readme.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update_readme.yaml b/.github/workflows/update_readme.yaml index 88ac830f..abc775e5 100644 --- a/.github/workflows/update_readme.yaml +++ b/.github/workflows/update_readme.yaml @@ -3,7 +3,7 @@ name: Update README on: push: branches: - - test2 + - main jobs: update-readme: @@ -43,4 +43,4 @@ jobs: git config --global user.email "md.rahman.ce@gmail.com" git config --global user.name "Md Mijanur Rahman" git commit -am "Update README with test results" || exit 0 - git push \ No newline at end of file + git push