<commit_before>import hashcode as hc
import numpy as np
import sys
m = hc.read_image(sys.argv[1])


best_score = 0
best_delta = 0

for delta in np.nditer(np.arange(0, 0.3, 0.005)):
    m_work, all_commands = hc.algo(m, np.zeros(np.shape(m)), delta)

    print 'Dimensions:',np.shape(m)
    print 'Cells:',np.shape(m)[0]*np.shape(m)[1]


    print '# commands:', len(all_commands)
    score = np.shape(m)[0]*np.shape(m)[1] - len(all_commands)
    print delta, 'Score: ', score
    if score > best_score:
        best_score = score
        best_delta = delta
        best_cmds = all_commands

np.savetxt(sys.argv[1]+'.m_work', m_work, fmt='%1.0f')
str_cmds = [str(len(best_cmds))]
str_cmds += [' '.join(map(str,list(best_cmds[i]))) for i in xrange(len(best_cmds))]

np.savetxt(sys.argv[1]+'.cmds', str_cmds, fmt='%s')
print 'Best score -->', best_score
print 'Delta =', best_delta
print 'Best number of commands =',len(best_cmds)<commit_msg>cleaning<commit_after>import hashcode as hc
import numpy as np
import sys



if len(sys.argv) != 2:
    raise SystemExit('Usage: python tester.py <filename>')

m = hc.read_image(sys.argv[1])


best_score = 0
best_delta = 0

for delta in np.nditer(np.arange(0, 0.3, 0.005)):
    m_work, all_commands = hc.algo(m, np.zeros(np.shape(m)), delta)
    score = np.shape(m)[0]*np.shape(m)[1] - len(all_commands)
    if score > best_score:
        best_score = score
        best_delta = delta
        best_cmds = all_commands

str_cmds = [str(len(best_cmds))]
str_cmds += [' '.join(map(str,list(best_cmds[i]))) for i in xrange(len(best_cmds))]

np.savetxt(sys.argv[1]+'.cmds', str_cmds, fmt='%s')
{'fraction_non_alphanumeric': 0.17148125384142593, 'fraction_numerical': 0.019668100799016593, 'mean_word_length': 4.135646687697161, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 7, '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': '3451317', 'n_tokens_mistral': 683, 'n_tokens_neox': 656, 'n_words': 134}