ruckus.scoring module

ruckus.scoring.ghmm_score(P, Q)[source]

Compares two sets of transition matrices for a hidden Markov model (or generalized hidden Markov model) and computes a score between them which is 1 if they generate the same process and \(<1\) otherwise.

Let \(P^{(x)}_{ij}\) and \(Q^{(x)}_{ij}\) be the symbol-labeled state transition matrices of two separate HMMs. Construct the block matrix \(E^{(P,Q)}_{ij,kl}\) as:

\[E^{(P,Q)}_{ij,kl} = \sum_x P^{(x)}_{ik}Q^{(x)}_{jl}\]

Denote the leading eigenvalue of this matrix across the comma as \(\lambda^{(P,Q)}\). Then the score is computed as

\[\mathrm{Score} = \frac{\lambda^{(P,Q)}}{\sqrt{\lambda^{(P,P)},\lambda^{(Q,Q)}}}\]
Parameters
  • P (numpy.ndarray of shape (n_symbols,n_states_1,n_states_1)) – The symbol-labeled transition matrices of the first HMM.

  • Q (numpy.ndarray of shape (n_symbols,n_states_2,n_states_2)) – The symbol-labeled transition matrices of the second HMM. Can have different number of states from P but must have same number of symbols.

ruckus.scoring.joint_probs_euclidean_scorer(regressor, X, y)[source]

Determines if a conditional embedding accurately represents the correlations in the original dataset.

If we have samples over two spaces \(X\) and \(Y\) embedded into \(H_1\otimes H_2\) as

\[\mu_{XY} = \frac{1}{N}\sum_i \phi_1(x_i)\otimes \phi_2(y_i)\]

and an estimated conditional embedding \(\hat{C}_{Y|X}\), we reconstruct the joint estimator as

\[\hat{\mu}_{XY} = \frac{1}{N}\sum_i \phi_1(x_i)\otimes \hat{C}_{Y|X}\phi(x_i)\]

and return the (negative) Euclidean distance:

\[\mathrm{Score} = -\left\|\mu_{XY}-\hat{\mu}_{XY}\right\|_{\mathrm{HS}}\]
Parameters
ruckus.scoring.joint_probs_hilbert_schmidt_scorer(regressor, X, y)[source]

Determines if a conditional embedding accurately represents the correlations in the original dataset.

If we have samples over two spaces \(X\) and \(Y\) embedded into \(H_1\otimes H_2\) as

\[\mu_{XY} = \frac{1}{N}\sum_i \phi_1(x_i)\otimes \phi_2(y_i)\]

and an estimated conditional embedding \(\hat{C}_{Y|X}\), we reconstruct the joint estimator as

\[\hat{\mu}_{XY} = \frac{1}{N}\sum_i \phi_1(x_i)\otimes \hat{C}_{Y|X}\phi(x_i)\]

and return the normalized Hilbert-Schmidt inner product:

\[\mathrm{Score} = \frac{\left<\mu_{XY},\hat{\mu}_{XY}\right>_{\mathrm{HS}}}{\sqrt{\left<\hat{\mu}_{XY},\hat{\mu}_{XY}\right>_{\mathrm{HS}}\left<\mu_{XY},\mu_{XY}\right>_{\mathrm{HS}}}}\]
Parameters