Predicting points with regression
-
Intro
-
Setting up the Network Frameworks
-
Connecting to the Supervised Learning solver(SL)
-
Conclusion
-
Useful links
Information
Primary software used | PUG |
Course | Graduation Projects Building Technology |
Primary subject | AI & ML |
Secondary subject | Machine Learning |
Level | Intermediate |
Last updated | November 11, 2024 |
Keywords |
Responsible
Teacher | |
Faculty |
Predicting points with regression 0/4
Predicting points with regression link copied
This tutorial gives an example of a regression problem in Grasshopper using PUG
The two types of problems of Supervised Learning are classification and regression. Here we will make a simple regression example on grasshopper.
Predicting points with regression 1/4
Setting up the Network Frameworks link copied
In this practice. We will investigate the capacity and constraints of a Neural Network in predicting the values of new inputs based on a set of existing data.
Let’s take a look at the cluster. Here we are trying to use Graph Mapper to generate a set of random points around this Bezier curve.
Let’s have a look at the whole network architecture:
The first part of the network is the input layer, and the network contains 3 Dense Layers
First, we define the input size. This input size has to correspond to your training data input and predicting data input.
In the first Keras Layer, we use Tanh as our activation function. An Activation function decides whether a neuron should be activated or not. The essential feature of an activation function is its ability to add non-linearity into a neural network.
You’ll be able to learn more about what activation function is here.
After setting the initial input size, we define some Dense layers to create an MLP. If you scroll down the menu, you will see different components for Keras layers.
We won’t talk about it in detail, but if you are interested, you can find out more about the different kinds of layers here.
At the end of the layers, we must declare a Keras Model. The model will group layers into an object with training/inference features. An optimizer is required for compiling a Keras model. The optimizer is a function or an algorithm that modifies the attributes of the neural network, such as weights and learning rates. Thus, it helps in reducing the overall loss and improving accuracy.
Predicting points with regression 2/4
Connecting to the Supervised Learning solver(SL) link copied
Epochs: One Epoch is when an ENTIRE dataset is passed forward and backward through the neural network only ONCE.
Batch Size: Total number of training examples present in a single batch.
You can learn more about what an MAE is here.
We finished setting all the network frameworks, and now we will connect the network to a Supervised Learning solver(SL), and we can start training the data! We can further adjust the Batch size Total number of training examples present in a single batch. and Epochs One Epoch is when an ENTIRE dataset is passed forward and backward through the neural network only ONCE. to improve the accuracy. The metric shown here results from the mean absolute error (MAE).
After that, we generate some random points to predict the value Y, which should be close to the Bezier curve. Notice that the input size corresponds to what we defined at the beginning of the network.
Predicting points with regression 3/4
Conclusion link copied
You now learned how to use the plug-in PUG for a regression problem in Grasshopper. Here you can find an overview of the script.
Final exercise file
You can download the final exercise file below.
Download Final exercise file – Regression with PUG
application/zip (ZIP, 50 KB)
Predicting points with regression 4/4
Useful links link copied
Used software
External sources
Interesting articles:
- Everything you need to know about “Activation Functions” in Deep learning models
- A Brief Introduction to Supervised Learning
Keras information: