RoboticsClubIITJ / ML-DL-implementation

An implementation of ML and DL algorithms from scratch in python using nothing but NumPy and Matplotlib.
BSD 3-Clause "New" or "Revised" License
49 stars 69 forks source link

Added loss function and unit test for Poisson Loss #211

Open yorozuya-2003 opened 1 year ago

yorozuya-2003 commented 1 year ago

References to other Issues or PRs or Relevant literature

Fixes #9

Brief description of what is fixed or changed

Other comments

The unit test approximately compares the output of the implemented loss function with that of the corresponding loss function already there in TensorFlow when using the same test example as input.

codecov[bot] commented 1 year ago

Codecov Report

Merging #211 (7bce8a5) into master (f43f6e7) will increase coverage by 2.39%. The diff coverage is 83.33%.

Additional details and impacted files [![Impacted file tree graph](https://codecov.io/gh/RoboticsClubIITJ/ML-DL-implementation/pull/211/graphs/tree.svg?width=650&height=150&src=pr&token=Y1Z46WITCE&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=RoboticsClubIITJ)](https://codecov.io/gh/RoboticsClubIITJ/ML-DL-implementation/pull/211?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=RoboticsClubIITJ) ```diff @@ Coverage Diff @@ ## master #211 +/- ## ========================================== + Coverage 11.56% 13.96% +2.39% ========================================== Files 31 32 +1 Lines 2438 2456 +18 ========================================== + Hits 282 343 +61 + Misses 2156 2113 -43 ``` | Flag | Coverage Δ | | |---|---|---| | unittests | `13.96% <83.33%> (+2.39%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=RoboticsClubIITJ#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://codecov.io/gh/RoboticsClubIITJ/ML-DL-implementation/pull/211?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=RoboticsClubIITJ) | Coverage Δ | | |---|---|---| | [MLlib/loss\_func.py](https://codecov.io/gh/RoboticsClubIITJ/ML-DL-implementation/pull/211/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=RoboticsClubIITJ#diff-TUxsaWIvbG9zc19mdW5jLnB5) | `44.53% <70.00%> (+44.53%)` | :arrow_up: | | [MLlib/tests/test\_loss\_func.py](https://codecov.io/gh/RoboticsClubIITJ/ML-DL-implementation/pull/211/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=RoboticsClubIITJ#diff-TUxsaWIvdGVzdHMvdGVzdF9sb3NzX2Z1bmMucHk=) | `100.00% <100.00%> (ø)` | |
rohansingh9001 commented 1 year ago

The loss method and the unit test looks good to me however it will not really be useful if you did not add a derivative method like the other loss classes in this file. Without a derivative function, the framework's models are unable to utilize loss classes.

yorozuya-2003 commented 1 year ago

References to other Issues or PRs or Relevant literature

Fixes #9

Brief description of what is fixed or changed

Other comments

I have tried adding the derivative method for the Poison loss class. Please suggest any corrections required. Thank you.