class Neuralnetwork(object):
def __init__(self, data):
self.data = data
def scan(self):
print(self.data)
def sigmoid(self, z):
g = 1 / (1 + math.exp(-z))
return (g)
a1 = sigmoid(7)
print a1
I'm not sure why it won't print the a1 variable with the sigmoid function. It keeps kicking off an error saying that it requires 2 inputs instead of 1. But I thought that by calling the function within the class, I didn'tneed to supply self to it again?
Edit: I have the last two statements in there because I'm still testing things out to make sure that everything is doing what it's supposed to within the class.
sigmoid
is a function within the class definition. Why did you indenta1 = ..
andprint a1
to be part of the class? Why not putdef sigmoid
outside of the class definition if it is not meant to be a method? – Easingself.sigmoid(7)
. If you wanted to call it from outside, then you would need to create an instance ofNeuralnetwork
to callobj.sigmoid(7)
on. – Actinium