Table of contents:
By Ayan
In this project I will explain how machine learning (ML) works through pieces of code, and then I will describe how AI/ML can be used, and debate its advantages and disadvantages.
Just as we learn through examples and by processing various inputs, machines can do the same.
Cerebrum. Largest part of the brain. Divided into 2 hemispheres which each have 4 lobes…
Frontal - reasoning, problem-solving, emotional control
Parietal - manages sensory inputs like touch and temperature
Temporal - manages auditory information
Occipital - processes visual information
Cerebellum
Beneath cerebrum
10% of cranial cavity
More than 50% of the brain's neurons
Controls balance and complex movements --> requires abundance of wiring
Brainstem
The oldest part of the brain
Controls sleeping, breathing and keeping the heart going.
Also present in the brain are a variety of smaller structures, e.g. the hippocampus and hypothalamus.
AGI: artificial general intelligence - does anything a human can do
AI: artificial intelligence tuned to a specific purpose - e.g. a smart speaker, cars, web search, AI in industries like healthcare, farming and factories.
Let us imagine a scenario where we are predicting the price of a house, based on information such as the area, number of bedrooms and location. Given data, a machine can build a model to make such predictions.
Here's what we will do...
Import packages
Find some data (kaggle is great for this)
Visualise the data
Process the data (e.g. converting 'yes' and 'no' to 1s and 0s for the model to work)
Fit the data
Train the model
Evaluate the model's accuracy, e.g. root mean squared error (RMSE)
Linear regression essentially forms a 'line of best fit' - this is used in the code below. (Note that this is not the only form of machine learning, there are others such as decision trees, random forests and classification models such as logistic regression.)
The goal of a good model is to have a low cost, where the predicted values are close to the true values for an unseen set of observations.
Gradient descent is basically the model adjusting the weights, w, above, such that the overall cost is low. The model does this by essentially going down a cost function graph, as shown below, to find the minimum.
2 of the above pictures are from machine learning specialisation course by Andrew Ng (Coursera). Here is code that implements the Linear Regression model.
Neural networks can be programmed using a software package called keras, which is used to make layers containing nodes. Each node has a certain 'activation function' (such as sigmoid or ReLu which is used in the code below) and takes an input, performs a function, and provides an output. 'Forward propagation' consists of reducing numbers of nodes per layer, and the first layer has the same number of nodes as there are 'features' in a dataset. The neural network learns the relationship between the factors (we can do this by visualising the data using matplotlib - see below) and narrows down to 1 output node. In the code below this predicts the price of a house.
The human brain is a vastly complicated structure. Because we have almost no idea of how the brain actually works, we cannot precisely mimic it. In deep learning, neural networks use ‘nodes’ which are very different to human neurons and synapses, being much simpler.
The difference between human neurones and artificial ones is shown below.
We were able to to different models on the same dataset to make predictions for house prices. For this task and quite often neural networks can work better because they are a more complex model and are able to incorporate non-lineartities. However, it is recommended to start from simpler models to avoid overfitting. (See below.)
The optimiser Adam is used in the house prediction code above. The Adam algorithm improve gradient descent, illustrated below...
Activation functions are shown below.
Further improvement of machine learning models...
The model tries too hard to form a model such that the cost is very, very low. The noise and random fluctuations in the data are not ignored in the model, and the model will fail to generalise and perform well in the case of unseen problems. This is called overfitting. We can solve this problem in a number of ways...
Increasing the training data by data augmentation
Feature selection by choosing the best features and remove the useless/unnecessary features
Early stopping the training of deep learning models where the number of epochs is set high
Dropout techniques by randomly selecting nodes and removing them from training
Reducing the complexity of the model
Regularisation, which applies a penalty to the input parameters with large coefficients, limiting the model's variance. This is by far the most widely used way to limit overfitting.
Overfitting, as well as underfitting, is shown below.
Let's explore what language models can do.
Amazon can use a code like the one below to automatically anaylse a user sentiment for each product based on reviews. Of course it can also take your search terms and show you relevant products, personalized to you via your purchase history.
This code demonstrates AI's ability to use data to determine the overall feel of a sentence, and AI language models can understand whether something is positive or negative, and then can formulate an argument which displays both sides.
The code suggests that 'Hello, have a great day' is a positive statement, giving it a score of 0.8
(These scores range from -1.0 to 1.0)
ChatGPT...
1) Understands natural language
2) Can answer questions by accessing all the information available to it.
3) Can translate languages (not word for word like google translate, but instead understanding it's context)
However, chatGPT has problems with bias, due to dependency on data.
The picture below demonstrates chatGPT's ability to formulate an answer.
AI could play a part in life-saving prediction of disease.
Education could become personalised, with an AI tutor focused on each student and providing customised resources to aid the student imporve their particular weaknesses.
Mundane tasks could be automated, leaving humans to focus on creative aspects of work.
Accidents in transportation could be reduced (self driving cars e.t.c. wouldn't have human error) .
AI could optimise energy usage, reducing waste and therefore reducing carbon emissions. It could plan more sustainable cities.
However...
There are privacy issues due to AI using vast amounts of data.
There is bias.
Advanced AI could create sophisticated cyber attacks or autonomous weapons.
Over reliance on AI could lead to humans losing key skills.
People could lose jobs (particularly in sectors like manufacturing).
AI's decision making process is unclear.