REE / tasks /bicycle_studio /solution /reference /scalarization.py
zzqsb's picture
Release the REE tasks and dataset card.
7f50cd1
Raw History Blame Contribute Delete
687 Bytes
import numpy as np
import torch
from torch import Tensor
'''
numpy evaluation may have some problems, please check.
Here, an interesting thing is that, PBI and COSMOS are not MOO agg functions.
I.e., the optimas may not be Pareto optimal.
'''
def tche(f_arr, w, z=0):
if type(f_arr) == Tensor:
idx = torch.argmax(w * (f_arr - z), axis=1)
return f_arr[torch.arange(f_arr.shape[0]), idx]
# return [0]
elif type(f_arr) == np.ndarray:
idx = np.argmax(w * (f_arr - z), axis=1)
return f_arr[np.arange(f_arr.shape[0]), idx]
# return np.max(w * (f_arr - z), axis=1)
else:
raise Exception('type not supported')