Results
Matplotlib-like API for creating plots and visualizations displayed in real-time
🚧
Under Construction
This documentation is currently being developed and will be available soon.
Overview
The Results panel provides a Matplotlib-like API in the backend for creating plots and visualizations. Results are sent from Python via WebSocket and displayed in real-time in the frontend Results panel with version control, tagging, and interactive viewing features.
Backend API
ResultVisualizer Methods
from rfdt import server
# Plotting methods
server.results.plot(x, y, title="", xlabel="", ylabel="") # Line plot
server.results.bar(x, heights, title="", xlabel="", ylabel="") # Bar chart
server.results.scatter(x, y, title="", xlabel="", ylabel="") # Scatter plot
server.results.imshow(data, title="", xlabel="", ylabel="") # Heatmap/Image
server.results.table(data, columns=[], title="") # Data table
# Utility methods
server.results.clear() # Clear pending plots
server.results.commit(message="", tag="", tag_color="") # Send to frontend
server.results.delete_version(version) # Delete a version
server.results.get_all_versions() # Get historyPlot Types
Line Plot
import numpy as np
x = np.linspace(0, 10, 100)
y = np.sin(x)
server.results.plot(x, y, title="Sine Wave", xlabel="Time", ylabel="Amplitude")Bar Chart
categories = ['A', 'B', 'C', 'D']
values = [45, 38, 52, 41]
server.results.bar(categories, values, title="Comparison")Scatter Plot
x = np.random.randn(100)
y = 2*x + np.random.randn(100)
server.results.scatter(x, y, title="Correlation")Heatmap/Image
# Heatmap
data = np.random.randn(20, 30)
server.results.imshow(data, title="2D Field")
# RGB Image (H x W x 3)
image = np.random.rand(100, 100, 3) * 255
server.results.imshow(image.astype(np.uint8), title="RGB Image")Data Table
table_data = {
'Model': ['ResNet', 'VGG', 'MobileNet'],
'Accuracy': [0.945, 0.923, 0.887],
'Speed': [32, 28, 45]
}
server.results.table(table_data, title="Model Comparison")Version Management
Commit System
# Simple commit
server.results.commit() # Creates "v1"
# With message
server.results.commit(message="Baseline Results")
# With tag and color
server.results.commit(
message="Best Model",
tag="best",
tag_color="#00ff00",
clear_after=True # Clear plots after commit (default)
)Version History Features
- •Persistent: Survives across sessions and frontend refresh
- •Ordering: Reverse chronological order (newest first)
- •Deletable: Delete with confirmation modal
- •Backend Storage: Unlimited version history
Tag System
Tags provide visual categorization for results with automatic or custom colors:
- •Auto Color: Generated from tag name
- •Custom Colors: Hex format (#RRGGBB)
- •Common Tags: train, val, test, baseline, exp, best
trainvaltestbaselineexpbest
Data Handling
Automatic Type Conversion
The Results API automatically converts various data types:
- • PyTorch tensors → Python lists
- • NumPy arrays → Python lists
- • Pandas DataFrames → Dict format
- • Native Python lists/tuples
Examples
# PyTorch tensors
import torch
x = torch.linspace(0, 10, 100)
y = torch.sin(x)
server.results.plot(x, y) # Auto-converted
# NumPy arrays
import numpy as np
x = np.linspace(0, 10, 100)
y = np.sin(x)
server.results.plot(x, y) # Auto-convertedUsage Workflows
Machine Learning Training
for epoch in range(epochs):
train_model()
# Clear previous plots
server.results.clear()
# Plot metrics
server.results.plot(loss_history, title="Training Loss")
server.results.bar(['Acc', 'Prec', 'Recall'], [acc, prec, recall])
# Commit with tag
server.results.commit(
message=f"Epoch {epoch+1}",
tag="train" if training else "val"
)Data Analysis
# Visualize distributions
server.results.scatter(data.x, data.y, title="Distribution")
server.results.imshow(correlation_matrix, title="Correlations")
# Show statistics
stats_table = compute_statistics(data)
server.results.table(stats_table, title="Summary")
server.results.commit(message="Analysis Complete", tag="analysis")Frontend Features
Panel Features
- • Version list sidebar
- • Dynamic plot rendering
- • Fullscreen mode
- • Size adjustment slider (50%-200%)
- • Delete with confirmation
UI Components
- • Version List: Compact sidebar with tags
- • Plot Area: Flexible grid layout
- • Controls: Size slider, fullscreen button
- • Delete Modal: Confirmation dialog
Performance Guidelines
- •Max plots per version: ~50 plots
- •Max data points per plot: ~10,000 points
- •Version history: Unlimited (backend stored)
Troubleshooting
| Issue | Solution |
|---|---|
| Plots not appearing | Check WebSocket connection and ensure commit() called |
| Black images | Ensure RGB data is uint8 with values 0-255 |
| Tags not colored | Use valid hex format (#RRGGBB) |
| Delete not working | Check WebSocket connection status |