├── .gitattributes ├── README.md ├── LICENSE └── lect_1.ipynb /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Neural-Net-basics 2 | Here i will code the basics of the neural networks 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Abhinav Shukla 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /lect_1.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "### Coding Neurons and Layers" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 1, 13 | "metadata": {}, 14 | "outputs": [ 15 | { 16 | "name": "stdout", 17 | "output_type": "stream", 18 | "text": [ 19 | "2.3\n" 20 | ] 21 | } 22 | ], 23 | "source": [ 24 | "inputs = [1,2,3]\n", 25 | "weights = [0.2,0.8,-0.5]\n", 26 | "bias = 2\n", 27 | "\n", 28 | "outputs = (inputs[0] * weights[0] + inputs[1] * weights[1] + inputs[2] * weights[2] + bias)\n", 29 | "\n", 30 | "print(outputs)" 31 | ] 32 | }, 33 | { 34 | "cell_type": "markdown", 35 | "metadata": {}, 36 | "source": [ 37 | "#### coding our second neuron with 4 inputs" 38 | ] 39 | }, 40 | { 41 | "cell_type": "code", 42 | "execution_count": 3, 43 | "metadata": {}, 44 | "outputs": [ 45 | { 46 | "name": "stdout", 47 | "output_type": "stream", 48 | "text": [ 49 | "0.8\n" 50 | ] 51 | } 52 | ], 53 | "source": [ 54 | "inputs = [1,2,3,4]\n", 55 | "weights = [0.2,0.8,-0.5,0.3]\n", 56 | "bias = 2\n", 57 | "\n", 58 | "outputs = (inputs[0] * weights[0] + inputs[1] * weights[1] + inputs[2] * weights[2] + inputs[2] * weights[2] + bias)\n", 59 | "\n", 60 | "print(outputs)\n", 61 | "\n" 62 | ] 63 | }, 64 | { 65 | "cell_type": "code", 66 | "execution_count": 6, 67 | "metadata": {}, 68 | "outputs": [ 69 | { 70 | "name": "stdout", 71 | "output_type": "stream", 72 | "text": [ 73 | "[4.8, 1.21, 2.385]\n" 74 | ] 75 | } 76 | ], 77 | "source": [ 78 | "inputs = [1, 2, 3, 2.5]\n", 79 | "\n", 80 | "weights = [[0.2, 0.8, -0.5, 1],\n", 81 | " [0.5, -0.91, 0.26, -0.5],\n", 82 | " [-0.26, -0.27, 0.17, 0.87]]\n", 83 | "\n", 84 | "weights1 = weights[0] #LIST OF WEIGHTS ASSOCIATED WITH 1ST NEURON : W11, W12, W13, W14\n", 85 | "weights2 = weights[1] #LIST OF WEIGHTS ASSOCIATED WITH 2ND NEURON : W21, W22, W23, W24\n", 86 | "weights3 = weights[2] #LIST OF WEIGHTS ASSOCIATED WITH 3RD NEURON : W31, W32, W33, W34\n", 87 | "\n", 88 | "biases = [2, 3, 0.5]\n", 89 | "\n", 90 | "bias1 = 2\n", 91 | "bias2 = 3\n", 92 | "bias3 = 0.5\n", 93 | "\n", 94 | "outputs = [\n", 95 | " # Neuron 1:\n", 96 | " inputs[0]*weights1[0] +\n", 97 | " inputs[1]*weights1[1] +\n", 98 | " inputs[2]*weights1[2] +\n", 99 | " inputs[3]*weights1[3] + bias1,\n", 100 | " # Neuron 2:\n", 101 | " inputs[0]*weights2[0] +\n", 102 | " inputs[1]*weights2[1] +\n", 103 | " inputs[2]*weights2[2] +\n", 104 | " inputs[3]*weights2[3] + bias2,\n", 105 | " # Neuron 3:\n", 106 | " inputs[0]*weights3[0] +\n", 107 | " inputs[1]*weights3[1] +\n", 108 | " inputs[2]*weights3[2] +\n", 109 | " inputs[3]*weights3[3] + bias3]\n", 110 | "\n", 111 | "print(outputs)" 112 | ] 113 | }, 114 | { 115 | "cell_type": "code", 116 | "execution_count": null, 117 | "metadata": {}, 118 | "outputs": [], 119 | "source": [] 120 | }, 121 | { 122 | "cell_type": "code", 123 | "execution_count": null, 124 | "metadata": {}, 125 | "outputs": [], 126 | "source": [] 127 | } 128 | ], 129 | "metadata": { 130 | "kernelspec": { 131 | "display_name": "Python 3", 132 | "language": "python", 133 | "name": "python3" 134 | }, 135 | "language_info": { 136 | "codemirror_mode": { 137 | "name": "ipython", 138 | "version": 3 139 | }, 140 | "file_extension": ".py", 141 | "mimetype": "text/x-python", 142 | "name": "python", 143 | "nbconvert_exporter": "python", 144 | "pygments_lexer": "ipython3", 145 | "version": "3.12.4" 146 | } 147 | }, 148 | "nbformat": 4, 149 | "nbformat_minor": 2 150 | } 151 | --------------------------------------------------------------------------------