avatarRobert Shaneyfelt

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

3085

Abstract

similar to an Excel spreadsheet.</p><p id="dd44">Matplotlib — A library for plotting two-dimensional plotting library for creating graphs and plots.</p><p id="1cd5">Scikit-learn — provides algorithms such as decision trace and neural networks.</p><p id="971f">There is a better code editor for python and machine learning projects called <a href="https://jupyter.org">Jupyter.</a> Jupyter makes the inspecting of data much easier.</p><p id="de6f">It’s best to use anaconda to install Jupyter, with Anaconda, <a href="https://anaconda.com/#macroes">it’s available here.</a></p><p id="46f7"><b>WHAT ARE ARTIFICIAL NEURAL NETWORK</b></p><p id="d955">Artificial neural networks (ANNs) are software implementations of the neuronal structure of our brains.</p><p id="d5dd">The neural network in a person’s brain is a hugely interconnected network of neurons, where the output of any given neuron may be the input to thousands of other neurons. Learning occurs by repeatedly activating certain neural connections over others, and this reinforces those connections.</p><p id="556e">Artificial neural networks attempt to simplify and mimic this brain-behavior</p><p id="3500">An example is an e-mail spam filter. The input training data could be the count of various words in the body of the email, and the output training data would be a classification of whether the e-mail was truly spam or not.</p><p id="b988">If many examples of e-mails are passed through the neural network, this allows the network to learn what input data makes it likely that an e-mail is spam or not.</p><p id="8f46"><b>Nodes</b></p><p id="7cf9">As mentioned previously, connected biological neurons are hierarchical networks, with the outputs of some neurons being the inputs to others.</p><p id="2948">We can represent these networks as connected layers of nodes.</p><p id="063d">Each node takes multiple weighted inputs, applies an activation function to the summation of these inputs, and in doing so generates an output.</p><figure id="7a58"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*3RgH1O-Kc25bH2yUwwA7GA.png"><figcaption></figcaption></figure><p id="f2b9">The circle in the image above represents the node</p><p id="1185">The most common simple neural network structure consists of an input layer, a hidden layer, and an output layer.</p><p id="7b3f">Note: neural networks can have many hidden layers.</p><p id="d52c"><b>THE FEED-FORWARD PASS</b></p><p id="10a3">To demonstrate how to calculate the output from the input in neural networks, let’s start with the specific case of the three-layer neural network.</p><p id="ae15">It will be demonstrated with a concrete example and some Python code, let’s start with the specific case of the three layer neural network. Below it is presented in equation form, then it will be demonstrated with a concrete example and some Python code.</p><p id="1d5f">ℎ1 (2) = 𝑓(𝑤11 (1) 𝑥1 + 𝑤12 (1) 𝑥2 + 𝑤13 (1) 𝑥3 + 𝑏1 (1))</p><p id="e603">ℎ2 (2) = 𝑓(𝑤21 (1) 𝑥1 + 𝑤22 (1) 𝑥2 + 𝑤23 (1) 𝑥3 + 𝑏2 (1))</p><p id="7b67">ℎ3 (2) = 𝑓(𝑤31 (1) 𝑥

Options

1 + 𝑤32 (1) 𝑥2 + 𝑤33 (1) 𝑥3 + 𝑏3 (1))</p><p id="dd96">ℎ𝑊, 𝑏(𝑥) = ℎ1 (3) = 𝑓(𝑤11 (2) ℎ1 (2) + 𝑤12 (2) ℎ2 (2) + 𝑤13 (2) ℎ3 (2) + 𝑏1 (2))</p><p id="20cc">The final line is the output of the only node in the third and final layer, which is the ultimate output of the neural network.</p><p id="8ae9">As can be observed, rather than taking the weighted input variables (𝑥1, 𝑥2, 𝑥3), the final node takes as input the weighted output of the nodes of the second layer (ℎ1 (2), ℎ2 (2), ℎ3 (2)), plus the weighted bias.</p><p id="48cb"><b>A feed-forward example</b></p><p id="347f">A simple first example of the output of this neural network in Python.</p><p id="fe9f">Notice that the weights between layers 1 and 2 (𝑤11 (1), 𝑤12 (1), …) are ideally suited to the matrix representation</p><p id="dae9">I described earlier the python supplied library Nunply for data and matrix manipulation. The python code that implements this is actually pretty simple.</p><p id="37ac"><b>Matrix multiplication (Linear algebra)</b></p><p id="27f6">Let’s expand out 𝑧 (𝑙+1) = 𝑊(𝑙)ℎ (𝑙) + 𝑏 (𝑙) in explicit matrix/vector form for the input layer (i.e., ℎ (𝑙) = 𝑥) This is done effortlessly in the Numbly python library. No need to reinvent the wheel.</p><div id="5273" class="link-block"> <a href="https://br-shaneyfelt.medium.com/subscribe"> <div> <div> <h2>Get an email whenever Robert Shaneyfelt publishes.</h2> <div><h3>Get an email whenever Robert Shaneyfelt publishes. I write both fiction and non-fiction. More poetry to come. By…</h3></div> <div><p>br-shaneyfelt.medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*e5aG6D45u-NIR8G9)"></div> </div> </div> </a> </div><div id="e02f" class="link-block"> <a href="https://readmedium.com/about-me-robert-shaneyfelt-61fc0cd70dd7"> <div> <div> <h2>About Me — Robert Shaneyfelt</h2> <div><h3>Jack of all trades, master of some.</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*zrnl17Iwn_q3tgCNWxjY0Q.jpeg)"></div> </div> </div> </a> </div><div id="8854" class="link-block"> <a href="https://www.amazon.com/author/bshaneyfelt"> <div> <div> <h2>Robert Russell Shaneyfelt </h2> <div><h3>undefined</h3></div> <div><p>undefined</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*usEY_y5v6qW8-fx0)"></div> </div> </div> </a> </div><h2 id="e9fb">Copyright © 2022, Robert Shaneyfelt All rights reserved</h2></article></body>

Python Programming Language

The popular language used in Artificial Intelligence or Machine Learning.

Geralt pixel bay.com

To write properly about artificial intelligence, you either must be heavy on its theory or its implementation. What else is there?

To discuss the theory of artificial intelligence or machine learning, you end up using high-level math concepts such as matrices used in linear algebra and derivatives from calculus.

To discuss its implementation, you can’t avoid discussing its programming language. I will start by discussing the python programming language with an example of a neural network-based algorithm showing an implementation. Fortunately, the difficult parts of implementing neural networks in python are provided in its rich libraries.

The popular programming language, Python, is used for Artificial Intelligence or machine learning. It is used for automation, website, and application development, such as Instagram and Dropbox.

It is available at python.org. Likewise, it has versions for Linux, and Windows as well as macOS.

A good code editor for python is Pycharm, available from JetBrains. The community version of the code editor is open source and free, whereas the professional version of the code editor has a charge.

Python is an interpreted language, in the screenshot below, I placed some rudimentary python commands. To run the program, choose the run pull-down menu near the top center of the code editor.

Machine learning or artificial intelligence example

  1. imports the data
  2. clean the data — remove duplicate data. If the data is text-based. Convert the data to numerical, values.
  3. Split the data into training and test sets — Make sure our model produces the correct result.
  4. Create a model — Select an algorithm to analyze the data. Decision trace, Neural networks… Each algorithm has pros and cons. What makes python such a popular language in AI is there are libraries that already exist that implemented many of the algorithms. The library I will use is pcikit-learn.
  5. Train the model.
  6. Make predictions.-When you start out, it’s very likely your predictions are inaccurate.
  7. Evaluate and improve.

Useful, libraries that python provides for machine learning.

Numpy — for providing multidimensional arrays.

Pandas — A data analysts library that provides a concept called data framing. A data frame is a two-dimensional object, similar to an Excel spreadsheet.

Matplotlib — A library for plotting two-dimensional plotting library for creating graphs and plots.

Scikit-learn — provides algorithms such as decision trace and neural networks.

There is a better code editor for python and machine learning projects called Jupyter. Jupyter makes the inspecting of data much easier.

It’s best to use anaconda to install Jupyter, with Anaconda, it’s available here.

WHAT ARE ARTIFICIAL NEURAL NETWORK

Artificial neural networks (ANNs) are software implementations of the neuronal structure of our brains.

The neural network in a person’s brain is a hugely interconnected network of neurons, where the output of any given neuron may be the input to thousands of other neurons. Learning occurs by repeatedly activating certain neural connections over others, and this reinforces those connections.

Artificial neural networks attempt to simplify and mimic this brain-behavior

An example is an e-mail spam filter. The input training data could be the count of various words in the body of the email, and the output training data would be a classification of whether the e-mail was truly spam or not.

If many examples of e-mails are passed through the neural network, this allows the network to learn what input data makes it likely that an e-mail is spam or not.

Nodes

As mentioned previously, connected biological neurons are hierarchical networks, with the outputs of some neurons being the inputs to others.

We can represent these networks as connected layers of nodes.

Each node takes multiple weighted inputs, applies an activation function to the summation of these inputs, and in doing so generates an output.

The circle in the image above represents the node

The most common simple neural network structure consists of an input layer, a hidden layer, and an output layer.

Note: neural networks can have many hidden layers.

THE FEED-FORWARD PASS

To demonstrate how to calculate the output from the input in neural networks, let’s start with the specific case of the three-layer neural network.

It will be demonstrated with a concrete example and some Python code, let’s start with the specific case of the three layer neural network. Below it is presented in equation form, then it will be demonstrated with a concrete example and some Python code.

ℎ1 (2) = 𝑓(𝑤11 (1) 𝑥1 + 𝑤12 (1) 𝑥2 + 𝑤13 (1) 𝑥3 + 𝑏1 (1))

ℎ2 (2) = 𝑓(𝑤21 (1) 𝑥1 + 𝑤22 (1) 𝑥2 + 𝑤23 (1) 𝑥3 + 𝑏2 (1))

ℎ3 (2) = 𝑓(𝑤31 (1) 𝑥1 + 𝑤32 (1) 𝑥2 + 𝑤33 (1) 𝑥3 + 𝑏3 (1))

ℎ𝑊, 𝑏(𝑥) = ℎ1 (3) = 𝑓(𝑤11 (2) ℎ1 (2) + 𝑤12 (2) ℎ2 (2) + 𝑤13 (2) ℎ3 (2) + 𝑏1 (2))

The final line is the output of the only node in the third and final layer, which is the ultimate output of the neural network.

As can be observed, rather than taking the weighted input variables (𝑥1, 𝑥2, 𝑥3), the final node takes as input the weighted output of the nodes of the second layer (ℎ1 (2), ℎ2 (2), ℎ3 (2)), plus the weighted bias.

A feed-forward example

A simple first example of the output of this neural network in Python.

Notice that the weights between layers 1 and 2 (𝑤11 (1), 𝑤12 (1), …) are ideally suited to the matrix representation

I described earlier the python supplied library Nunply for data and matrix manipulation. The python code that implements this is actually pretty simple.

Matrix multiplication (Linear algebra)

Let’s expand out 𝑧 (𝑙+1) = 𝑊(𝑙)ℎ (𝑙) + 𝑏 (𝑙) in explicit matrix/vector form for the input layer (i.e., ℎ (𝑙) = 𝑥) This is done effortlessly in the Numbly python library. No need to reinvent the wheel.

Copyright © 2022, Robert Shaneyfelt All rights reserved

Artificial Intelligence
Machine Lea
Writing
Illumination
Programming
Recommended from ReadMedium