Skip to content

Commit

Permalink
WIP: fixes #3, #6; l2 & l1 loss added (#7)
Browse files Browse the repository at this point in the history
* README UPDATE: modified git clone address; added python3 dependency installation

* L1 & L2 added for batch loss

* update readme repo link & python3 info added

* l2 and l1 losses added to the code but not in blog
  • Loading branch information
Raja Hasnain Anwar authored and bfortuner committed Nov 16, 2017
1 parent 839d475 commit c0b1fda
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

1. Clone Repo
```
git clone https://github.com/bfortuner/ml-glossary
git clone https://github.com/bfortuner/ml-cheatsheet.git
```

2. Install Dependencies
Expand All @@ -16,7 +16,12 @@ pip install sphinx sphinx-autobuild
pip install sphinx_rtd_theme
pip install recommonmark
```

For python-3.x installed, use:
```
pip3 install sphinx sphinx-autobuild
pip3 install sphinx_rtd_theme
pip3 install recommonmark
```
3. Preview Changes
```
cd ml-cheatsheet
Expand Down Expand Up @@ -81,6 +86,7 @@ We'd also like to publish top entries to our Medium Blog, for even more visibili
## Tips and Tricks

* [Adding equations](http://www.sphinx-doc.org/en/stable/ext/math.html)
* [Working with Jupyter Notebook](http://louistiao.me/posts/demos/ipython-notebook-demo/)
* Quickstart with Jupyter notebook template
* Graphs and charts
* Importing images
Expand All @@ -97,5 +103,4 @@ We'd also like to publish top entries to our Medium Blog, for even more visibili
* [Embedding Math Equations](http://www.sphinx-doc.org/en/stable/ext/math.html)
* [Sphinx Tutorial](https://pythonhosted.org/an_example_pypi_project/sphinx.html)
* [Sphinx Docs](http://www.sphinx-doc.org/en/stable/markup/code.html)
* [Sphinx Cheatsheet](http://openalea.gforge.inria.fr/doc/openalea/doc/_build/html/source/sphinx/rest_syntax.html)

* [Sphinx Cheatsheet](http://openalea.gforge.inria.fr/doc/openalea/doc/_build/html/source/sphinx/rest_syntax.html)
8 changes: 5 additions & 3 deletions code/loss_functions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import math
import numpy as np

# using the common convention:
# yHat is the prediction while y is the truth (true label)

def CrossEntropy(yHat, y):
pass
Expand All @@ -14,12 +16,12 @@ def KLDivergence(yHat, y):
pass


def L1(yHat, y):
pass
def L1(yHat, y):s
return np.sum(np.absolute(yHat - y))


def L2(yHat, y):
pass
return np.sum((yHat - y)**2)


def MLE(yHat, y):
Expand Down

0 comments on commit c0b1fda

Please sign in to comment.