Neural Network - Tutorial

Inspiration for Neural Network comes from psychologist and neurobiologist. They wanted to develop computational analogous to neurons. Hence, computational neural network is also called artificial neural network.

Neural Network (NN) has neurons and layers in its architecture. 3 layers in Neural Network are Input Layer , Hidden Layer and Output Layer. Each of these layers have units or neurons in it.

Simple Neural Network Representation

Neural Network Architecture

Neural Network - Examples and Applications

Due to complexity of neural network, it has been used less frequently. A number of applications of neural network across industries

Neural Network in Banking and Financial Sefvices

  • Measuring Credit Risk of New Applicants: Credit Risk is risk of default by the customers whom a credit facility is approved. Banks and financial institutions build predictive model for assessing credit worthiness of the new applicants. Various techniques are used for building the credit risk scorecard or predictive model. Neural Network is also used for classifying customers into Good and Bad. In this scenario, target variable is binary and type of problem is classification.
  • Predicting Loan Recovery Rate: Even after using advanced credit scorecard, there is a default. Once customers are defaulted on their loan repayment, the financial institutions aim to recover as much money as possible (by abiding regulatory and legal rules) from the defaulted customers. The recovery rate ( complement of loss given default) is fraction of outstanding balances recovered from the defaulted customers. Neural Network based non-parametric model is used for forecasting bank recoveries.
  • Insurance Loss Reserve: In insurance, estimating future cash reserve requirement is crucial to optimize operations. The cash reserve requirement depends on future claim volumes and claim amount. Artificial Neural Network (ANN) could be used for forecasting future claims.

Neural Network is also used for retail - store segmentation, forecasting aggregate sales volume and predicting responders for loyalty mailing.

Neural Network Algorithms

A neural network architecture has input, hidden and output layers and each layer has processing unit(s).

Neuron Processing Unit

Each of the processing unit has inputs along with their weights (for assigning different level of importance to inputs). The inputs along with weights are aggregated and appropriate transformation (activation function) is applied to the aggregated input.

Based on the sample data, the weights have to be estimated. There are various algorithms to training the network. One of the commonly used neural network algorithm is Backpropagation.

Using initial weights, the target state/labels are estimated using the neural network. The estimate labels are compared against target or actual labels. The gap is called Error and the error is back propagated to improve the weights and reduce the error.

Backpropagation Learning

Neural Network Example

A marketing department of a bank runs various marketing campaigns for cross-selling products, customer retention and customer services. In this blog, we will use Marketing Data sample. In this example, the bank wanted to cross-sell term depoisit product to its customers.

Contacting all customers is costly and does not create good customer experience. So, the bank wanted to build a predictive model which will identify customers who are more likely to respond to term deport cross sell campaign. More details on data preparation for predictive modeling.

It is an example of supervised learning. Target variable: Whether a customer is responding to a cross sell campaign. Independent Variables:

age : Age of customer duration: Last cotact duration in second Job Level: Job Levels

Neural Network(NN) is used for building a predictive model.

Neural Network in R

R has at least two packages on neural network. These are nnet and neuralnet . nnet has feed-forward neural networks with a single hidden layer network algorithm implementation.

neuralnet has algorithm for backpropagation with many more features.

neuralnet function within neuralnet package can be used for training the neural network.

Similarly, nnet function from nnet package could be used for training feed-forward neural networks with a single hidden layer

In this blog, we will focus on simple feed forward neural network. Next blog will focus on backward propagation naural network with many complexities.

'

This is the simplest Neural Network example. Only one input layer and one output layer with a single variable. Blue line shows Bias.

We can check the accuracy of the result.

We can calculate predicted response values using trained neural network.

Compute the predicted values based on the trained network on the new sample. compute function is used.

 

In the input samples, cross sell response % is 3%. So, top 3% are tagged as 1 in the test data frame.

Prediction accuracy check using confusion matrix. More details on Model Performance Statistics

 

Interesting the accuracy level is 90% even with single variable and very simple neural network.

11 thoughts on “Neural Network - Tutorial

Leave a Comment