Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mtpalovic authored Apr 1, 2022
1 parent 9d5938e commit 37c65c4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions nnn.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# coding: utf-8

# In[ ]:
# In[1]:


import numpy as np
Expand All @@ -12,7 +12,7 @@
import matplotlib.pyplot as plt


# In[ ]:
# In[2]:


#generate random data with seed for reproducibility
Expand All @@ -21,7 +21,7 @@
a = np.random.randn(1000,4)


# In[ ]:
# In[3]:


#generate random data with seed for reproducibility
Expand All @@ -38,7 +38,7 @@

# $$\frac{\partial J}{\partial b} = \frac{1}{m}\sum\limits_{i=1}^{m}(a_i - y_i)$$

# In[ ]:
# In[4]:


class nn(object):
Expand Down Expand Up @@ -207,7 +207,7 @@ def forward_propagate_not_vectorised(self):
cost = float(cost)


#d_w1 = (1/self.m)*np.matmul((self.x0).T,(B-self.y0))


#derivative of the cost function w.r.t. w in non-vectorised form
#first matrix substraction B - self.y0, both shape (1000,1)
Expand Down Expand Up @@ -302,31 +302,31 @@ def gradient_descent(self):
return optim_params


# In[ ]:
# In[5]:


neural_nets = nn(a,b,0.005,2500)


# In[ ]:
# In[6]:


neural_nets.w


# In[ ]:
# In[7]:


neural_nets.forward_propagate_vectorised()


# In[ ]:
# In[8]:


neural_nets.forward_propagate_not_vectorised()


# In[ ]:
# In[9]:


neural_nets.gradient_descent()
Expand Down

0 comments on commit 37c65c4

Please sign in to comment.