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
Tim Williams
  • 154,628
  • 8
  • 97
  • 125
V.O Vian
  • 53
  • 1
  • 10
  • 1
    All your indentation under `if __name__ == '__main__':` is incorrect. Please ensure the indentation of your question matches what you're actually looking at. – roganjosh Aug 21 '17 at 19:33
  • Correct the indentation in your question to match that in your actual code. Use `Ctrl` + `K` to format it after selecting the code. – shad0w_wa1k3r Aug 21 '17 at 19:41

1 Answers1

1

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)
Daniyal Ahmed
  • 715
  • 5
  • 11