不能使用*操作数作为numpy.dot的结果

时间:2017-07-09 06:12:02

标签: python numpy

我正在使用python3和jupyter notebook

self.who += self.lr * numpy.dot
        ((output_errors * final_outputs * (1.0 - final_outputs)),numpy.transpose(hidden_outputs))

此代码显示

以下的错误

TypeError: unsupported operand type(s) for *: 'float' and 'builtin_function_or_method'

我试着查看这句话的后半部分

print (numpy.dot
        ((output_errors * final_outputs * (1.0 - final_outputs)),numpy.transpose(hidden_outputs)))

它显示正确的矩阵。

为什么会发生此错误?

[[ -1.43954649e-01  -6.16570817e-02  -7.50716509e-02  -5.26743548e-02
   -1.33602408e-01  -8.66191231e-02  -1.82448447e-03  -1.14619563e-01
   -2.31254191e-03  -1.25371046e-01  -6.58786989e-03  -2.51314122e-02
   -9.03342766e-03  -1.38359348e-02  -7.51453146e-02  -1.23144972e-01
   -1.10367906e-01  -4.96956932e-03  -1.07926267e-01  -1.30058539e-01
   -1.01781919e-01  -8.43032061e-04  -1.26695656e-01  -2.48998290e-02
   -1.24699147e-01  -1.41539201e-01  -1.17165171e-01  -3.75355704e-02
   -5.87039591e-02  -1.26151940e-01  -1.19498873e-01  -1.34517700e-01
   -8.14579022e-03  -3.28206127e-02  -4.75840077e-02  -1.17981918e-02
   -1.44620195e-01  -1.10927695e-03  -1.41479266e-01  -1.30649564e-01
   -4.30125241e-03  -1.35096429e-01  -6.05816058e-02  -1.10157321e-01
   -4.47267308e-02  -7.28279212e-02  -5.31360471e-02  -7.78219707e-02
   -1.71757937e-02  -1.44978996e-01  -1.72653895e-02  -1.07254954e-01
   -9.32763127e-04  -1.05262485e-01  -5.99327953e-02  -4.50893988e-03
   -1.44377058e-01  -2.10525894e-04  -4.94344180e-02  -1.30978698e-01
   -6.83022164e-02  -9.27788252e-02  -1.30111840e-01  -1.45624062e-02
   -1.44733983e-01  -1.44224232e-01  -1.46240068e-02  -3.29418289e-02
   -1.39345845e-01  -5.91389063e-02  -2.65144914e-02  -2.98560477e-04
   -7.17849540e-02  -1.77096383e-02  -1.24107579e-01  -5.84745887e-02
   -1.33140055e-01  -2.85366904e-03  -1.55459756e-02  -3.29575928e-02
   -1.19938740e-01  -3.90768941e-02  -1.37363861e-01  -3.38880149e-02
   -1.28913856e-01  -2.04071240e-02  -6.59530207e-02  -7.50348109e-02
   -1.01345369e-03  -8.10496965e-02  -1.18090253e-01  -3.30326197e-03
   -4.18706215e-03  -8.62360279e-04  -1.70682515e-02  -1.08036311e-01
   -6.44866478e-03  -5.27289173e-02  -5.98901752e-03  -2.01450649e-02]
 [ -1.25811295e-01  -5.38861190e-02  -6.56099803e-02  -4.60355319e-02
   -1.16763801e-01  -7.57020645e-02  -1.59453521e-03  -1.00173463e-01
   -2.02108023e-03  -1.09569881e-01  -5.75756638e-03  -2.19639696e-02
   -7.89489779e-03  -1.20921200e-02  -6.56743598e-02  -1.07624371e-01
   -9.64576652e-02  -4.34322865e-03  -9.43237581e-02  -1.13666585e-01
   -8.89538146e-02  -7.36780345e-04  -1.10727544e-01  -2.17615740e-02
   -1.08982665e-01  -1.23700279e-01  -1.02398235e-01  -3.28047673e-02
   -5.13051938e-02  -1.10252355e-01  -1.04437809e-01  -1.17563735e-01
   -7.11913391e-03  -2.86840602e-02  -4.15867477e-02  -1.03112043e-02
   -1.26392959e-01  -9.69469008e-04  -1.23647898e-01  -1.14183120e-01
   -3.75914319e-03  -1.18069524e-01  -5.29461909e-02  -9.62736212e-02
   -3.90895883e-02  -6.36490395e-02  -4.64390347e-02  -6.80136630e-02
   -1.50110391e-02  -1.26706539e-01  -1.50893427e-02  -9.37370546e-02
   -8.15202139e-04  -9.19957063e-02  -5.23791534e-02  -3.94065473e-03
   -1.26180466e-01  -1.83992221e-04  -4.32039412e-02  -1.14470771e-01
   -5.96937328e-02  -8.10854273e-02  -1.13713168e-01  -1.27270304e-02
   -1.26492406e-01  -1.26046902e-01  -1.27808672e-02  -2.87899988e-02
   -1.21783363e-01  -5.16853224e-02  -2.31727321e-02  -2.60931347e-04
   -6.27375229e-02  -1.54776005e-02  -1.08465655e-01  -5.11047322e-02
   -1.16359721e-01  -2.49400628e-03  -1.35866355e-02  -2.88037760e-02
   -1.04822237e-01  -3.41518299e-02  -1.20051180e-01  -2.96169321e-02
   -1.12666172e-01  -1.78351080e-02  -5.76406184e-02  -6.55777834e-02
   -8.85722851e-04  -7.08345817e-02  -1.03206724e-01  -2.88693468e-03
   -3.65934493e-03  -7.53672528e-04  -1.49170510e-02  -9.44199325e-02
   -5.63590602e-03  -4.60832176e-02  -5.23419049e-03  -1.76060776e-02]
 [ -1.40317999e-01  -6.00994719e-02  -7.31751560e-02  -5.13436708e-02
   -1.30227282e-01  -8.44309106e-02  -1.77839350e-03  -1.11723990e-01
   -2.25412140e-03  -1.22203864e-01  -6.42144406e-03  -2.44965308e-02
   -8.80522102e-03  -1.34864050e-02  -7.32469588e-02  -1.20034026e-01
   -1.07579741e-01  -4.84402575e-03  -1.05199783e-01  -1.26772940e-01
   -9.92106572e-02  -8.21734994e-04  -1.23495012e-01  -2.42707979e-02
   -1.21548940e-01  -1.37963572e-01  -1.14205290e-01  -3.65873294e-02
   -5.72209524e-02  -1.22965031e-01  -1.16480037e-01  -1.31119451e-01
   -7.94000748e-03  -3.19914831e-02  -4.63819184e-02  -1.15001404e-02
   -1.40966732e-01  -1.08125388e-03  -1.37905151e-01  -1.27349034e-01
   -4.19259217e-03  -1.31683561e-01  -5.90511651e-02  -1.07374476e-01
   -4.35968233e-02  -7.09881085e-02  -5.17936996e-02  -7.58559960e-02
   -1.67418909e-02  -1.41316469e-01  -1.68292232e-02  -1.04545430e-01
   -9.09199232e-04  -1.02603295e-01  -5.84187452e-02  -4.39503295e-03
   -1.40729738e-01  -2.05207491e-04  -4.81855828e-02  -1.27669853e-01
   -6.65767341e-02  -9.04350034e-02  -1.26824894e-01  -1.41945239e-02
   -1.41077646e-01  -1.40580773e-01  -1.42545683e-02  -3.21096371e-02
   -1.35825625e-01  -5.76449118e-02  -2.58446700e-02  -2.91018103e-04
   -6.99714892e-02  -1.72622492e-02  -1.20972315e-01  -5.69973765e-02
   -1.29776609e-01  -2.78157832e-03  -1.51532460e-02  -3.21250028e-02
   -1.16908792e-01  -3.80897155e-02  -1.33893712e-01  -3.30319202e-02
   -1.25657174e-01  -1.98915898e-02  -6.42868848e-02  -7.31392466e-02
   -9.87851353e-04  -7.90021814e-02  -1.15107002e-01  -3.21981343e-03
   -4.08128664e-03  -8.40574933e-04  -1.66370654e-02  -1.05307047e-01
   -6.28575562e-03  -5.13968549e-02  -5.83772018e-03  -1.96361510e-02]
 [ -1.27432725e-01  -5.45805921e-02  -6.64555480e-02  -4.66288283e-02
   -1.18268629e-01  -7.66776969e-02  -1.61508524e-03  -1.01464478e-01
   -2.04712749e-03  -1.10981995e-01  -5.83176870e-03  -2.22470367e-02
   -7.99664559e-03  -1.22479607e-02  -6.65207573e-02  -1.09011411e-01
   -9.77007915e-02  -4.39920328e-03  -9.55393830e-02  -1.15131497e-01
   -9.01002328e-02  -7.46275817e-04  -1.12154577e-01  -2.20420326e-02
   -1.10387211e-01  -1.25294503e-01  -1.03717922e-01  -3.32275483e-02
   -5.19664044e-02  -1.11673264e-01  -1.05783781e-01  -1.19078872e-01
   -7.21088383e-03  -2.90537343e-02  -4.21227091e-02  -1.04440930e-02
   -1.28021885e-01  -9.81963322e-04  -1.25241446e-01  -1.15654688e-01
   -3.80759025e-03  -1.19591179e-01  -5.36285504e-02  -9.75143755e-02
   -3.95933667e-02  -6.44693351e-02  -4.70375313e-02  -6.88902089e-02
   -1.52044983e-02  -1.28339506e-01  -1.52838110e-02  -9.49451182e-02
   -8.25708294e-04  -9.31813278e-02  -5.30542050e-02  -3.99144107e-03
   -1.27806654e-01  -1.86363474e-04  -4.37607446e-02  -1.15946047e-01
   -6.04630532e-02  -8.21304394e-02  -1.15178679e-01  -1.28910537e-02
   -1.28122614e-01  -1.27671368e-01  -1.29455843e-02  -2.91610383e-02
   -1.23352882e-01  -5.23514320e-02  -2.34713774e-02  -2.64294176e-04
   -6.35460710e-02  -1.56770726e-02  -1.09863538e-01  -5.17633593e-02
   -1.17859341e-01  -2.52614852e-03  -1.37617372e-02  -2.91749930e-02
   -1.06173164e-01  -3.45919716e-02  -1.21598374e-01  -2.99986290e-02
   -1.14118190e-01  -1.80649632e-02  -5.83834787e-02  -6.64229362e-02
   -8.97137862e-04  -7.17474830e-02  -1.04536831e-01  -2.92414089e-03
   -3.70650581e-03  -7.63385702e-04  -1.51092988e-02  -9.56367969e-02
   -5.70854040e-03  -4.66771285e-02  -5.30164765e-03  -1.78329811e-02]
 [ -4.94433284e-03  -2.11770260e-03  -2.57844559e-03  -1.80917772e-03
   -4.58876999e-03  -2.97506040e-03  -6.26645863e-05  -3.93677643e-03
   -7.94276325e-05  -4.30605184e-03  -2.26270022e-04  -8.63175089e-04
   -3.10266278e-04  -4.75215408e-04  -2.58097568e-03  -4.22959407e-03
   -3.79074708e-03  -1.70687123e-04  -3.70688540e-03  -4.46705066e-03
   -3.49584880e-03  -2.89551685e-05  -4.35154751e-03  -8.55221024e-04
   -4.28297451e-03  -4.86137076e-03  -4.02420908e-03  -1.28921404e-03
   -2.01627329e-03  -4.33287279e-03  -4.10436348e-03  -4.62020704e-03
   -2.79779073e-04  -1.12727192e-03  -1.63434230e-03  -4.05226144e-04
   -4.96719199e-03  -3.80997384e-05  -4.85931219e-03  -4.48735026e-03
   -1.47732801e-04  -4.64008435e-03  -2.08076381e-03  -3.78351423e-03
   -1.53620495e-03  -2.50138142e-03  -1.82503521e-03  -2.67290934e-03
   -5.89927744e-04  -4.97951554e-03  -5.93005041e-04  -3.68382819e-03
   -3.20371131e-05  -3.61539391e-03  -2.05847946e-03  -1.54866131e-04
   -4.95884110e-03  -7.23081958e-06  -1.69789735e-03  -4.49865484e-03
   -2.34593947e-03  -3.18662437e-03  -4.46888133e-03  -5.00167128e-04
   -4.97110021e-03  -4.95359208e-03  -5.02282891e-04  -1.13143527e-03
   -4.78603673e-03  -2.03121219e-03  -9.10678964e-04  -1.02544960e-05
   -2.46555918e-03  -6.08263415e-04  -4.26265621e-03  -2.00839523e-03
   -4.57288980e-03  -9.80134345e-05  -5.33949258e-04  -1.13197670e-03
   -4.11947135e-03  -1.34215305e-03  -4.71796262e-03  -1.16393341e-03
   -4.42773483e-03  -7.00912506e-04  -2.26525290e-03  -2.57718027e-03
   -3.48085485e-05  -2.78377030e-03  -4.05598236e-03  -1.13455361e-04
   -1.43810770e-04  -2.96190244e-05  -5.86234047e-04  -3.71066502e-03
   -2.21488819e-04  -1.81105174e-03  -2.05701561e-04  -6.91911703e-04]
 [  1.42344313e-01   6.09673605e-02   7.42318688e-02   5.20851180e-02
    1.32107877e-01   8.56501662e-02   1.80407505e-03   1.13337381e-01
    2.28667287e-03   1.23968594e-01   6.51417529e-03   2.48502820e-02
    8.93237605e-03   1.36811604e-02   7.43047085e-02   1.21767422e-01
    1.09133286e-01   4.91397769e-03   1.06718960e-01   1.28603652e-01
    1.00643345e-01   8.33601560e-04   1.25278387e-01   2.46212893e-02
    1.23304212e-01   1.39955886e-01   1.15854514e-01   3.71156822e-02
    5.80472726e-02   1.24740753e-01   1.18162110e-01   1.33012930e-01
    8.05466809e-03   3.24534679e-02   4.70517136e-02   1.16662124e-02
    1.43002414e-01   1.09686813e-03   1.39896621e-01   1.29188065e-01
    4.25313684e-03   1.33585186e-01   5.99039152e-02   1.08925057e-01
    4.42263993e-02   7.20132384e-02   5.25416455e-02   7.69514224e-02
    1.69836583e-02   1.43357201e-01   1.70722518e-02   1.06055157e-01
    9.22328858e-04   1.04084976e-01   5.92623626e-02   4.45850104e-03
    1.42761997e-01   2.08170866e-04   4.88814244e-02   1.29513517e-01
    6.75381599e-02   9.17409634e-02   1.28656356e-01   1.43995052e-02
    1.43114929e-01   1.42610881e-01   1.44604167e-02   3.25733281e-02
    1.37787065e-01   5.84773544e-02   2.62178894e-02   2.95220657e-04
    7.09819382e-02   1.75115310e-02   1.22719261e-01   5.78204681e-02
    1.31650696e-01   2.82174673e-03   1.53720720e-02   3.25889157e-02
    1.18597056e-01   3.86397640e-02   1.35827253e-01   3.35089298e-02
    1.27471773e-01   2.01788416e-02   6.52152433e-02   7.41954409e-02
    1.00211678e-03   8.01430415e-02   1.16769247e-01   3.26631033e-03
    4.14022397e-03   8.52713565e-04   1.68773190e-02   1.06827772e-01
    6.37652738e-03   5.21390701e-02   5.92202192e-03   1.99197140e-02]
 [ -1.14328196e-01  -4.89678034e-02  -5.96215996e-02  -4.18337582e-02
   -1.06106488e-01  -6.87925550e-02  -1.44899814e-03  -9.10303902e-02
   -1.83661138e-03  -9.95691744e-02  -5.23205946e-03  -1.99592653e-02
   -7.17431149e-03  -1.09884431e-02  -5.96801031e-02  -9.78012355e-02
   -8.76537421e-02  -3.94681173e-03  -8.57146019e-02  -1.03291963e-01
   -8.08347861e-02  -6.69532632e-04  -1.00621175e-01  -1.97753428e-02
   -9.90355554e-02  -1.12409857e-01  -9.30521021e-02  -2.98105973e-02
   -4.66224454e-02  -1.00189357e-01  -9.49055187e-02  -1.06833410e-01
   -6.46935344e-03  -2.60659970e-02  -3.77910253e-02  -9.37007591e-03
   -1.14856770e-01  -8.80983240e-04  -1.12362257e-01  -1.03761352e-01
   -3.41603716e-03  -1.07293034e-01  -4.81136647e-02  -8.74864963e-02
   -3.55217876e-02  -5.78396387e-02  -4.22004323e-02  -6.18058924e-02
   -1.36409455e-02  -1.15141728e-01  -1.37121021e-02  -8.51814482e-02
   -7.40796679e-04  -8.35990370e-02  -4.75983821e-02  -3.58098170e-03
   -1.14663672e-01  -1.67198808e-04  -3.92606136e-02  -1.04022749e-01
   -5.42453423e-02  -7.36845654e-02  -1.03334294e-01  -1.15654037e-02
   -1.14947140e-01  -1.14542298e-01  -1.16143267e-02  -2.61622664e-02
   -1.10667903e-01  -4.69678787e-02  -2.10577011e-02  -2.37115516e-04
   -5.70113184e-02  -1.40649227e-02  -9.85657340e-02  -4.64402804e-02
   -1.05739290e-01  -2.26637233e-03  -1.23465506e-02  -2.61747861e-02
   -9.52548592e-02  -3.10347103e-02  -1.09093820e-01  -2.69137235e-02
   -1.02382860e-01  -1.62072549e-02  -5.23796206e-02  -5.95923414e-02
   -8.04880797e-04  -6.43693391e-02  -9.37867983e-02  -2.62343721e-03
   -3.32534772e-03  -6.84883024e-04  -1.35555359e-02  -8.58019982e-02
   -5.12150332e-03  -4.18770915e-02  -4.75645334e-03  -1.59991286e-02]
 [ -4.00421329e-02  -1.71504087e-02  -2.08817781e-02  -1.46517916e-02
   -3.71625746e-02  -2.40937995e-02  -5.07494899e-04  -3.18823449e-02
   -6.43251965e-04  -3.48729557e-02  -1.83246852e-03  -6.99050262e-03
   -2.51271991e-03  -3.84857556e-03  -2.09022682e-02  -3.42537555e-02
   -3.06997129e-02  -1.38232532e-03  -3.00205514e-02  -3.61768194e-02
   -2.83114521e-02  -2.34496087e-04  -3.52414066e-02  -6.92608589e-03
   -3.46860618e-02  -3.93702569e-02  -3.25904263e-02  -1.04408181e-02
   -1.63289741e-02  -3.50901676e-02  -3.32395640e-02  -3.74171705e-02
   -2.26581648e-03  -9.12931502e-03  -1.32358710e-02  -3.28176109e-03
   -4.02272598e-02  -3.08554226e-04  -3.93535854e-02  -3.63412176e-02
   -1.19642764e-03  -3.75781486e-02  -1.68512565e-02  -3.06411369e-02
   -1.24410967e-02  -2.02576668e-02  -1.47802150e-02  -2.16468014e-02
   -4.77758393e-03  -4.03270632e-02  -4.80250571e-03  -2.98338204e-02
   -2.59455498e-04  -2.92795991e-02  -1.66707847e-02  -1.25419757e-03
   -4.01596294e-02  -5.85594555e-05  -1.37505774e-02  -3.64327688e-02
   -1.89988059e-02  -2.58071697e-02  -3.61916453e-02  -4.05064935e-03
   -4.02589110e-02  -4.01171198e-02  -4.06778405e-03  -9.16303226e-03
   -3.87601574e-02  -1.64499582e-02  -7.37521711e-03  -8.30469763e-05
   -1.99675571e-02  -4.92607705e-03  -3.45215122e-02  -1.62651729e-02
   -3.70339674e-02  -7.93770788e-04  -4.32423703e-03  -9.16741714e-03
   -3.33619165e-02  -1.08695496e-02  -3.82088530e-02  -9.42622146e-03
   -3.58584166e-02  -5.67640421e-03  -1.83453584e-02  -2.08715307e-02
   -2.81900222e-04  -2.25446191e-02  -3.28477451e-02  -9.18828645e-04
   -1.16466471e-03  -2.39872385e-04  -4.74767019e-03  -3.00511609e-02
   -1.79374751e-03  -1.46669686e-02  -1.66589296e-03  -5.60351038e-03]
 [ -1.13147639e-01  -4.84621599e-02  -5.90059446e-02  -4.14017812e-02
   -1.05010829e-01  -6.80822004e-02  -1.43403573e-03  -9.00904068e-02
   -1.81764645e-03  -9.85410191e-02  -5.17803300e-03  -1.97531651e-02
   -7.10022926e-03  -1.08749760e-02  -5.90638439e-02  -9.67913361e-02
   -8.67486261e-02  -3.90605679e-03  -8.48295095e-02  -1.02225366e-01
   -8.00000829e-02  -6.62619011e-04  -9.95821563e-02  -1.95711418e-02
   -9.80129104e-02  -1.11249109e-01  -9.20912424e-02  -2.95027719e-02
   -4.61410202e-02  -9.91547981e-02  -9.39255205e-02  -1.05730244e-01
   -6.40255064e-03  -2.57968385e-02  -3.74007936e-02  -9.27332013e-03
   -1.13670754e-01  -8.71886172e-04  -1.11202000e-01  -1.02689908e-01
   -3.38076302e-03  -1.06185122e-01  -4.76168411e-02  -8.65831072e-02
   -3.51549882e-02  -5.72423843e-02  -4.17646690e-02  -6.11676823e-02
   -1.35000885e-02  -1.13952770e-01  -1.35705104e-02  -8.43018612e-02
   -7.33147183e-04  -8.27357900e-02  -4.71068793e-02  -3.54400434e-03
   -1.13479650e-01  -1.65472307e-04  -3.88552069e-02  -1.02948606e-01
   -5.36852027e-02  -7.29236956e-02  -1.02267260e-01  -1.14459789e-02
   -1.13760191e-01  -1.13359530e-01  -1.14943967e-02  -2.58921138e-02
   -1.09525142e-01  -4.64828865e-02  -2.08402585e-02  -2.34667051e-04
   -5.64226172e-02  -1.39196877e-02  -9.75479403e-02  -4.59607362e-02
   -1.04647421e-01  -2.24296968e-03  -1.22190596e-02  -2.59045042e-02
   -9.42712537e-02  -3.07142446e-02  -1.07967313e-01  -2.66358114e-02
   -1.01325650e-01  -1.60398981e-02  -5.18387466e-02  -5.89769885e-02
   -7.96569565e-04  -6.37046587e-02  -9.28183521e-02  -2.59634749e-03
   -3.29101005e-03  -6.77810895e-04  -1.34155608e-02  -8.49160034e-02
   -5.06861848e-03  -4.14446670e-02  -4.70733801e-03  -1.58339210e-02]
 [ -2.04282876e-02  -8.74962088e-03  -1.06532529e-02  -7.47490186e-03
   -1.89592239e-02  -1.22919293e-02  -2.58908579e-04  -1.62654101e-02
   -3.28167737e-04  -1.77911294e-02  -9.34870129e-04  -3.56634344e-03
   -1.28191385e-03  -1.96342709e-03  -1.06637063e-02  -1.74752322e-02
   -1.56620669e-02  -7.05220653e-04  -1.53155792e-02  -1.84563213e-02
   -1.44436483e-02  -1.19632826e-04  -1.79791019e-02  -3.53347997e-03
   -1.76957818e-02  -2.00855167e-02  -1.66266518e-02  -5.32659026e-03
   -8.33054973e-03  -1.79019444e-02  -1.69578223e-02  -1.90891110e-02
   -1.15595118e-03  -4.65750097e-03  -6.75254189e-03  -1.67425545e-03
   -2.05227338e-02  -1.57415053e-04  -2.00770114e-02  -1.85401923e-02
   -6.10381270e-04  -1.91712372e-02  -8.59700245e-03  -1.56321832e-02
   -6.34707200e-03  -1.03348501e-02  -7.54041958e-03  -1.10435447e-02
   -2.43737912e-03  -2.05736504e-02  -2.45009346e-03  -1.52203147e-02
   -1.32366364e-04  -1.49375677e-02  -8.50493118e-03  -6.39853742e-04
   -2.04882308e-02  -2.98752667e-05  -7.01512955e-03  -1.85868990e-02
   -9.69261732e-03  -1.31660390e-02  -1.84638850e-02  -2.06651904e-03
   -2.05388812e-02  -2.04665436e-02  -2.07526064e-03  -4.67470249e-03
   -1.97742624e-02  -8.39227214e-03  -3.76261316e-03  -4.23680607e-05
   -1.01868450e-02  -2.51313582e-03  -1.76118336e-02  -8.29800029e-03
   -1.88936124e-02  -4.04957897e-04  -2.20609521e-03  -4.67693952e-03
   -1.70202428e-02  -5.54531611e-03  -1.94930035e-02  -4.80897367e-03
   -1.82938818e-02  -2.89593009e-03  -9.35924812e-03  -1.06480250e-02
   -1.43816985e-04  -1.15015842e-02  -1.67579281e-02  -4.68758642e-04
   -5.94176782e-04  -1.22375651e-04  -2.42211803e-03  -1.53311953e-02
   -9.15115838e-04  -7.48264469e-03  -8.49888305e-04  -2.85874186e-03]]

1 个答案:

答案 0 :(得分:4)

你需要帮助python正确地破解这条线:

self.who += self.lr * numpy.dot
    ((output_errors * final_outputs * (1.0 - final_outputs)),numpy.transpose(hidden_outputs))

python"打破界线"在numpy.dot之后,因为它没有线索进一步提示 另一方面,当你print

print (numpy.dot
    ((output_errors * final_outputs * (1.0 - final_outputs)),numpy.transpose(hidden_outputs)))

整个expressin在括号中,所以python知道完全读它。

<强>解决方案
您可以将表达式放在括号中:

 self.who += (self.lr * numpy.dot
    ((output_errors * final_outputs * (1.0 - final_outputs)),numpy.transpose(hidden_outputs)))

或者,为python添加一个指示以继续阅读

self.who += self.lr * numpy.dot \
    ((output_errors * final_outputs * (1.0 - final_outputs)),numpy.transpose(hidden_outputs)) 

有关详细信息,请参阅this thread