diff --git a/learnware/market/__init__.py b/learnware/market/__init__.py index 8347527..10654c7 100644 --- a/learnware/market/__init__.py +++ b/learnware/market/__init__.py @@ -1,4 +1,5 @@ -from .base import BaseUserInfo, BaseMarket from .anchor import AnchoredUserInfo, AnchoredMarket +from .base import BaseUserInfo, BaseMarket +from .evolve_anchor import EvolvedAnchoredMarket from .evolve import EvolvedMarket from .easy import EasyMarket diff --git a/learnware/market/evolve.py b/learnware/market/evolve.py index fb7fcbc..7415de4 100644 --- a/learnware/market/evolve.py +++ b/learnware/market/evolve.py @@ -1,23 +1,23 @@ from typing import Tuple, Any, List, Union, Dict +from .base import BaseMarket from ..learnware import Learnware from ..specification import BaseStatSpecification -from .anchor import AnchoredUserInfo, AnchoredMarket -class EvolvedMarket(AnchoredMarket): +class EvolvedMarket(BaseMarket): """Organize learnwares and enable them to continuously evolve Parameters ---------- - AnchoredMarket : _type_ - Market version with anchors + BaseMarket : _type_ + Basic market version """ def __init__(self): super(EvolvedMarket, self).__init__() - def generate_stat_specification(self, learnware: Learnware) -> BaseStatSpecification: + def generate_new_stat_specification(self, learnware: Learnware) -> BaseStatSpecification: """Generate new statistical specification for learnwares Parameters @@ -31,16 +31,6 @@ class EvolvedMarket(AnchoredMarket): """ pass - def evolve_anchor_learnware_list(self, anchor_id_list: List[str]): - """Enable anchor learnwares to evolve, e.g., new stat_spec - - Parameters - ---------- - anchor_id_list : List[str] - Id list for Anchor learnwares - """ - pass - def evolve_learnware_list(self, id_list: List[str]): """Enable learnwares to evolve, e.g., new stat_spec @@ -50,27 +40,3 @@ class EvolvedMarket(AnchoredMarket): Id list for learnwares """ pass - - def evolve_anchor_learnware_by_user(self, user_info: AnchoredUserInfo): - """Enable anchor leanrwares to evolve based on user statistical information - - Parameters - ---------- - user_info : AnchoredUserInfo - User information with statistics calculated on anchors - """ - pass - - def evolve_learnware_by_user(self, learnware_id: str, user_info: AnchoredUserInfo): - """ - Enable leanrwares to evolve based on user info - - e.g., When we estimate the performance of a specific learnware on user tasks, we can further refine the update of the learnware specification - - Parameters - ---------- - learnware_id : str - Leanrware id - user_info : AnchoredUserInfo - User information with statistics calculated on anchors - """ - pass diff --git a/learnware/market/evolve_anchor.py b/learnware/market/evolve_anchor.py new file mode 100644 index 0000000..adea95c --- /dev/null +++ b/learnware/market/evolve_anchor.py @@ -0,0 +1,53 @@ +from typing import Tuple, Any, List, Union, Dict + +from .anchor import AnchoredUserInfo, AnchoredMarket +from .evolve import EvolvedMarket + + +class EvolvedAnchoredMarket(AnchoredMarket, EvolvedMarket): + """Organize learnwares with anchors and enable them to continuously evolve + + Parameters + ---------- + AnchoredMarket : _type_ + Market version with anchors + EvolvedMarket : _type_ + Market version with evolved learnwares + """ + + def __init__(self): + super(EvolvedAnchoredMarket, self).__init__() + + def evolve_anchor_learnware_list(self, anchor_id_list: List[str]): + """Enable anchor learnwares to evolve, e.g., new stat_spec + + Parameters + ---------- + anchor_id_list : List[str] + Id list for Anchor learnwares + """ + pass + + def evolve_anchor_learnware_by_user(self, user_info: AnchoredUserInfo): + """Enable anchor leanrwares to evolve based on user statistical information + + Parameters + ---------- + user_info : AnchoredUserInfo + User information with statistics calculated on anchors + """ + pass + + def evolve_learnware_by_user(self, learnware_id: str, user_info: AnchoredUserInfo): + """ + Enable leanrwares to evolve based on user info + - e.g., When we estimate the performance of a specific learnware on user tasks, we can further refine the update of the learnware specification + + Parameters + ---------- + learnware_id : str + Leanrware id + user_info : AnchoredUserInfo + User information with statistics calculated on anchors + """ + pass