-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhyper_volume.py
52 lines (45 loc) · 1.61 KB
/
hyper_volume.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# -*- coding: utf-8 -*-
# file: test.py
# time: 10:43 01/07/2023
# author: YANG, HENG <[email protected]> (杨恒)
# github: https://github.com/yangheng95
# huggingface: https://huggingface.co/yangheng
# google scholar: https://scholar.google.com/citations?user=NPq5a_0AAAAJ&hl=en
# Copyright (C) 2019-2023. All Rights Reserved.
import pickle
import findfile
import numpy as np
from pymoo.indicators.hv import HV
for model in [
# 'flan-t5-base',
"flan-t5-small",
]:
for dataset in [
"Laptop14",
"Restaurant14",
"SNLI",
"MNLI",
"SST-2",
"AgNews",
]:
for generation in range(1, 21):
for f in findfile.find_cwd_files(
[dataset, model, "Generation-" + str(generation)+'-', "29", "pkl"],
exclude_key=[".ignore", "06"],
):
with open(f, "rb") as fin:
evo_data = pickle.load(fin)
solutions = []
for individual in evo_data["__history_fronts__"][-1][0]:
solutions.append(
[
individual.objectives.objectives[0] / 1000.0,
# individual.objectives.objectives[0],
individual.objectives.objectives[1],
individual.objectives.objectives[2],
]
)
solutions = np.array(solutions)
print(solutions.shape)
hv = HV(ref_point=np.array([1.5, 1.5, 1.5]))
print("Generation", generation, f, hv(solutions))