<jupyter_start><jupyter_text>Profiling<jupyter_code>%timeit wordle.generate_state(wordlist.answers[0], wordlist.acceptable_guesses[0])
%timeit helper.generate_state(wordlist.answers[0], wordlist.acceptable_guesses[0])
%lprun -f wordle.generate_state wordle.generate_state(wordlist.answers[0], wordlist.acceptable_guesses[0])
def profiler():
    for i in range(100000):
        helper.generate_state(wordlist.answers[0], wordlist.acceptable_guesses[0])
cProfile.runctx("profiler()", globals(), locals(), "Profile.prof")
s = pstats.Stats("Profile.prof")
s.strip_dirs().sort_stats("cumtime").print_stats()<jupyter_output>Mon Jan 31 21:11:30 2022    Profile.prof

         1400004 function calls in 0.304 seconds

   Ordered by: cumulative time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.000    0.000    0.304    0.304 {built-in method builtins.exec}
        1    0.000    0.000    0.304    0.304 <string>:1(<module>)
        1    0.024    0.024    0.304    0.304 858601308.py:1(profiler)
   100000    0.020    0.000    0.279    0.000 {built-in method wordle_game.helper.generate_state}
   100000    0.017    0.000    0.259    0.000 helper.pyx:35(generate_state (wrapper))
   100000    0.179    0.000    0.242    0.000 helper.pyx:35(generate_state)
  1100000    0.063    0.000    0.063    0.000 helper.pyx:32(map_char)
        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}<jupyter_text>Testing<jupyter_code>game = wordle.WordleGame(target='perky')
solve = solver.MaxEntropy()
game.add_state("soare","BBBYY")
print(game)
solve.guess(game)
%lprun -f solve.guess solve.guess(game)
game.add_state("threw","BBGYB")
print(game)
solve.guess(game)
game.add_state("nerdy","BGGBG")
print(game)
solve.guess(game)
game.add_state("mercy","BGGBG")
print(game)
solve.guess(game)
solver.filter_answers(game)<jupyter_output><empty_output><jupyter_text>Simulate<jupyter_code>solutions = solve.simulate()
np.save('../data/maxentropy_solutions.npy', solutions)
solutions = np.load('../data/maxentropy_solutions.npy')
unique, counts = np.unique(solutions, return_counts=True)
print(np.asarray((unique, counts)).T)
# Average number of guesses
np.sum(unique[1:]*counts[1:])/counts[1:].sum()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14172882843352347, 'fraction_numerical': 0.09390083369899078, 'mean_word_length': 4.415676959619953, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '282442', 'license': 'MIT', 'n_tokens_mistral': 995, 'n_tokens_neox': 863, 'n_words': 140, 'path': 'notebooks/Max entropy.ipynb', 'repo_name': 'ahaque12/wordle-game', 'size': '2279'}