<jupyter_start><jupyter_text>Search Report<jupyter_code># import sys
# import os

# submit_dir=os.environ['SLURM_SUBMIT_DIR']
# sys.path.append(submit_dir)
import matplotlib.pylab as plt
from IPython.display import display, Markdown, Latex

import re

import imageio
import numpy as np

import CocoRun
from see import Segmentors
from see import JupyterGUI

import inspect
import argparse

outputfolder = './'

images, masks, outputs = CocoRun.getCocoFolderLists(outputfolder)
#Fitness for all files
file = open(outputfolder+'params.txt','r')
fitness = []
filelines = file.readlines()
params = filelines[0]
for line in filelines[1:]:
    match = re.search(' ', line)
    fitness.append(float(line[:match.start()]))
print(params)
seg = Segmentors.algoFromParams(eval(params))

code = "```python\n"
code += inspect.getsource(seg.evaluate)
code += "```\n"

display(Markdown(code))
fitness = np.array(fitness)
total = len(fitness)
sorted_fitness = fitness.copy()
sorted_fitness.sort()

fivehundred_err = len(fitness[fitness < 500]) / total * 100
print(f"This parameter got {fivehundred_err}% on all the Coco files\n")
plt.hist(fitness[fitness < 500], 50);
plt.xlabel('fitness values')
plt.ylabel('image count');
###How fitness changes over time
file = open(f"{outputfolder}search.out","r") 
match = ''
tfitness = []
for line in file.readlines():
    if re.search('#BEST', line):
        match = re.search(" \- \[", line)
        tfitness.append(float(line[8:match.start()]))
file.close()

plt.plot(tfitness)
plt.xlabel('Generation')
plt.ylabel('Fitness')
plt.title('Evolution of the fitness');
#for imagename, maskname, outputname in zip(images, masks, output):
index = 10

imagename = images[index]
maskname = masks[index]
outputname = outputs[index]

print("\n")

image = imageio.imread(imagename)
mask = imageio.imread(maskname)
output = imageio.imread(outputname)

JupyterGUI.showthree(image,mask,output)
print(f"{image} {mask} {output}")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14743263853584138, 'fraction_numerical': 0.00813421453990849, 'mean_word_length': 5.881118881118881, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '650127', 'license': 'MIT', 'n_tokens_mistral': 709, 'n_tokens_neox': 687, 'n_words': 157, 'path': 'Image_data/FileReport.ipynb', 'repo_name': 'genster6/Simple-Evolutionary-Exploration', 'size': '1967'}