-1
私はそれを実行するたびに浮動小数点数とメソッドのためにオペランドがサポートされていないことを教えてTypeError
を得る。私は間違ってやっていることや、これをどうやって解決するのか、誰にでも私にアイデアを与えることができましたか?TypeError:*: 'method'と 'float'のためのサポートされていないオペランドタイプ
from numpy import random,array,dot
class neural():
def __init__(self):
self.weights=2*random.random(3).reshape((3,1))-1
def __sigmoid(self,x):
return 1/(1+exp(-x))
def predict(self,inputs):
print("called predict function successfully")
#pass inputs through our neural network (our single neuron)
return dot(input,self.weights)
if __name__=="__main__":
nn=neural()
print(nn.weights)
print(nn.predict(array([3,1,1])))
トレースバックを含む例外がある:
12 nn=neural()
13 print(nn.weights)
---> 14 print(nn.predict(array([3,1,1])))
8 print("called predict function successfully")
9 #pass inputs through our neural network (our single neuron)
---> 10 return dot(input,self.weights)
TypeError: unsupported operand type(s) for *: 'method' and 'float'