|
|
|
@@ -333,7 +333,7 @@ class EasyMarket(BaseMarket): |
|
|
|
learnware_list: List[Learnware], |
|
|
|
user_rkme: RKMEStatSpecification, |
|
|
|
max_search_num: int, |
|
|
|
weight_cutoff: float = 0.95 |
|
|
|
weight_cutoff: float = 0.95, |
|
|
|
) -> Tuple[List[float], List[Learnware]]: |
|
|
|
"""Select learnwares based on a total mixture ratio, then recalculate their mixture weights |
|
|
|
|
|
|
|
@@ -372,15 +372,15 @@ class EasyMarket(BaseMarket): |
|
|
|
mixture_list.append(learnware_list[idx]) |
|
|
|
else: |
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
if len(mixture_list) <= 1: |
|
|
|
mixture_list = [learnware_list[sort_by_weight_idx_list[0]]] |
|
|
|
mixture_weight = [1] |
|
|
|
else: |
|
|
|
if len(mixture_list) > max_search_num: |
|
|
|
mixture_list = mixture_list[:max_search_num] |
|
|
|
mixture_list = mixture_list[:max_search_num] |
|
|
|
mixture_weight, _ = self._calculate_rkme_spec_mixture_weight(mixture_list, user_rkme) |
|
|
|
|
|
|
|
|
|
|
|
return mixture_weight, mixture_list |
|
|
|
|
|
|
|
def _filter_by_rkme_spec_single( |
|
|
|
@@ -618,11 +618,11 @@ class EasyMarket(BaseMarket): |
|
|
|
sorted_score_list, single_learnware_list = self._filter_by_rkme_spec_single( |
|
|
|
sorted_score_list, single_learnware_list |
|
|
|
) |
|
|
|
if search_method == 'auto': |
|
|
|
if search_method == "auto": |
|
|
|
weight_list, mixture_learnware_list = self._search_by_rkme_spec_mixture_auto( |
|
|
|
learnware_list, user_rkme, max_search_num |
|
|
|
) |
|
|
|
elif search_method == 'greedy': |
|
|
|
elif search_method == "greedy": |
|
|
|
weight_list, mixture_learnware_list = self._search_by_rkme_spec_mixture_greedy( |
|
|
|
learnware_list, user_rkme, max_search_num |
|
|
|
) |
|
|
|
|