LogoLogo
  • Tensorleap
  • Examples
    • Semantic Segmentation
    • Image Analysis
    • Sentiment Analysis
    • MNIST Project Walkthrough
    • IMDB Project Walkthrough
  • Quickstart using CLI
  • Guides
    • Full Guides
      • MNIST Guide
        • Dataset Integration
        • Model Integration
        • Model Perception Analysis
        • Advanced Metrics
      • IMDB Guide
        • Dataset Integration
        • Model Integration
        • Model Perception Analysis
        • Advanced Metrics
    • Integration Script
      • Preprocess Function
      • Input Encoder
      • Ground Truth Encoder
      • Metadata Function
      • Visualizer Function
      • Prediction
      • Custom Metrics
      • Custom Loss Function
      • Custom Layers
      • Unlabeled Data
      • Examples
        • CelebA Object Detection (YoloV7)
        • Wikipedia Toxicity (using Tensorflow Datasets)
        • Confusion Matrix
        • CelebA Classification (using GCS)
  • Platform
    • Resources Management
    • Project
    • Dataset
    • Secret Manager
    • Network
      • Dataset Node
      • Layers
      • Loss and Optimizer
      • Visualizers
      • Import Model
      • Metrics
    • Evaluate / Train Model
    • Metrics Dashboard
    • Versions
    • Issues
    • Tests
    • Analysis
      • helpers
        • detection
          • YOLO
    • Team management
    • Insights
  • API
    • code_loader
      • leap_binder
        • add_custom_metric
        • set_preprocess
        • set_unlabeled_data_preprocess
        • set_input
        • set_ground_truth
        • set_metadata
        • add_prediction
        • add_custom_loss
        • set_visualizer
      • enums
        • DatasetMetadataType
        • LeapDataType
      • datasetclasses
        • PreprocessResponse
      • visualizer_classes
        • LeapImage
        • LeapImageWithBBox
        • LeapGraph
        • LeapText
        • LeapHorizontalBar
        • LeapImageMask
        • LeapTextMask
  • Tips & Tricks
    • Import External Code
  • Legal
    • Terms of Use
    • Privacy Policy
Powered by GitBook
On this page
  • Add a Loss Node
  • Add Custom Loss
  • Add an Optimizer node

Was this helpful?

  1. Platform
  2. Network

Loss and Optimizer

Ease training by adding a Loss function and Optimizer to your network

PreviousLayersNextVisualizers

Last updated 3 years ago

Was this helpful?

The goal of neural networks is generally to minimize error. This is why the objective function is commonly referred to as a cost function or a loss function, and the value calculated by the loss function is simply referred to as "loss."

The optimizer is a function or algorithm that modifies the neural network's parameters in such a way that it tries to reduce the overall loss, thereby increasing the estimation accuracy.

This section describes how to set up the loss function and optimizer at the output (prediction) of our model.

After adding layers, the final steps in setting up a network are:

  • and connecting it to the prediction from the model's last layer(s) in the network. The Loss function is also connected to the target value that is defined by the dataset's ground truth.

  • and connecting the Loss function to it.

  • Adding a Visualizer (see )

Add a Loss Node

You may add the ground truth before the Loss function.

The order in which the Ground Truth and Loss function are added is irrelevant to the network, as long as the Ground Truth passes its labeled data to the Loss function.

To add the ground truth:

  1. On the Network view, right-click anywhere and select GroundTruth from the menu.

  2. When the GroundTruth node appears in the Network view, click it to open a panel to the right. From here, you can view and edit the GroundTruth node's properties.

To add a Loss function:

  1. On the Network view, right-click anywhere and select the preferred Loss function from the menu.

  2. When the Loss node appears in the Network view, click it to open a panel to the right. From here, you can view and edit the Loss node's properties.

  3. Connect the last layer on the network to the prediction input of the Loss node.

  4. Connect the GroundTruth node to the ground_truth input of the Loss node.

Add Custom Loss

To add a Custom Loss:

  1. In the Integration Script write your own Custom Loss Function, use the add_custom_loss function to add the function to the custom losses, and Save.

  2. On the Network view, right-click anywhere and select the preferred CustomLoss from the menu.

  3. When the CustomLoss node appears in the Network view, click it to open a panel to the right. From here, you can set the Selected Custom Loss to the Custom Loss Function.

Add an Optimizer node

An Optimizer is added after the Loss function.

To add an Optimizer:

  1. On the Network view, right-click anywhere and select the preferred Optimizer from the menu.

  2. When the Optimizer node appears in the Network view, click it to open a panel to the right. From here, you can view and edit the Optimizer node's properties.

  3. Connect the Loss function to the Optimizer.

Adding a CustomLoss node let you select your own and use it as your loss function.

Connect the CustomLoss node as described .

Custom Loss Function
here
Visualizers
Adding a Loss Function
Adding an Optimizer
Typical setup of Ground Truth, Loss, and Optimizer in a network
Adding the Loss function and connecting it to the GroundTruth
Adding the Optimzer and connecting it to the Loss function