Skip to content

Commit

Permalink
Refactor (#560)
Browse files Browse the repository at this point in the history
* fix : pycm_util --> utils

* fix : pycm_test --> basic_test

* fix : pycm_profile --> profile

* fix : pycm_param --> params

* fix : pycm_overall_func --> overall_funcs

* fix : pycm_output --> output

* fix : pycm_obj --> cm

* fix : pycm_multilabel_cm --> multilabel_cm

* fix : pycm_interpret --> interpret

* fix : pycm_handler --> handlers

* fix : pycm_error --> errors

* fix : pycm_distance --> distance

* fix : pycm_curve --> curve

* fix : pycm_compare --> compare

* fix : pycm_class_func --> class_funcs

* fix : pycm_ci --> ci

* doc : CONTRIBUTING.md updated
  • Loading branch information
sepandhaghighi authored Oct 10, 2024
1 parent 33bb0a6 commit de6a7bc
Show file tree
Hide file tree
Showing 31 changed files with 177 additions and 159 deletions.
4 changes: 2 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ branch = True
omit =
*/pycm/__main__.py
*/pycm/__init__.py
*/pycm/pycm_profile.py
*/pycm/pycm_test.py
*/pycm/profile.py
*/pycm/basic_test.py
[report]
# Regexes for lines to exclude from consideration
exclude_lines =
Expand Down
34 changes: 18 additions & 16 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Contribution
# Contribution

**Last Update: 2024-10-08**

Changes and improvements are more than welcome! ❤️ Feel free to fork and open a pull request.

Expand Down Expand Up @@ -26,18 +28,18 @@ Please consider the following :

## Class statistic

1. Add new functions to `pycm_class_func.py`
2. Update `CLASS_PARAMS` dictionary in `pycm_param.py`
3. Update `class_statistics` function in `pycm_class_func.py`
1. Add new functions to `class_funcs.py`
2. Update `CLASS_PARAMS` dictionary in `params.py`
3. Update `class_statistics` function in `class_funcs.py`
- Call statistic function and store result in `result` dictionary
4. Update `PARAMS_DESCRIPTION` dictionary in `pycm_param.py` by a short description
- If you don't want capitalization, update `CAPITALIZE_FILTER` list in `pycm_param.py` (*Optional*)
4. Update `PARAMS_DESCRIPTION` dictionary in `params.py` by a short description
- If you don't want capitalization, update `CAPITALIZE_FILTER` list in `params.py` (*Optional*)
5. Update `References` section in `Document.ipynb` (`IEEE` format)
6. Add description to `Class Statistics` section in `Document.ipynb`
- Cite reference
- Update table of contents
- Use `LaTeX` for formula
7. Update `PARAMS_LINK` dictionary in `pycm_param.py` by document tag (without `#`)
7. Update `PARAMS_LINK` dictionary in `params.py` by document tag (without `#`)
8. Add tests to `overall_test.py` and `function_test.py` in `TEST` folder
- If you have any verified test add them to `verified_test.py`
9. Run `autopep8.bat`/`autopep8.sh` (*Optional*, need to install latest version of `autopep8` package)
Expand All @@ -46,36 +48,36 @@ Please consider the following :

## Overall statistic

1. Add new functions to `pycm_overall_func.py`
2. Update `OVERALL_PARAMS` dictionary in `pycm_param.py`
3. Update `overall_statistics` function in `pycm_class_func.py`
1. Add new functions to `overall_funcs.py`
2. Update `OVERALL_PARAMS` dictionary in `params.py`
3. Update `overall_statistics` function in `class_funcs.py`
- Call statistic function and store result in a variable
- Add this variable to output
4. Update `References` section in `Document.ipynb` (`IEEE` format)
5. Add description to `Overall Statistics` section in `Document.ipynb`
- Cite reference
- Update table of contents
- Use `LaTeX` for formula
6. Update `PARAMS_LINK` dictionary in `pycm_param.py` by document tag (without `#`)
6. Update `PARAMS_LINK` dictionary in `params.py` by document tag (without `#`)
7. Add tests to `overall_test.py` and `function_test.py` in `TEST` folder
- If you have any verified test add them to `verified_test.py`
8. Run `autopep8.bat`/`autopep8.sh` (*Optional*, need to install latest version of `autopep8` package)


## Interpretation

1. Add new interpretation table as a function to `pycm_interpret.py`
2. Add a score dictionary to `pycm_param.py`
1. Add new interpretation table as a function to `interpret.py`
2. Add a score dictionary to `params.py`
- Example : ```PLRI_SCORE = {"Good": 4, "Fair": 3, "Poor": 2, "Negligible": 1, "None": "None"}```
3. Add a color dictionary to `BENCHMARK_COLOR` in `pycm_param.py`
3. Add a color dictionary to `BENCHMARK_COLOR` in `params.py`
- Example :
```"PLRI": {"Negligible": "Red","Poor": "Orange","Fair": "Yellow","Good": "Green","None": "White"}```
4. If interpretation table is for a class statistic:
- Step 2-7 [class statistic](#class-statistic)
- Update `CLASS_BENCHMARK_SCORE_DICT` in `pycm_param.py`
- Update `CLASS_BENCHMARK_SCORE_DICT` in `params.py`
5. If interpretation table is for a overall statistic:
- Step 2-6 [overall statistic](#overall-statistic)
- Update `OVERALL_BENCHMARK_SCORE_DICT` in `pycm_param.py`
- Update `OVERALL_BENCHMARK_SCORE_DICT` in `params.py`
6. Add tests to `compare_test.py`, `overall_test.py` and `function_test.py` in `TEST` folder
- If you have any verified test add them to `verified_test.py`
7. Run `autopep8.bat`/`autopep8.sh` (*Optional*, need to install latest version of `autopep8` package)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ jobs:
if: matrix.python-version == env.TEST_PYTHON_VERSION && matrix.os == env.TEST_OS
- name: cProfile
run: |
python -m cProfile -s cumtime pycm/pycm_profile.py
python -m cProfile -s cumtime pycm/profile.py
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Test system modified
- `Python 3.12` added to `test.yml`
- Warning and error messages updated
- `pycm_util.py` renamed to `utils.py`
- `pycm_test.py` renamed to `basic_test.py`
- `pycm_profile.py` renamed to `profile.py`
- `pycm_param.py` renamed to `params.py`
- `pycm_overall_func.py` renamed to `overall_funcs.py`
- `pycm_output.py` renamed to `output.py`
- `pycm_obj.py` renamed to `cm.py`
- `pycm_multilabel_cm.py` renamed to `multilabel_cm.py`
- `pycm_interpret.py` renamed to `interpret.py`
- `pycm_handler.py` renamed to `handlers.py`
- `pycm_error.py` renamed to `errors.py`
- `pycm_distance.py` renamed to `distance.py`
- `pycm_curve.py` renamed to `curve.py`
- `pycm_compare.py` renamed to `compare.py`
- `pycm_class_func.py` renamed to `class_funcs.py`
- `pycm_ci.py` renamed to `ci.py`
## [4.0] - 2023-06-07
### Added
- `pycmMultiLabelError` class
Expand Down
2 changes: 1 addition & 1 deletion Otherfiles/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
2. `README.md`
3. `Otherfiles/version_check.py`
4. `Otherfiles/meta.yaml`
5. `pycm/pycm_param.py`
5. `pycm/params.py`
6. `Document/Document.ipynb`
3. Update `CHANGELOG.md`
1. Add a new header under `Unreleased` section (Example: `## [0.1] - 2022-08-17`)
Expand Down
2 changes: 1 addition & 1 deletion Otherfiles/version_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
os.path.join("Document", "Example1_files", "cm2.html"): HTML_ITEMS,
os.path.join("Document", "Example1_files", "cm3.html"): HTML_ITEMS,
os.path.join("Otherfiles", "test.html"): HTML_ITEMS,
os.path.join("pycm", "pycm_param.py"): PARAMS_ITEMS,
os.path.join("pycm", "params.py"): PARAMS_ITEMS,
os.path.join(".github", "ISSUE_TEMPLATE", "bug_report.yml"): ISSUE_TEMPLATE_ITEMS,
}

Expand Down
Loading

0 comments on commit de6a7bc

Please sign in to comment.