|
import json
|
|
|
|
|
|
with open('humaneval_new.json', 'r') as file:
|
|
data = json.load(file)
|
|
|
|
|
|
values_of_A = [obj['line'] for obj in data]
|
|
|
|
|
|
min_A = min(values_of_A)
|
|
max_A = max(values_of_A)
|
|
|
|
|
|
num_intervals = 3
|
|
interval_width = (max_A - min_A) / num_intervals
|
|
|
|
|
|
intervals = [(min_A + i * interval_width, min_A + (i + 1) * interval_width) for i in range(num_intervals)]
|
|
|
|
|
|
subsets = [[] for _ in range(num_intervals)]
|
|
|
|
for obj in data:
|
|
value_A = obj['line']
|
|
for i, (start, end) in enumerate(intervals):
|
|
if start <= value_A < end:
|
|
subsets[i].append(obj)
|
|
break
|
|
|
|
with open('EI.json', 'w', encoding='utf-8') as file:
|
|
json.dump(data, file, ensure_ascii=False, indent=4) |