Model training for classifying varieties of irises.
classify into setosa, versicolor, and virginica
Experience nocoding AI ➟ https://pro.nocodingai.com
Introduction
In this tutorial, we train an artificial intelligence model that classifies three varieties of irises with statistical data measuring the calyx of irises, the length and width of petals.
To this end, we will go through the following steps.
- Load the original data required for training.
- The loaded data is processed and normalized to fit the model through a Data Cleaner
- Build the architecture of the model.
- Monitor performance during model training.
Things to learn
- How to preprocess data in nocoding AI.
- How to build an artificial intelligence model architecture using nocoding AI.
- How to infer result using trained model in nocoding AI
Necessary
- Latest version of Chrome or other latest browser.
- You should be familiar with the basic usage of nocoding AI.
If you need an introduction to the basic usage, please refer to former articles.
Download and modify CSV data
The dataset to be used in this tutorial is the IRIS dataset.
IRIS dataset is a set of statistical data of sizes of different parts of the iris measured in the 1930s and is frequently used in machine learning and statistics.
First, go to the following link to download the dataset.
Then open the downloaded CSV file with a text editor such as a notepad.
The csv file shows tabular data through commas and line breaks.
It can be seen that line breaks and commas separate rows and columns, respectively.
If you open the file, you can see that it is in the same form as above.
Table data consisting of 120 rows and 5 columns.
You might get the overall information about the dataset in the top row. It shows that the dataset has 120 rows and 4 columns of input data and classifies three varieties: Setosa, Bersicolor, and Virginica.
However, this information alone does not tell what each column of the dataset means, so let’s change the contents of the top row.
Each column of this dataset means sepal length, sepal width, petal length, petal width, and variety.
To indicate this, we will change the contents of the top row as follows.
At the Data Cleaner, Create new empty dataset. Note the Data type is ’CSV’.
Click the green csv icon to import your dataset. Change the column name to [sepal length, sepal width, petal length, petal width, Variety].
Do not forget to ‘save’ the data. Press floppy disk button to save.
Create a model architecture
This section introduces how to configure the model architecture. The model architecture is a structure that represents “what functions will run when the model runs” or “an algorithm that the AI model will use to calculate the answer.”
At the Model Designer, create new empty model to construct model architecture.
Go to the Layers tab at the left menu. You can check some layers here. Let’s make a simple AI model with 3 Dense layers.
- Create Input Layer and Output Layer.
- Create a total of three Dense layers.
- Connect the layers in the order of Input-Dense-Dense-Dense-Output.
Yon can drag and drop to switch the layer’s location. Each layers top and bottom, there are small circle. Bottom circle is that layers output socket, and Top circle is that layer’s input socket. Click and drag former layer’s bottom socket to next layer’s top socket. If they connected by a line, you successfully build a AI model architecture.
Now, We will enter a value for each layer.
- Enter 4 in the Shape of Input Layer. This means four values that measure each part of the iris.
- Click Advanced and Set the first and second Dense as follows. (units : 10, activation : relu)
- Set the last Dense as follows. (units : 3, activation : softmax)
You don’t have to change other default setting values.
The last Dense is a layer to indicate the result.
Enter the number of types to be classified in the units value of this Dense.
The artificial intelligence model we’re going to train classifies irises into three varieties, so we put 3 in the Unit value.
When all inputs are finished, save the model.
Model training
Now, we will train the model through the following process.
- Input my Datasets to model
Click the dataset(iris, it’s my custom name that made just before. choose your dataset) at Datasets menu. It will make a block of ‘Dataset’. In this block, you can adjust Training, Validation ratio. Default ratio is Training:Validation = 90:10.
2. Start Training
Press ‘Start Training’ button, and set the inputType, outputType, optimizer, loss value, and etc as follows. select X columns to 4 variables, and Y columns to Variety. If you want to train faster, choose ‘Use GPU’ options(It will pay 1 Gredit per minutes).
3. Monitoring the Trainging process and Result
When training begins, you can check the training result and figures on a graph.
Loss represents the loss value of the model, and acc represents the accuracy. If the loss decreases and the acc increases, it can be seen that the training is going well.
This is the result of training completion.
App Building
Now that the model training is completed, you can classify the varieties of irises using the trained model.
Go to App Builder and create new. There are some menus on the left side. Click to open the menus.
‘Element’ is composed of layout element that can be customized. ‘AI Models’ have AI Models that you already created and trained. Drag and drop to blank canvas. You can customize each element like Title, Text and so on.
After designing your own Web App, you can select the best model to publish. At the right side, check the model detail.
Below the model detail, you can choose input and output detail and labels.
Enter the label name [0: setosa, 1:versicolor, 2:virginica] to make it easy to know the result.
Using AI web application
Everything is done. Click the top right ‘Publish’ button, then you will see the URL and QR code to enter your web application.
Inference
Since our model is ready for inference, let’s use it to classify variety of irises.
First, we will enter the following values corresponding to the columns of the dataset which the model was trained with: 6.2, 2.5, 6.1, 3.3. Our AI are inferring it as Virginica with a probability close to 100%.
Put any value that you want to inference the iris variety.
That’s it. You don’t have to know about a single word of code.
Happily use nocodingAI. thanks.