wave-roll
Version:
JavaScript Library for Comparative MIDI Piano-Roll Visualization
82 lines • 2.95 kB
TypeScript
/**
* Enhanced transcription evaluation metrics with mir_eval compatibility.
*
* This module provides improved velocity-aware metrics that match
* mir_eval.transcription_velocity's behavior more closely, including:
* - Proper velocity normalization and scaling
* - Support for 1:N matching (configurable)
* - Better handling of missing velocities
* - Additional diagnostic metrics
*
* Reference: https://github.com/mir-evaluation/mir_eval
*/
import { ParsedMidi } from "@/lib/core/utils/midi/types";
import { TranscriptionToleranceOptions, VelocityToleranceOptions } from "./constants";
import { EnhancedNoteMatchResult, EnhancedMatchingOptions } from "./matchNotes-enhanced";
/**
* Enhanced metrics with additional velocity diagnostics
*/
export interface EnhancedNoteMetrics {
precision: number;
recall: number;
f1: number;
f_measure: number;
avgOverlapRatio: number;
numCorrect: number;
numRef: number;
numEst: number;
velocity?: {
mode: VelocityToleranceOptions["mode"];
toleranceNormalized: number;
toleranceMidi: number;
numVelocityCorrect: number;
velocityPrecision: number;
velocityRecall: number;
velocityF1: number;
avgVelocityError: number;
rmseVelocity: number;
correlationCoeff: number;
avgScaledError: number;
rmseScaled: number;
velocityErrorPercentiles: {
p25: number;
p50: number;
p75: number;
p90: number;
p95: number;
};
};
matches: EnhancedNoteMatchResult["matches"];
falseNegatives: number[];
falsePositives: number[];
matchingStats?: {
avgMatchesPerRef: number;
maxMatchesPerRef: number;
refsWithMultipleMatches: number;
totalSecondaryMatches: number;
};
velocityScaling?: EnhancedNoteMatchResult["velocityScaling"];
}
/**
* Compute enhanced note-level metrics with velocity analysis
*/
export declare function computeEnhancedNoteMetrics(reference: ParsedMidi, estimated: ParsedMidi, tolerances?: Partial<TranscriptionToleranceOptions>, velocityOpts?: Partial<VelocityToleranceOptions>, matchingOpts?: EnhancedMatchingOptions): EnhancedNoteMetrics;
/**
* Evaluate transcription with velocity following mir_eval's approach
* This is the main entry point for evaluation
*/
export declare function evaluateTranscriptionEnhanced(reference: ParsedMidi, estimated: ParsedMidi, options?: {
tolerances?: Partial<TranscriptionToleranceOptions>;
velocity?: Partial<VelocityToleranceOptions>;
matching?: EnhancedMatchingOptions;
}): EnhancedNoteMetrics;
/**
* Simple wrapper for backward compatibility
*/
export declare function evaluateTranscriptionSimple(reference: ParsedMidi, estimated: ParsedMidi): {
precision: number;
recall: number;
f1: number;
avgOverlapRatio: number;
};
//# sourceMappingURL=metrics-enhanced.d.ts.map