我还是初学者,不知道是什么问题。
if __name__ == '__main__':
data = ('xx.xlsx')
r = RBM(num_visible = 6, num_hidden = 2)
training_data = np.array(data)
r.train(training_data, max_epochs = 5000)
print(r.weights)
print(r.run_visible)
我收到消息,我应该怎么做才能修复代码?
runfile('C:/Users/USER/rbm1.py', wdir='C:/Users/USER')
File "C:/Users/USER/rbm1.py", line 202
r = RBM(num_visible = 6, num_hidden = 2)
^
IndentationError: unindent does not match any outer indentation level
基本上这是一个缩进错误。在 python 中,而不是像在 C 代码中使用大括号那样缩进,因此将代码更改为在 if 之后具有制表符空格应该解决它:
if __name__ == '__main__':
data = ('xx.xlsx')
r = RBM(num_visible = 6, num_hidden = 2)
training_data = np.array(data)
r.train(training_data, max_epochs = 5000)
print(r.weights)
print(r.run_visible)