<commit_before>import sys
sys.path.append('../')
#print sys.path
import numpy as np

import numpy as np
from disaggregator import evaluation_metrics as evm

def unit_rss(t,p):
    residuals = np.array([x-y for (x,y) in zip(t,p)])
    squares = np.array([x**2 for x in residuals])
    return squares.sum()

if __name__=='__main__':
    truth = np.ones(7)
    prediction = np.zeros(7)
    print evm.sum_error(truth,prediction)
    print 'The sum of the squared residuals(evm) is {} '.format(evm.rss(truth,prediction))
    print 'The sum of the squared residuals(unit) is {}'.format(unit_rss(truth,prediction))

    print evm.guess_truth_from_power(np.array([2,3,4,51,2]),3)
    stats =  evm.get_positive_negative_stats([1],[1])
    print stats[0]
    print stats[1]<commit_msg>stashing<commit_after>import sys
sys.path.append('../')
#print sys.path
import numpy as np


from disaggregator import evaluation_metrics as evm

def unit_rss(t,p):
    residuals = np.array([x-y for (x,y) in zip(t,p)])
    squares = np.array([x**2 for x in residuals])
    return squares.sum()

if __name__=='__main__':
    truth = np.ones(7)
    prediction = np.zeros(7)
    print evm.sum_error(truth,prediction)
    print 'The sum of the squared residuals(evm) is {} '.format(evm.rss(truth,prediction))
    print 'The sum of the squared residuals(unit) is {}'.format(unit_rss(truth,prediction))

    print evm.guess_truth_from_power(np.array([2,3,4,51,2]),3)
    stats =  evm.get_positive_negative_stats([1],[1])
    print stats[0]
    print stats[1]
{'fraction_non_alphanumeric': 0.14407334643091027, 'fraction_numerical': 0.0183366077275704, 'mean_word_length': 4.268965517241379, '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': '4396517', 'n_tokens_mistral': 583, 'n_tokens_neox': 553, 'n_words': 133}