agentjs-core
Version:
A comprehensive agent-based modeling framework with built-in p5.js visualization
97 lines • 2.66 kB
TypeScript
import { Simulation } from '../core/Simulation';
import { TrainingDataset } from './interfaces';
/**
* Generic data collector for ML training datasets
*/
export declare class GenericDataCollector {
private collectedData;
private isCollecting;
private scenarioMetadata;
private collectionStartTime;
/**
* Start collecting training data from a simulation
* @param simulation Simulation to collect from
* @param scenarioType Type of scenario being collected
* @param episodes Number of episodes to collect
*/
startCollection(_simulation: Simulation, scenarioType: string, episodes?: number): void;
/**
* Stop data collection
*/
stopCollection(): void;
/**
* Record a single step of the simulation
* @param simulation Current simulation state
* @param stepNumber Current step number
*/
recordStep(simulation: Simulation, _stepNumber: number): void;
/**
* Extract state-action pair from an agent
*/
private extractStateActionPair;
/**
* Capture current agent state
*/
private captureAgentState;
/**
* Infer agent action from property changes
*/
private inferAgentAction;
/**
* Estimate movement from agent state
*/
private estimateMovement;
/**
* Estimate interaction from agent state
*/
private estimateInteraction;
/**
* Calculate generic reward signal
*/
private calculateGenericReward;
/**
* Get neighboring agents
*/
private getAgentNeighbors;
/**
* Export collected data as training dataset
*/
exportData(): TrainingDataset;
/**
* Export data in specific format
* @param format Export format
* @returns Formatted data string
*/
exportForTraining(format: 'tensorflow' | 'pytorch' | 'csv'): string;
/**
* Export to CSV format
*/
private exportToCSV;
/**
* Export to TensorFlow format (JSON)
*/
private exportToTensorFlow;
/**
* Export to PyTorch format (JSON)
*/
private exportToPyTorch;
/**
* Get collection statistics
*/
getCollectionStats(): {
isCollecting: boolean;
dataPointsCollected: number;
collectionDuration: number;
averageDataPointsPerSecond: number;
metadata: TrainingDataset['metadata'] | null;
};
/**
* Clear collected data
*/
clearData(): void;
/**
* Save data to file (browser download)
*/
saveToFile(filename: string, format?: 'tensorflow' | 'pytorch' | 'csv'): void;
}
//# sourceMappingURL=GenericDataCollector.d.ts.map