<jupyter_start><jupyter_text>RMinimum : Phase 3 - Test<jupyter_code>import random<jupyter_output><empty_output><jupyter_text>Testfall:<jupyter_code>n = 2**10
k = 2**8

X = [i for i in range(n)]<jupyter_output><empty_output><jupyter_text>Algorithmus : Phase 3<jupyter_code>def phase3(lst, k, minele, cnt = False):
    
    
    random.shuffle(lst)
    var = [lst[i * k:(i + 1) * k] for i in range((len(lst) + k - 1) // k)]
    res = [0 for _ in range(len(var))]

    for i in range(len(var)):
        res[i] = [elem for elem in var[i] if elem < minele[i]]
        cnt[minele[i]] += len(var[i])
        for elem in var[i]:
            cnt[elem] += 1

    res = [item for sublist in res for item in sublist]

    return res, var, cnt

# Testfall
res, var, cnt = phase3(X, k, minele, cnt)<jupyter_output><empty_output><jupyter_text>Resultat :<jupyter_code>def test(X, k, g, res, var, minele, cnt):
    
    n = len(X)
    r = len(res)
    m = len(minele)
    v = len(var)
    vs = len(var[0])
    mx = max(cnt)
    
    print('')
    print('Testfall n / k:', n, '/', k)
    print('====================================')
    print('# W_i    :', v)
    print('|MinEle| :', m)
    print('------------------------------------')
    print('|W_i|    :', vs)
    print('max(cnt) :', mx)
    print('------------------------------------')
    print('Filter   :', g)
    print('|U W_i|  :', r)
    print('====================================')
    return

# Testfall
test(X, k, g, res, var, minele, cnt)<jupyter_output>Testfall n / k: 1024 / 256
====================================
# W_i    : 4
|MinEle| : 4
------------------------------------
|W_i|    : 256
max(cnt) : 256
------------------------------------
Filter   : 512
|U W_i|  : 512
====================================
{'fraction_non_alphanumeric': 0.313314447592068, 'fraction_numerical': 0.019830028328611898, 'mean_word_length': 2.294776119402985, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 16, '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}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '540868', 'license': 'MIT', 'n_tokens_mistral': 680, 'n_tokens_neox': 645, 'n_words': 152, 'path': 'jupyter/.ipynb_checkpoints/phase3_test-checkpoint.ipynb', 'repo_name': 'jfklorenz/Python-RMinimum', 'size': '1765'}