Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 4,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Feature : [1. 0. 0. 1. 0.] Target : [0. 1.]\n",
- "Feature : [1. 1. 0. 0. 1.] Target : [1. 0.]\n",
- "Feature : [1. 1. 1. 0. 1.] Target : [1. 0.]\n",
- "Feature : [1. 1. 0. 1. 1.] Target : [1. 0.]\n",
- "Feature : [0. 0. 1. 1. 1.] Target : [0. 1.]\n",
- "Feature : [0. 0. 0. 1. 1.] Target : [0. 1.]\n",
- "Feature : [1. 1. 1. 1. 1.] Target : [1. 0.]\n",
- "Feature : [0. 0. 0. 0. 0.] Target : [0. 1.]\n",
- "Feature : [1. 0. 1. 1. 0.] Target : [0. 1.]\n",
- "Feature : [1. 0. 1. 1. 1.] Target : [1. 0.]\n",
- "Feature : [1. 0. 0. 0. 0.] Target : [0. 1.]\n",
- "Feature : [0. 1. 0. 1. 1.] Target : [0. 1.]\n",
- "Feature : [0. 0. 0. 0. 1.] Target : [0. 1.]\n",
- "Feature : [1. 1. 1. 1. 0.] Target : [0. 1.]\n",
- "Feature : [1. 0. 0. 0. 1.] Target : [1. 0.]\n",
- "Feature : [0. 1. 1. 1. 1.] Target : [0. 1.]\n",
- "Feature : [1. 1. 0. 0. 0.] Target : [0. 1.]\n",
- "Feature : [1. 0. 0. 1. 1.] Target : [1. 0.]\n",
- "Feature : [1. 1. 0. 1. 0.] Target : [0. 1.]\n",
- "Feature : [1. 1. 1. 0. 0.] Target : [0. 1.]\n",
- "Feature : [0. 0. 1. 0. 1.] Target : [0. 1.]\n",
- "Feature : [1. 0. 1. 0. 1.] Target : [1. 0.]\n"
- ]
- }
- ],
- "source": [
- "import numpy as np\n",
- "\n",
- "# You should write your target function in this space\n",
- "#====================================================\n",
- "\n",
- "\n",
- "\n",
- "\n",
- "\n",
- "\n",
- "\n",
- "#=====================================================\n",
- " \n",
- "\n",
- "## Set up training data\n",
- "## Each row is a case\n",
- "## Columns 0-4 are features\n",
- "## Columns 5 & 6 are targets\n",
- "\n",
- "features_and_targets = np.array( \n",
- " [ [0, 0, 0, 0, 0, 0, 1],\n",
- " [0, 0, 0, 0, 1, 0, 1],\n",
- " [0, 0, 0, 1, 1, 0, 1],\n",
- " [0, 0, 1, 1, 1, 0, 1],\n",
- " [0, 1, 1, 1, 1, 0, 1],\n",
- " [1, 1, 1, 1, 0, 0, 1],\n",
- " [1, 1, 1, 0, 0, 0, 1],\n",
- " [1, 1, 0, 0, 0, 0, 1],\n",
- " [1, 0, 0, 0, 0, 0, 1],\n",
- " [1, 0, 0, 1, 0, 0, 1],\n",
- " [1, 0, 1, 1, 0, 0, 1],\n",
- " [1, 1, 0, 1, 0, 0, 1],\n",
- " [0, 1, 0, 1, 1, 0, 1],\n",
- " [0, 0, 1, 0, 1, 0, 1],\n",
- " [1, 0, 1, 1, 1, 1, 0],\n",
- " [1, 1, 0, 1, 1, 1, 0],\n",
- " [1, 0, 1, 0, 1, 1, 0],\n",
- " [1, 0, 0, 0, 1, 1, 0],\n",
- " [1, 1, 0, 0, 1, 1, 0],\n",
- " [1, 1, 1, 0, 1, 1, 0],\n",
- " [1, 1, 1, 1, 1, 1, 0],\n",
- " [1, 0, 0, 1, 1, 1, 0] ]\n",
- " , dtype=float)\n",
- "\n",
- "# shuffle our cases\n",
- "np.random.shuffle(features_and_targets)\n",
- "\n",
- "for i in range(22):\n",
- " features = features_and_targets[i,0:5]\n",
- " targets = features_and_targets[i,5:7]\n",
- " \n",
- " # Call your target function here based on x\n",
- " # to compute your target values based on random \n",
- " # values for all weights and biases then you can add\n",
- " # your predicted y's to the print statement\n",
- " \n",
- " print('Feature : ',features, ' Target : ', targets)\n",
- " \n",
- " "
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 3",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.6.5"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement