Python,NumPy:神经网络教程,ValueError:形状未对齐

时间:2019-05-08 03:12:38

标签: python python-3.x numpy machine-learning neural-network

我正在尝试对具有3个输入节点,具有4个节点的隐藏层和1个输出节点的神经网络进行编码。 (这将在最终版本中有所变化,因此我将它们转换为变量。)即使我已将代码与教程进行了比较,并且看不到任何错误,但是当我尝试运行它时,它给我一个ValueError,说它不能对这些数组进行点乘。

这是我的第一个使用NumPy的项目,所以我对应该做的事情一无所知。

这是我的代码:

{
  "name": "testgame",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "babel-cli": "6.26.0",
    "babel-plugin-module-resolver": "^3.1.1",
    "babel-preset-es2015": "6.24.1",
    "jest-expo": "27.0.0",
    "react-native-scripts": "1.14.0",
    "react-test-renderer": "16.3.1"
  },
  "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
  "scripts": {
    "start": "react-native-scripts start",
    "eject": "react-native-scripts eject",
    "android": "react-native-scripts android",
    "ios": "react-native-scripts ios",
    "test": "jest"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@expo/vector-icons": "^8.1.0",
    "bignumber.js": "^8.1.1",
    "crypto-browserify": "^3.12.0",
    "eth-lightwallet": "^3.0.1",
    "ethereumjs-tx": "^1.3.7",
    "ethereumjs-util": "^6.0.0",
    "ethereumjs-wallet-react-native": "^0.6.7",
    "expo": "^30.0.0",
    "expokit": "^1.8.0",
    "formik": "^1.3.2",
    "js-sha3": "^0.8.0",
    "native-base": "^2.8.2",
    "node-libs-browser": "2.1.0",
    "react": "16.3.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz",
    "react-native-confirmation-code-input": "^1.0.4",
    "react-native-fast-crypto": "^1.8.1",
    "react-native-fetch-blob": "git+https://github.com/HCL-HO/react-native-fetch-blob-expo.git",
    "react-native-fs": "^2.13.3",
    "react-native-keychain": "^3.1.2",
    "react-native-pin-view": "^2.2.1",
    "react-native-secure-randombytes": "^3.0.0",
    "react-native-touch-id": "^4.4.1",
    "react-navigation": "3.0.4",
    "web3": "1.0.0-beta.34",
    "yup": "^0.26.6"
  }
}

我希望程序至少可以运行,但是它给我以下错误:

Xcode

1 个答案:

答案 0 :(得分:0)

我发现了我的问题:我正在倒退l1_error的点积!

l1_error = np.dot(l2_nudge, syn1.T)