Browse Source

[MNT] Add EvolvedAnchoredMarket and modify EvolvedMarket

tags/v0.3.2
Gene 3 years ago
parent
commit
df1dbbfa32
3 changed files with 60 additions and 40 deletions
  1. +2
    -1
      learnware/market/__init__.py
  2. +5
    -39
      learnware/market/evolve.py
  3. +53
    -0
      learnware/market/evolve_anchor.py

+ 2
- 1
learnware/market/__init__.py View File

@@ -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

+ 5
- 39
learnware/market/evolve.py View File

@@ -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

+ 53
- 0
learnware/market/evolve_anchor.py View File

@@ -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

Loading…
Cancel
Save