IndentationError: unindent does not match any outer indentation level with python

709 views Asked by At

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
1

There are 1 answers

2
Daniyal Ahmed On

Basically this is an indentation error. In python instead of using braces as in C code is indented so changing code to have tab spaces after if should solve it as:

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)