<commit_before>'''
Created on 25.11.2013

@author: jan-hendrikprinz
'''
from emma2.msm.estimation.api import tmatrix_cov

import numpy

#TODO: maybe use symmetry in the covariance matrices to reduce computation by one order
def error_perturbation(C, sensitivity):
    error = 0.0;
    
    n = len(C)
    
    for k in range(0,n):
        cov = tmatrix_cov(C, k)
        error += numpy.dot(numpy.dot(sensitivity[k],cov),sensitivity[k])

    return error<commit_msg>Changed absolute import to relative import<commit_after>'''
Created on 25.11.2013

@author: jan-hendrikprinz
'''
from transition_matrix import tmatrix_cov

import numpy

#TODO: maybe use symmetry in the covariance matrices to reduce computation by one order
def error_perturbation(C, sensitivity):
    error = 0.0;
    
    n = len(C)
    
    for k in range(0,n):
        cov = tmatrix_cov(C, k)
        error += numpy.dot(numpy.dot(sensitivity[k],cov),sensitivity[k])

    return error
{'fraction_non_alphanumeric': 0.10399159663865547, 'fraction_numerical': 0.02415966386554622, 'mean_word_length': 3.5598086124401913, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2483216', 'n_tokens_mistral': 333, 'n_tokens_neox': 307, 'n_words': 92}