Object M3aUtils.Companion
-
- All Implemented Interfaces:
public class M3aUtils.Companion
-
-
Field Summary
Fields Modifier and Type Field Description public final static M3aUtils.CompanionINSTANCE
-
Method Summary
Modifier and Type Method Description final DoubleArraycomputeAutocorrelation(MatrixCell MMAP, Integer maxLag)Computes the autocorrelation function of an MMAP up to the specified lag. final DoublecomputeIDC(MatrixCell MMAP, Double timeWindow)Computes the index of dispersion for counts (IDC) of an MMAP. final DoublecomputeCoeffVar(MatrixCell MMAP)Computes the coefficient of variation of an MMAP. final DoubleArraycomputeMoments(MatrixCell MMAP, Integer n)Computes the first n moments of an MMAP. final DoublecomputeSpectralGap(MatrixCell MMAP)Computes the spectral gap of an MMAP generator matrix. final DoubleArrayoptimizeParameters(DoubleArray initialParams, Function1<DoubleArray, Double> objectiveFunction, Array<Function1<DoubleArray, Double>> constraints, Double tolerance)Optimizes MMAP parameters using COBYLA optimization. final DoublecomputeKLDivergence(MatrixCell MMAP1, MatrixCell MMAP2, Integer numSamples, Integer seed)Computes the Kullback-Leibler divergence between two MMAPs. final BooleanvalidateMMAP(MatrixCell MMAP)Validates that a matrix represents a valid MMAP. -
-
Method Detail
-
computeAutocorrelation
final DoubleArray computeAutocorrelation(MatrixCell MMAP, Integer maxLag)
Computes the autocorrelation function of an MMAP up to the specified lag. Uses the first two matrices (D0, D1) of the MMAP which form a valid MAP.
- Parameters:
MMAP- the MMAP to analyzemaxLag- maximum lag to compute- Returns:
array of autocorrelation values for lags 1 to maxLag
-
computeIDC
final Double computeIDC(MatrixCell MMAP, Double timeWindow)
Computes the index of dispersion for counts (IDC) of an MMAP. Uses the first two matrices (D0, D1) of the MMAP which form a valid MAP.
- Parameters:
MMAP- the MMAP to analyzetimeWindow- the time window for IDC computation (ignored, uses asymptotic IDC)- Returns:
the index of dispersion for counts
-
computeCoeffVar
final Double computeCoeffVar(MatrixCell MMAP)
Computes the coefficient of variation of an MMAP. Uses the first two matrices (D0, D1) of the MMAP which form a valid MAP.
- Parameters:
MMAP- the MMAP to analyze- Returns:
the coefficient of variation
-
computeMoments
final DoubleArray computeMoments(MatrixCell MMAP, Integer n)
Computes the first n moments of an MMAP. Uses the first two matrices (D0, D1) of the MMAP which form a valid MAP.
- Parameters:
MMAP- the MMAP to analyzen- number of moments to compute- Returns:
array of the first n moments
-
computeSpectralGap
final Double computeSpectralGap(MatrixCell MMAP)
Computes the spectral gap of an MMAP generator matrix.
- Parameters:
MMAP- the MMAP to analyze- Returns:
the spectral gap (difference between largest and second-largest eigenvalue)
-
optimizeParameters
final DoubleArray optimizeParameters(DoubleArray initialParams, Function1<DoubleArray, Double> objectiveFunction, Array<Function1<DoubleArray, Double>> constraints, Double tolerance)
Optimizes MMAP parameters using COBYLA optimization.
- Parameters:
initialParams- initial parameter vectorobjectiveFunction- objective function to minimizeconstraints- constraint functionstolerance- optimization tolerance- Returns:
optimized parameter vector
-
computeKLDivergence
final Double computeKLDivergence(MatrixCell MMAP1, MatrixCell MMAP2, Integer numSamples, Integer seed)
Computes the Kullback-Leibler divergence between two MMAPs.
- Parameters:
MMAP1- first MMAPMMAP2- second MMAPnumSamples- number of samples for estimationseed- random seed for reproducible results- Returns:
KL divergence estimate
-
validateMMAP
final Boolean validateMMAP(MatrixCell MMAP)
Validates that a matrix represents a valid MMAP.
- Parameters:
MMAP- the MMAP to validate- Returns:
true if the MMAP is valid, false otherwise
-
-
-
-