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
48 stars 69 forks source link

Two activation functions added #80

Closed parva-jain closed 3 years ago

parva-jain commented 3 years ago

References to other Issues or PRs or Relevant literature

Brief description of what is fixed or changed

Other comments

This PR corresponds to issue #69. Added functions are Binary step function and Swish activation function.

rohansingh9001 commented 3 years ago

@parva-jain you can see the build errors by going to this link.

Also, the logic of the activation functions seems correct, however, make sure to add parameters like the threshold in the step activation function. So that a user can control after which value the activation function steps.

You can do the same with the swish activation, there is a parameter called beta, which you can add as an optional parameter in the function.

Also, can you rename the binary step function to the unit_step function? As it would make it consistent with unit step signals as most people are used to that name.

Rest LGTM

parva-jain commented 3 years ago

@parva-jain you can see the build errors by going to this link.

Also, the logic of the activation functions seems correct, however, make sure to add parameters like the threshold in the step activation function. So that a user can control after which value the activation function steps.

You can do the same with the swish activation, there is a parameter called beta, which you can add as an optional parameter in the function.

Also, can you rename the binary step function to the unit_step function? As it would make it consistent with unit step signals as most people are used to that name.

Rest LGTM

I will do the said changes, but I have gone through that build error link and doesn't understand what's wrong, so need ur help on that.

agrawalshubham01 commented 3 years ago

@parva-jain

I will do the said changes, but I have gone through that build error link and doesn't understand what's wrong, so need ur help on that.

We are using flake8 for checking docstyle errors. There are 3 errors raised in your PR. You can run locally by installing flake8.

./MLlib/activations.py:166:1: E302 expected 2 blank lines, found 1
./MLlib/activations.py:186:1: W293 blank line contains whitespace
./MLlib/activations.py:187:1: E302 expected 2 blank lines, found 1

These are the errors, the first and third one is because when there change class and then function then it is expected to leave 2 lines but you left only one so leave one more line at line 166 and 187 of MLlib/activation.py The second fuction is because you have left white space in empty line i.e there are spacebars pressed in between in line 186 of MLlib/activation.py, this is also checked ion flake8 that no white space is expected.

I think doing this would solve your problems. Also try configuring your code editor whichever you use that would make your lives simpler as this would be taken care by editor.

parva-jain commented 3 years ago

@parva-jain

I will do the said changes, but I have gone through that build error link and doesn't understand what's wrong, so need ur help on that.

We are using flake8 for checking docstyle errors. There are 3 errors raised in your PR. You can run locally by installing flake8.

./MLlib/activations.py:166:1: E302 expected 2 blank lines, found 1
./MLlib/activations.py:186:1: W293 blank line contains whitespace
./MLlib/activations.py:187:1: E302 expected 2 blank lines, found 1

These are the errors, the first and third one is because when there change class and then function then it is expected to leave 2 lines but you left only one so leave one more line at line 166 and 187 of MLlib/activation.py The second fuction is because you have left white space in empty line i.e there are spacebars pressed in between in line 186 of MLlib/activation.py, this is also checked ion flake8 that no white space is expected.

I think doing this would solve your problems. Also try configuring your code editor whichever you use that would make your lives simpler as this would be taken care by editor.

Got it, will take care of this from now onwards.

parva-jain commented 3 years ago

Hey @rohansingh9001, I'm new to git and GitHub and I have messed up in this branch (merge conflicts are there which I'm not able to solve) so can I open a new PR with the same content I want to contribute?

agrawalshubham01 commented 3 years ago

I'm new to git and GitHub and I have messed up in this branch (merge conflicts are there which I'm not able to solve) so can I open a new PR with the same content I want to contribute?

@parva-jain if only merge conflict is the problem then do git pull https://github.com/RoboticsClubIITJ/ML-DL-implementation.git and then push this to your repo. This would solve the merge conflict problem.