Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.60 KB | None | 0 0
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 4,
  6. "metadata": {},
  7. "outputs": [
  8. {
  9. "name": "stdout",
  10. "output_type": "stream",
  11. "text": [
  12. "Feature : [1. 0. 0. 1. 0.] Target : [0. 1.]\n",
  13. "Feature : [1. 1. 0. 0. 1.] Target : [1. 0.]\n",
  14. "Feature : [1. 1. 1. 0. 1.] Target : [1. 0.]\n",
  15. "Feature : [1. 1. 0. 1. 1.] Target : [1. 0.]\n",
  16. "Feature : [0. 0. 1. 1. 1.] Target : [0. 1.]\n",
  17. "Feature : [0. 0. 0. 1. 1.] Target : [0. 1.]\n",
  18. "Feature : [1. 1. 1. 1. 1.] Target : [1. 0.]\n",
  19. "Feature : [0. 0. 0. 0. 0.] Target : [0. 1.]\n",
  20. "Feature : [1. 0. 1. 1. 0.] Target : [0. 1.]\n",
  21. "Feature : [1. 0. 1. 1. 1.] Target : [1. 0.]\n",
  22. "Feature : [1. 0. 0. 0. 0.] Target : [0. 1.]\n",
  23. "Feature : [0. 1. 0. 1. 1.] Target : [0. 1.]\n",
  24. "Feature : [0. 0. 0. 0. 1.] Target : [0. 1.]\n",
  25. "Feature : [1. 1. 1. 1. 0.] Target : [0. 1.]\n",
  26. "Feature : [1. 0. 0. 0. 1.] Target : [1. 0.]\n",
  27. "Feature : [0. 1. 1. 1. 1.] Target : [0. 1.]\n",
  28. "Feature : [1. 1. 0. 0. 0.] Target : [0. 1.]\n",
  29. "Feature : [1. 0. 0. 1. 1.] Target : [1. 0.]\n",
  30. "Feature : [1. 1. 0. 1. 0.] Target : [0. 1.]\n",
  31. "Feature : [1. 1. 1. 0. 0.] Target : [0. 1.]\n",
  32. "Feature : [0. 0. 1. 0. 1.] Target : [0. 1.]\n",
  33. "Feature : [1. 0. 1. 0. 1.] Target : [1. 0.]\n"
  34. ]
  35. }
  36. ],
  37. "source": [
  38. "import numpy as np\n",
  39. "\n",
  40. "# You should write your target function in this space\n",
  41. "#====================================================\n",
  42. "\n",
  43. "\n",
  44. "\n",
  45. "\n",
  46. "\n",
  47. "\n",
  48. "\n",
  49. "#=====================================================\n",
  50. " \n",
  51. "\n",
  52. "## Set up training data\n",
  53. "## Each row is a case\n",
  54. "## Columns 0-4 are features\n",
  55. "## Columns 5 & 6 are targets\n",
  56. "\n",
  57. "features_and_targets = np.array( \n",
  58. " [ [0, 0, 0, 0, 0, 0, 1],\n",
  59. " [0, 0, 0, 0, 1, 0, 1],\n",
  60. " [0, 0, 0, 1, 1, 0, 1],\n",
  61. " [0, 0, 1, 1, 1, 0, 1],\n",
  62. " [0, 1, 1, 1, 1, 0, 1],\n",
  63. " [1, 1, 1, 1, 0, 0, 1],\n",
  64. " [1, 1, 1, 0, 0, 0, 1],\n",
  65. " [1, 1, 0, 0, 0, 0, 1],\n",
  66. " [1, 0, 0, 0, 0, 0, 1],\n",
  67. " [1, 0, 0, 1, 0, 0, 1],\n",
  68. " [1, 0, 1, 1, 0, 0, 1],\n",
  69. " [1, 1, 0, 1, 0, 0, 1],\n",
  70. " [0, 1, 0, 1, 1, 0, 1],\n",
  71. " [0, 0, 1, 0, 1, 0, 1],\n",
  72. " [1, 0, 1, 1, 1, 1, 0],\n",
  73. " [1, 1, 0, 1, 1, 1, 0],\n",
  74. " [1, 0, 1, 0, 1, 1, 0],\n",
  75. " [1, 0, 0, 0, 1, 1, 0],\n",
  76. " [1, 1, 0, 0, 1, 1, 0],\n",
  77. " [1, 1, 1, 0, 1, 1, 0],\n",
  78. " [1, 1, 1, 1, 1, 1, 0],\n",
  79. " [1, 0, 0, 1, 1, 1, 0] ]\n",
  80. " , dtype=float)\n",
  81. "\n",
  82. "# shuffle our cases\n",
  83. "np.random.shuffle(features_and_targets)\n",
  84. "\n",
  85. "for i in range(22):\n",
  86. " features = features_and_targets[i,0:5]\n",
  87. " targets = features_and_targets[i,5:7]\n",
  88. " \n",
  89. " # Call your target function here based on x\n",
  90. " # to compute your target values based on random \n",
  91. " # values for all weights and biases then you can add\n",
  92. " # your predicted y's to the print statement\n",
  93. " \n",
  94. " print('Feature : ',features, ' Target : ', targets)\n",
  95. " \n",
  96. " "
  97. ]
  98. },
  99. {
  100. "cell_type": "code",
  101. "execution_count": null,
  102. "metadata": {},
  103. "outputs": [],
  104. "source": []
  105. }
  106. ],
  107. "metadata": {
  108. "kernelspec": {
  109. "display_name": "Python 3",
  110. "language": "python",
  111. "name": "python3"
  112. },
  113. "language_info": {
  114. "codemirror_mode": {
  115. "name": "ipython",
  116. "version": 3
  117. },
  118. "file_extension": ".py",
  119. "mimetype": "text/x-python",
  120. "name": "python",
  121. "nbconvert_exporter": "python",
  122. "pygments_lexer": "ipython3",
  123. "version": "3.6.5"
  124. }
  125. },
  126. "nbformat": 4,
  127. "nbformat_minor": 2
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement