
Learn to build an artificial neural network for regression using TensorFlow on Google Colab, covering data processing, CNN building, and training to predict energy output from UCI data.
Import and alias the libraries in google colab, prepare data processing and dataset splitting, and build the neural network with tensorflow, verifying tf 2.0 in ready-to-run code cells.
Import the dataset into Google Colab, build a data frame, define X from feature columns and y from the last column, then split into training and test sets.
Split the dataset into train and test sets using the train_test_split function from the model_selection module, with a 20% test size and a fixed random state for reproducibility.
Initialize a regression neural network using a TensorFlow sequential model with four features (temperature, pressure, humidity, vacuum), two hidden layers of six neurons, and one output neuron for energy.
Build neural network skeleton by initializing a sequential model, add input layer for four features (temperature, pressure, humidity, vacuum) and first hidden layer with six neurons and relu activation.
Add the output layer by connecting the second hidden layer to a single output neuron, set units to one, and remove activation for regression to prepare for training.
Compile a neural network with the Adam optimizer and mean squared error loss, then train on the training set with fit over epochs, and finally predict the test results.
Train an artificial neural network for regression on the training set using fit with X_train and Y_train, 100 epochs and batch size 32. Then predict observations with the predict method.
Predict the test set results using the sequential model's predict method on x_test, and compare y_pred to y_test to show the artificial neural network's performance on new observations.
Are you ready to flex your Deep Learning skills by learning how to build and implement an Artificial Neural Network using Python from scratch?
Testing your skills with practical courses is one of the best and most enjoyable ways to learn data science…and now we’re giving you that chance for FREE.
In this free course, AI expert Hadelin de Ponteves guides you through a case study that shows you how to build an ANN Regression model to predict the electrical energy output of a Combined Cycle Power Plant.
The objective is to create a data model that predicts the net hourly electrical energy output (EP) of the plant using available hourly average ambient variables.
Go hands-on with Hadelin in solving this complex, real-world Deep Learning challenge that covers everything from data preprocessing to building and training an ANN, while utilizing the Machine Learning library, Tensorflow 2.0, and Google Colab, the free, browser-based notebook environment that runs completely in the cloud. It’s a game-changing interface that will supercharge your Machine Learning toolkit.
Check out what’s in store for you when you enroll:
Part 1: Data Preprocessing
Importing the dataset
Splitting the dataset into the training set and test set
Part 2: Building an ANN
Initializing the ANN
Adding the input layer and the first hidden layer
Adding the output layer
Compiling the ANN
Part 3: Training the ANN
Training the ANN model on the training set
Predicting the results of the test set
More about Combined-Cycle Power Plants
A combined-cycle power plant is an electrical power plant in which a Gas Turbine (GT) and a Steam Turbine (ST) are used in combination to produce more electrical energy from the same fuel than that would be possible from a single cycle power plant.
The gas turbine compresses air and mixes it with a fuel heated to a very high temperature. The hot air-fuel mixture moves through the blades, making them spin. The fast-spinning gas turbine drives a generator to generate electricity. The exhaust (waste) heat escaped through the exhaust stack of the gas turbine is utilized by a Heat Recovery Steam Generator (HSRG) system to produce steam that spins a steam turbine. This steam turbine drives a generator to produce additional electricity. CCCP is assumed to produce 50% more energy than a single power plant.