Artificial Neural Network (Regression)

Combined Cycle Power Plant

Source

Attribute Information:

  Features consist of hourly average ambient variables

    - Temperature (T) in the range 1.81°C and 37.11°C,

    - Ambient Pressure (AP) in the range 992.89-1033.30 milibar,

    - Relative Humidity (RH) in the range 25.56% to 100.16%

    - Exhaust Vacuum (V) in teh range 25.36-81.56 cm Hg

    - Net hourly electrical energy output (EP) 420.26-495.76 MW

Overview

Part 1 - Data Preprocessing

    - Importing the Relevant Libraries

    - Loading the Data

    - Declaring the Dependent and the Independent variables 

    - Splitting Training set & Test set

    - Feature Scaling


Part 2 - Building the Artificial Neural Network (ANN)

    - Initializing the ANN

    - Adding the Input Layer and the first Hidden Layer

    - Adding the second Hidden Layer

    - Adding the output layer


Part 3 - Training the Artificial Neural Network (ANN)

    - Compiling the ANN with optimizer & loss

    - Training the ANN on the Training set


Part 4 - Making the Predictions and Evaluating the Model

    - Predicting the Test set 

Part 1 - Data Preprocessing

Importing the Relevant Libraries

Loading the Data

Declaring the Dependent and the Independent variables

Splitting Training set & Test set

Feature Scaling

Part 2 - Building the Artificial Neural Network (ANN)

Initializing the ANN

- ann -> object of Sequential Class from models module of keras Library belonging to tenorflow

- Sequential Class -> allowing to build the Artificial Neural Network as sequence of layers

Adding the Input Layer and the first Hidden Layer

- add method -> adding a fully connected layer 

- Dense class from layers module of keras Library belonging to tenorflow

- a fully connected layer as an object of Dense class 

- units = 6 -> Number of hidden neurons (Based on experimentation)

- activation='relu' -> activation function in hidden layer of fully connected neural network must be 'relu'

- ReLU -> The rectified linear Unit activation function

Adding the second Hidden Layer

Adding the output layer

- units=1 -> 1 neuron for output

- No activation function -> for Regression (Predicting Continuous Variable)         

Part 3 - Training the Artificial Neural Network (ANN)

      1. Compiling the ANN with optimizer & loss

      2. Training the ANN on the Training set

Compiling the ANN with optimizer & loss

- optimizer = 'adam' 

        -> The Adam optimization algorithm performing stochastic gradient descent


- loss = 'mean_squared_error' 

        -> for Regression (Predicting Continuous Variable)

Training the ANN on the Training set

- fit method -> for training the model

- batch_size = 32 

     -> 32 is the defult value

     -> propagating in batches (Compare 32 output with 32 Target) 

     -> Instead of propagating one by one (comparing one output by one Target)

- epochs = 100 -> the number of iterations

Part 4 - Making the Predictions and Evaluating the Model

Predicting the Test set

- np.set_printoptions(precision=2) -> rounding the output to 2 decimal 

- Comparing y_pred & y_test horizontally:

        -> y_pred.reshape(len(y_pred),1), y_test.reshape(len(y_test),1)

        -> Changing vectors from being horizontal to vertical

- np.concatenate -> Putting y_pred & t_test next to each other

        - np.concatenate((first argument), second_argument)

        - second_argument :0 -> Horizontal

        - second_argument :1 -> Vertical