init. Takes as argument list of weights of a neuron —- w=(w1,…,wn) , and a function of activation f (by default f(x)=x ). Saves the weights and a function inside the class.
forward. Takes as argument list x=(x1,…,xN) —- neuron inputs. Returns f(w1x1+…+wnxn) .
backlog. Returns last list x , which have been given to forward as argument.
`# I strongly do not recommend to change any written code here
class Neuron: def __init__(self, w, f = lambda x: x): #YOUR CODE HERE def forward(self, x): #YOUR CODE HERE def backlog(self): #YOUR CODE HERE` import math w = [0.5, 1., -1., 2.] neuron = Neuron([0.5, 1., -1., 2.], lambda x: 1. / (1 + math.exp(x))) x = [1, 2, 3, 4] print(neuron.forward(x))`
- 1Emulate class private members in JS
- 1Which is the right way to reflect already pushed changes to local branch?
- 1SVN vs Git: Which One Is Best For Your Needs
- 1Abstract and Virtual Methods
- 3What is the CSS :scope pseudo-class for?
- 1CSS :only-of-type Pseudo Class
- 2Which Version Control Software do you suggest?
- 2How to write a sum method which will work properly when invoked using either syntax below?
- 1How to check which ports is in use on Linux
- 1How do I find out which DOM element has the focus?
- 1What is difference between getBoundingClientRect and getClientRects methods