Classifying points in rectangle
-
Intro
-
Classifying points
-
Conclusion
Information
Primary software used | PUG |
Course | Classifying points in rectangle |
Primary subject | AI & ML |
Secondary subject | Machine Learning |
Level | Intermediate |
Last updated | November 11, 2024 |
Keywords |
Responsible
Teacher | |
Faculty |
Classifying points in rectangle 0/2
Classifying points in rectangle link copied
This exercise serves as a simple demonstration of how Machine Learning can be applied to real-world classification problems.
The PUG plugin will train a network using Supervised Learning to perform binary classification of points – classifying points as inside or outside a specified shape. This exercise serves as a simple demonstration of how Machine Learning can be applied to real-world classification problems. The Neural Network will be trained on labeled data and can classify new, unlabeled data based on the knowledge acquired during training.
Classifying points in rectangle 1/2
Classifying points link copied
Generate data
First, generate 1000 random points. For a neural network, it is advisable to normalize input values between 0 to 1.
We will define a curve and set of points and determine whether the points of intersection are located inside or outside the curve.
The input tensor contains normalized coordinates of points. The output tensor in a classification task contains integer values related to each label. In this case, 0 means outside and 1 means inside the shape.
Training
After defining the curve and points, we will initiate training by pressing the “run” button on the supervised learning component.
You can define a dense Neural Netowrk just by specifying the size of the hidden layers in the “H” input parameter.
Testing
To verify the accuracy of the trained model, we will generate random points and test if they are classified as inside or outside the curve.
Predictions
We will connect the tensor of test points to the prediction component to evaluate if they are classified as inside or outside the curve.
Classifying points in rectangle 2/2
Conclusion link copied
You now learned how to use the plug-in PUG for a simple classification problem in Grasshopper.
Final exercise
Here you can find an overview of the script to classify if points are inside or outside a rectanlge.