How to Use Dashboard for Experiment Logging and Visualization

Jun 29, 2021 | Data Science

Dashboard is a powerful tool that allows you to make, visualize, and share experiment logs seamlessly with the added convenience of accessing this information on your mobile device. Here’s a comprehensive guide on how to set it up, utilize its reporting features, and troubleshoot common issues.

Getting Started with Dashboard

The first step in harnessing the power of Dashboard is to set up your environment. You can achieve this by installing the necessary packages and configuring them for use.

Step-by-Step Guide to Reporting

Let’s dive into how to report experiment metrics using the Dashboard library:

from dashboard import reporter
import numpy as np

r = reporter.Reporter()
for epoch in range(10):
    for i in range(5):
        metrics = {'loss': np.random.uniform(0, 1), 'f1': np.random.uniform(0, 1)}
        r.add(metrics)
    print(r.summary())  # prints average loss and f1 score
    r.clear()

Think of the code above as a meticulous librarian cataloging books—each “epoch” represents a new shelf where new books (metrics) are placed. After a certain number of books have been added, the librarian summarizes the information before clearing the shelf for the next batch.

Writing Your Experiment Data

Once data is reported, you can write it to the console or a file. Here’s how you do it:

from dashboard import writer
from time import sleep
import random

console_writer = writer.ConsoleWriter()
file_writer = writer.FileWriter('foo.log')

for epoch in range(3):
    for i in range(2):
        metrics = {'f1': np.random.uniform(0, 1), 'iteration': i, 'epoch': epoch}
        console_writer.add(metrics)
        file_writer.add(metrics)
        sleep(0.5)

In this scenario, the console and file writers function like two different newspapers reporting on the same event. They each have their own format but are covering the same story of your experiment’s progress.

Storing Data in Firebase

If you’d like to store your metrics in Firebase, you will first need to set up a config file. Here’s how you can do it:

exp1_hyperparams = {'d_hid': 100, 'dropout': 0.5, 'model': 'foo'}
exp2_hyperparams = {'d_hid': 200, 'dropout': 0.3, 'model': 'bar', 'comment': 'hello world!'}

writer1 = writer.FirebaseWriter('myexp1', exp1_hyperparams, delete_existing=True)
writer2 = writer.FirebaseWriter('myexp2', exp2_hyperparams, delete_existing=True)

for i in range(5):
    writer1.add({'iteration': i, 'score': random.uniform(0, 10)})
    writer2.add({'iteration': i, 'score': random.uniform(0, 10)})
    print(f'wrote to firebase data from iteration {i}')

In this case, the Firebase writers function similarly to two postmen—sending letters (data) from your experiments to their particular addresses (Firebase instances). Ensuring the right package is delivered is crucial for maintaining order.

Configuring Firebase Web Client

Follow these steps to set up the Firebase web client:

  1. Create an app on Firebase and locate your config.
  2. Enable email accounts and create a user for FirebaseWriter.
  3. Create a config file in your home directory named ~/.fb.config.
  4. Copy your Firebase config into main.js.

Once configured, you can choose to host your static webpage either on your machine or directly on Firebase:

Hosting Static Webpages

cd client/public
python -m http.server 9090

Access your app by visiting localhost:9090.

Hosting on Firebase

Follow this guide to deploy your app on Firebase.

Troubleshooting Common Issues

If you encounter any issues during setup or while running the Dashboard, consider the following troubleshooting steps:

  • Ensure your ~/.fb.config file is formatted correctly and that all credentials are valid.
  • Verify your Firebase account has the necessary permissions.
  • Confirm that your port is not blocked if accessing locally.
  • If using FirebaseWriter, check your database rules.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Conclusion

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox