【发布时间】:2018-09-20 16:34:06
【问题描述】:
我正在使用 python 编码,当我实时编码时出现此消息:
Traceback (most recent call last)
<ipython-input-3-d56dec7d72db> in <module>()
8
9 # create instance of neural network
---> 10 n= neuralNetwork(input_nodes,hidden_nodes,output_nodes,learning_rate)
11
TypeError: init() 接受 0 个位置参数,但给出了 5 个
它究竟意味着什么,我能做些什么?
这是我的代码:
#neural network class definition
class neuralNetwork:
#initialise the neural network
def __init__():
pass
#train the neural network
def train():
pass
#query the neural network
def query():
pass
#initialise the neural network
def __init__(self,inputnodes, hiddennodes,outputnodes,learningrate):
# set number of nodes in each input, hidden, output layer
self.inodes= inputnodes
self.hnodes = hiddennodes
self.onodes = outputnodes
#learning rate
self.lr = learningrate
pass
# number of input, hidden and output nodes
input_nodes = 3
hidden_nodes = 3
output_nodes = 3
# learning rate is 0.3
learning_rate = 0.3
# create instance of neural network
n= neuralNetwork(input_nodes,hidden_nodes,output_nodes,learning_rate)
【问题讨论】:
-
请正确缩进 Python 代码。
标签: python neural-network