Launch Your First Project

Say Hello World to Text Classification on Graphbook

Introduction to Text Classification

Text Classifier Template

Let's start by taking a closer look at the Text Classifier template. On the left-hand side of the interface, locate the Templates panel. Click on it and type text classifier in the search bar. Select the "Basic Text Classifier" operation and drag it into the graph canvas.

Text Classifier Template

Initializing the Operation

Upon adding the template, you will see a clock icon, indicating that the graph is preparing to preview data. This is because Graphbook operates in Interactive Compute Mode by default, allowing you to visualize your data instantly. This feature is available for Pro tier and above.

Getting to Know Your Data

  • Data flows from left to right in the graph.
  • The input is an array of text, with only one element.
  • The first output, predicted labels, represents the sentiment labels for each input.
  • The second output, predicted probs, represents the confidence scores for each sentiment class.
Text Classifier Template

Training Text Classifier

Go to File and select Clear Working Project to start fresh. Drag in the Train Text Classifier template to begin.

Train Text Classifier

Understanding the Template

The template's input is the iteration (or epoch) that training is counting up from, and the output is the initial loss value, after the interactive compute executes.

Understanding the Template

Exploring the Dataset

  • The training dataset is located in the Datasets panel on the left-side, under public/sample_sentiment_classifier/text_sentiment_data.
  • Drag the dataset into the graph canvas to view its contents/output.
  • The dataset contains 67,352 text, label pairs for sentiment analysis.
Exploring the Dataset

Preparing for Training

  • Remove the read_from_file operation, as the training dataset is already in the template.
  • Open the Global Constant window. This panel stores environment variables specific to your project, allowing for customization and control.
  • Locate the Is Train variable, which enables/disables weight optimization outside of interactive compute mode. Change its value to True to set the template for training.
Preparing for Training

Kicking Off a Training Job

Save the project with your train text classifier template. Go to the Projects panel, right-click the project, and select "Run Compute Job". Enter a payment method (if required), configure the Compute Job resource, and select "Run a Compute Job" to start the training process.

Kicking Off a Training Job

Test Trained Model

Load the Trained Project

Load the project we just trained to test its performance. First, check the loss result, which is currently at 0.07, lower than the 0.1 threshold.

Load the Trained Project

Disable Model Retraining

  • Find the Is Train constant under the global constants and change it back to False. This will prevent the model from retraining.
  • Set the Is Initialize Weight constant to False to use the trained weights.
  • Select the text classifier and copy-paste it into the graph for further use.
Disable Model Retraining

Verify on New Data

  • Open the Train Text Classifier body and paste the text classifier into the graph.
  • Bootstrap new data by double-clicking on the slot next to the Texts input.
  • Observe the predicted label and probability to verify the model's performance.

You Did It!

You've successfully trained your first model! Can't wait to see you explore more models or build your own custom model with Graphbook's intuitive drag-and-drop tools.