However, for this example workflow, we will not be using the Node Library panel in this way. Double-clicking the canvas is an alternative way to bring up the Node Library.
In this example, we'll walk through a simple workflow to identify the species of flowers based on their measurements. We'll use the famous Iris dataset, which contains measurements of 150 iris flowers from three different species: setosa, versicolor, and virginica.
Here you'll see the Graph Applet with a blank canvas. The top bar contains buttons to manage your graph, such as saving and running the workflow. Left-clicking and dragging will pan the canvas around, and the mouse wheel can be used to zoom in and out.
However, for this example workflow, we will not be using the Node Library panel in this way. Double-clicking the canvas is an alternative way to bring up the Node Library.
The Node Library pops open inside the Graph. This list contains Source nodes. Nodes are the building blocks of your workflow, each performing a specific operation on your data.
Clicking on an individual node will add it to the graph. You can then drag the node around the canvas to position it where you like.
In the Node Library, click the Example Tabular Datasets node. This node provides several datasets, including the Iris dataset.
Expand the Manage panel by clicking the Manage button on the Example Tabular Datasets node.
Navigate to the Configure tab, and ensure the Iris dataset is selected
Let's take a look at the Iris dataset to understand its structure and contents.
Now we want to run this small graph.
After a few seconds, the Monitor node will display the Iris dataset in a tabular format in the Monitor node. You can see the measurements of the flowers along with their species. Notice the different columns representing the sepal length, sepal width, petal length, petal width, and species of the flowers.
The dataset is now available, but we need to prepare it for training a machine learning model.
We will first mark our columns based on their role in the model training process. Then, we will transform any non-numeric columns into numeric columns using label encoding. Next, we will split the dataset into training and testing sets. Finally we will train a model on the training set and evaluate its performance on the testing set.
We are going to add a few nodes, but we're going to wait to configure them later.
Connect the nodes in the following order:
We see at the end of the Data Split node there are two outputs. One will be the training data, the other will be the test data.
DataCogs has several model training nodes available. The choice of model depends on the data and the problem you're trying to solve. In this example, we'll use a Decision Tree model.
Decision Trees are a type of supervised learning algorithm that can be used for both classification and regression tasks. They work by splitting the dataset into smaller subsets based on the features of the data. The goal is to create a model that predicts the value of a target variable by learning simple decision rules inferred from the data features.
Add a Decision Tree Trainer node to the graph. This node will train a Decision Tree model on the training data.
Connect the Training Data output of the Data Split node to the Decision Tree Trainer node's Data Stream input connector.
Add a Decision Tree Predictor node to the graph. This node will predict the species of the flowers based on the trained model.
Connect the Model output of the Decision Tree Trainer node to the Decision Tree Predictor node's Model input connector.
Connect the Testing Data output of the Data Split node to the Decision Tree Predictor node's Data Stream input connector.
At this point, if we were to observe the output of the Predictions node, we would see the predicted species of the flowers. However, we want to evaluate the model's performance.
We will use a Model Performance Metrics node to evaluate the performance of the Decision Tree model. This node will output a confusion matrix.
A confusion matrix is a table that is often used to describe the performance of a classification model on a set of data for which the true values are known.
The reason we haven't configured the nodes yet is that when we run the graph, the transformation nodes will automatically pull the columns from the dataset and allow you to mark them as needed.
As the nodes spin to life, the transformation nodes will automatically pull the columns from the dataset and pause to allow you to configure them.
First we will configure the Column Properties node:
| Column Name | Data Type | Role |
|---|---|---|
| Id | Nominal | Identifier |
| SepalLengthCm | Ratio | Feature |
| SepalWidthCm | Ratio | Feature |
| PetalLengthCm | Ratio | Feature |
| PetalWidthCm | Ratio | Feature |
| Species | Nominal | Target |
Next, we will configure the Category Encoder node:
From this point, the nodes will continue to process the data and generate the confusion matrix. The Monitor node will display the confusion matrix directly in the graph area inside the last Monitor node.
The confusion matrix shows the performance of the Decision Tree model on the test data. For each species, the matrix displays the number of times it correctly predicted the species and the number of times it incorrectly predicted the species.
We can see that the model performed well on the test data, with most of the predictions being correct, but there may be room for improvement. We could try different models, adjust the model parameters, or preprocess the data differently to see if we can improve the model's performance.