Example Workflow: Identifying Flower Species

    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.

    Step 1: Create a new graph🔗

    • Click the Graph button in the top right corner to create a new graph.

    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.

    The Node Library in the top bar can show all available nodes in a side panel. Clicking nodes in the Node Library panel will add them to the graph without connecting them to anything. This can be used to browse all available nodes, and add many nodes at once.

    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.

    Step 2: Add dataset node to the graph🔗

    • Double-click the canvas to pop open the Node Library. Adding nodes in this way will only show Source nodes.

    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

    Step 3: Inspect the data🔗

    Let's take a look at the Iris dataset to understand its structure and contents.

    • On the Example Tabular Datasets node, click and drag the Data Stream output into a blank area on the graph. This will pop open the Node Library automatically filtered only to compatible nodes.
    • In the Node Library, click the Monitor node. This will add it to the graph and automatically connect it to the Datasets node. The Monitor node will display the output of our workflow.
    The Monitor node attempts to visualize a data channel on the input connector. If there is more than one channel available on an input, then one must be selected in the Manage panel. If there is only one channel, and only one applet capable of visualizing it, then the channel will be automatically selected and visualized.

    Now we want to run this small graph.

    • At the top of the Graph area panel, click the Run button (or Restart if the graph is already running)

    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.

    Step 4: Add nodes to transform the data suitable for model training🔗

    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.

    Since the graph is already running, as we connect nodes we will start seeing activity in the Logs tab.
    • Add a Column Properties node to the graph. This node allows you to mark columns based on their role in the model training process.
    • Add a Category Encoder node to the graph. This node will transform non-numeric columns into numeric columns.
    • Add a Data Split node to the graph. This node will split the dataset into training and testing sets. The default is 20% of the data will be used for testing. We will leave this as is for this example.

    Connect the nodes in the following order:

    • Connect the Data Stream output of the Example Tabular Datasets node to the Column Properties node.
    • Connect the Column Properties node to the Category Encoder node's Data Stream input connector.
    • Connect the Category Encoder node to the Data Split node's Data Stream input connector.

    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.

    Step 5: Add nodes for training the model and generating predictions🔗

    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.

    Step 6: Add nodes to evaluate the model🔗

    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.

    • Add a Model Performance Metrics node to the graph. This node will evaluate the performance of the Decision Tree model.
    • Connect the Predictions output of the Decision Tree Predictor node to the Model Performance Metrics node's Predictions input connector.
    • Connect the Testing Data output of the Data Split node to the Model Performance Metrics node's Ground Truth input connector.
    • Add a Monitor node to the graph. This node will display the confusion matrix output by the Model Performance Metrics node.
    • Connect the Metrics output of the Model Performance Metrics node to the Monitor node's Data Stream input connector.

    Step 7: Configure the transformations and Evaluate the model🔗

    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.

    • Click the Run button (or Restart if it has already been run) at the top of the Graph area panel.

    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:

    • Selecth the Column Properties node and click on the Manage button to open the Configure panel.
    • Mark the columns based on their role in the model training process.
    Column NameData TypeRole
    IdNominalIdentifier
    SepalLengthCmRatioFeature
    SepalWidthCmRatioFeature
    PetalLengthCmRatioFeature
    PetalWidthCmRatioFeature
    SpeciesNominalTarget
    Accurately setting the Data Type helps downstream nodes automate configuration.
    Correctly setting Role is required for proper model training, since this is how the training node will know what columns to train on. The node will attempt to guess appropriate roles for certain columns. For example, any column named "Id" or "Identifier" will automatically receive the Identifier role, but this can be changed if necessary.
    • Scroll to the top of the panel and toggle the Node Run State to Resume. This will allow the node to continue processing the data.

    Next, we will configure the Category Encoder node:

    • Select the Category Encoder node and click on the Manage button to open the Configure panel.
    • Select Pass-through for each column, except for the Species column.
    • For the Species column, select Label. This will transform the species names into numeric values.
    • Scroll to the top of the panel and toggle the Node Run State to Resume. This will allow the node to continue processing the data.
    Since the Data Type was set in the previous step, the Category Encoder node was able to automatically select suitable encodings for this step.

    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.

    Step 8: Analyze the results🔗

    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.

    The Monitor Node visualized the results as a Data Frame. This visualization behaves similarly to a spreadsheet. Cells can be navigated by clicking on one then pressing the w a s and d keys to move around. The arrow keys scroll the view.