-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from KastusKalinovski/master
Master
- Loading branch information
Showing
15 changed files
with
441 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# IPython notebook | ||
.ipynb_checkpoints | ||
|
||
# Repo scratch directory | ||
scratch/ | ||
|
||
# Misc | ||
.DS_Store |
This file was deleted.
Oops, something went wrong.
Empty file.
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import numpy as np | ||
from src.utils import sigmoid | ||
|
||
class Relu: | ||
'''Rectified Linear Unit activation function''' | ||
def __init__(self): | ||
self.params = [] | ||
|
||
def forward(self, batch): | ||
self.X = batch | ||
return np.maximum(0, self.X) | ||
|
||
def backward(self, gradient): | ||
flow_gradient = gradient.copy() | ||
flow_gradient[self.X <= 0] = 0 | ||
return flow_gradient, [] | ||
|
||
|
||
class Sigmoid(): | ||
'''Sigmoid activation function''' | ||
def __init__(self): | ||
self.params = [] | ||
|
||
def forward(self, batch): | ||
self.X = np.array(sigmoid(x) for x in batch) | ||
return self.X | ||
|
||
def backward(self, gradient): | ||
flow_gradient = gradient*self.X*(1-self.X) | ||
return flow_gradient, [] |
Oops, something went wrong.