Python错误SyntaxError:无特定原因的无效语法

时间:2019-04-15 18:54:34

标签: python jupyter

我显然没有SyntaxError。我知道Python有时会给出错误的错误行。但是我还检查了前几行,但没有发现任何错误的行。

import math
import numpy

class neuralNetwork:
        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

            ```
            self.wih = (numpy.random.normal(0.0,pow(self.hnodes,- 0.5), 
            (self.hnodes,self.inodes))
            self.who = (numpy.random.normal(0.0,pow(self.hnodes,- 0.5), 
            (self.hnodes,self.inodes))

            ```
            # learning rate
             elf.lr = learningrate

            pass
        def train():
            pass
        def query():
            pass
File "<ipython-input-53-3e0b0716fcb1>", line 13
    self.who = (numpy.random.normal(0.0,pow(self.hnodes,- 0.5),(self.hnodes,self.inodes))
       ^
SyntaxError: invalid syntax

1 个答案:

答案 0 :(得分:5)

您忘记了)

self.wih = (numpy.random.normal(0.0,pow(self.hnodes,- 0.5), 
        (self.hnodes,self.inodes)))