CoolFace
Apppublic

lerobot/robot-learning-tutorial

sourceHugging Faceupdated 1y agoView on Hugging Face
508likes
LARGE_DATASETS.md189 linesDownload Raw Back to trackio
1# ๐Ÿ“Š Large Dataset Support - TrackIO2 3## ๐ŸŽฏ Overview4 5TrackIO now supports **massive datasets** with intelligent adaptive sampling, maintaining visual fidelity while ensuring smooth performance. When a dataset exceeds **400 data points**, the system automatically applies smart sampling techniques.6 7## ๐Ÿš€ Features8 9### **Adaptive Sampling System**10- **Smart Strategy**: Preserves peaks, valleys, and inflection points11- **Uniform Strategy**: Simple decimation for rapid prototyping12- **LOD Strategy**: Level-of-Detail sampling for zoom contexts13- **Automatic Trigger**: Activates when any run > 400 points14 15### **Performance Optimizations**16- **Hover Throttling**: 60fps max hover rate for large datasets17- **Binary Search**: O(log n) nearest-point finding vs O(n)18- **Redundancy Elimination**: Skip duplicate hover events19- **Memory Efficient**: Only render sampled points20 21### **Visual Preservation**22- **Feature Detection**: Automatically preserves important curve characteristics23- **Logarithmic Density**: More points at the beginning where learning is rapid24- **Variation-Based Sampling**: Focus on areas with high local variation25- **Visual Indicator**: Shows "Sampled" badge when active26 27## ๐Ÿ“ˆ Supported Dataset Sizes28 29| Size Range | Description | Strategy | Performance |30|------------|-------------|----------|-------------|31| < 400 | Small/Medium | No sampling | Native |32| 400-1K | Large | Smart sampling | Excellent |33| 1K-5K | Very Large | Smart + throttling | Very Good |34| 5K-15K | Massive | Advanced sampling | Good |35| 15K+ | Extreme | All optimizations | Stable |36 37## ๐Ÿ”ง Usage38 39### **Automatic Mode (Default)**40```javascript41// Dataset > 400 points will automatically trigger sampling42const largeData = generateDataset(1000); // Will be sampled to ~200 points43```44 45### **Manual Testing**46```javascript47// Generate massive test dataset48window.trackioInstance.generateMassiveDataset(5000, 3);49 50// Or via browser console51document.querySelector('.trackio').__trackioInstance.generateMassiveDataset(10000, 2);52```53 54### **Configuration**55```javascript56import { AdaptiveSampler } from './core/adaptive-sampler.js';57 58const customSampler = new AdaptiveSampler({59  maxPoints: 500,           // Trigger threshold60  targetPoints: 250,        // Target after sampling61  adaptiveStrategy: 'smart', // 'uniform', 'smart', 'lod'62  preserveFeatures: true    // Keep important curve features63});64```65 66## ๐Ÿงช Testing Large Datasets67 68### **Scenario Cycling**69The jitter function now cycles through different dataset sizes:701. **Prototyping** (5-100 steps)712. **Development** (100-400 steps)723. **Production** (400-800 steps) โ† Sampling starts734. **Research** (800-2K steps)745. **LLM** (2K-5K steps)756. **Massive** (5K-15K steps)767. **Random** (Full range)77 78### **Browser Console Testing**79```javascript80// Test different scenarios81trackioInstance.generateMassiveDataset(1000);  // 1K steps82trackioInstance.generateMassiveDataset(5000);  // 5K steps83trackioInstance.generateMassiveDataset(10000); // 10K steps84 85// Check current sampling info86console.table(trackioInstance.samplingInfo);87```88 89## ๐ŸŽจ Visual Indicators90 91### **Sampling Badge**92- Appears in top-right corner when sampling is active93- Shows "Sampled" text with indicator icon94- Tooltip explains the feature95 96### **Console Logs**97```98๐ŸŽฏ Large dataset detected (1500 points), applying adaptive sampling99๐Ÿ“Š rapid-forest-42: 1500 โ†’ 187 points (12.5% retained)100๐Ÿ“Š swift-mountain-73: 1500 โ†’ 203 points (13.5% retained)101```102 103## ๐Ÿ”ฌ Smart Sampling Algorithm104 105### **Feature Detection**1061. **Peaks**: Local maxima in training curves1072. **Valleys**: Local minima (loss valleys, accuracy dips)1083. **Inflection Points**: Changes in curve direction1094. **Trend Changes**: Slope variations110 111### **Sampling Strategy**1121. **Critical Points**: Always preserve start, end, and detected features1132. **Logarithmic Distribution**: More density early in training1143. **Variation-Based**: Sample areas with high local change1154. **Boundary Preservation**: Maintain overall curve shape116 117### **Performance Characteristics**118- **Compression Ratio**: Typically 10-20% of original points119- **Feature Preservation**: >95% of important curve characteristics120- **Rendering Performance**: Constant regardless of original size121- **Interaction Latency**: <16ms hover response time122 123## ๐Ÿ—๏ธ Architecture124 125### **Core Components**126- **AdaptiveSampler**: Main sampling logic127- **InteractionManager**: Optimized hover handling128- **ChartRenderer**: Integration layer129- **Performance Monitors**: Automatic throttling130 131### **File Structure**132```133trackio/134โ”œโ”€โ”€ core/135โ”‚   โ””โ”€โ”€ adaptive-sampler.js     # Main sampling system136โ”œโ”€โ”€ renderers/137โ”‚   โ”œโ”€โ”€ ChartRendererRefactored.svelte  # Integration138โ”‚   โ””โ”€โ”€ core/139โ”‚       โ””โ”€โ”€ interaction-manager.js      # Optimized interactions140โ””โ”€โ”€ LARGE_DATASETS.md          # This documentation141```142 143## ๐Ÿšฆ Performance Benchmarks144 145| Dataset Size | Original Points | Sampled Points | Compression | Render Time |146|--------------|----------------|----------------|-------------|-------------|147| 500 steps | 500 | 187 | 37.4% | ~2ms |148| 1K steps | 1,000 | 203 | 20.3% | ~3ms |149| 5K steps | 5,000 | 198 | 4.0% | ~3ms |150| 10K steps | 10,000 | 201 | 2.0% | ~3ms |151| 15K steps | 15,000 | 199 | 1.3% | ~3ms |152 153*All benchmarks on MacBook Pro M1, tested with 3 runs ร— 5 metrics*154 155## ๐Ÿ”ฎ Future Enhancements156 157### **Planned Features**1581. **Zoom-Based LOD**: Higher detail when user zooms in1592. **Real-time Streaming**: Handle live data efficiently  1603. **WebGL Rendering**: Hardware acceleration for extreme sizes1614. **Smart Caching**: Preserve detail for frequently viewed regions1625. **Custom Strategies**: User-defined sampling algorithms163 164### **API Extensions**165```javascript166// Future API ideas167sampler.setZoomRegion(startStep, endStep); // Higher detail in region168sampler.addStreamingPoint(run, dataPoint);  // Real-time updates169sampler.enableWebGL(true);                  // Hardware acceleration170```171 172## ๐Ÿ’ก Best Practices173 174### **For Developers**1751. Always test with large datasets during development1762. Use console logs to verify sampling behavior1773. Check visual fidelity after sampling1784. Monitor performance in browser dev tools179 180### **For Users**1811. Look for the "Sampled" indicator for context1822. Use fullscreen mode for detailed inspection1833. Hover interactions remain fully functional1844. All chart features work normally185 186---187 188*This system ensures TrackIO scales elegantly from small experiments to massive research datasets while maintaining the smooth, responsive experience users expect.*189