0

I'm still a beginner, I dont know what the problem.

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)

I get message, what should i do to fix the code?

 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
4

1 回答 1

1

基本上这是一个缩进错误。在 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)
于 2017-08-21T19:35:05.800 回答