|
|
|
@@ -109,19 +109,46 @@ Users can start an Learnware Market workflow according to the following steps: |
|
|
|
"Task": { |
|
|
|
"Values": ["Classification"], |
|
|
|
"Type": "Class", |
|
|
|
}, |
|
|
|
"Device": {"Values": ["GPU"], "Type": "Tag"}, |
|
|
|
"Scenario": {"Values": ["Business"], "Type": "Tag"}, |
|
|
|
"Description": {"Values": "", "Type": "String"}, |
|
|
|
"Name": {"Values": "", "Type": "String"}, |
|
|
|
} |
|
|
|
user_info = BaseUserInfo(id="user_0", semantic_spec=user_semantic) |
|
|
|
_, single_learnware_list, _ = easy_market.search_learnware(user_info) |
|
|
|
}, |
|
|
|
"Device": {"Values": ["GPU"], "Type": "Tag"}, |
|
|
|
"Scenario": {"Values": ["Business"], "Type": "Tag"}, |
|
|
|
"Description": {"Values": "", "Type": "String"}, |
|
|
|
"Name": {"Values": "", "Type": "String"}, |
|
|
|
} |
|
|
|
user_info = BaseUserInfo(id="user", semantic_spec=user_semantic) |
|
|
|
_, single_learnware_list, _ = easy_market.search_learnware(user_info) |
|
|
|
|
|
|
|
4. Statistical specification search: |
|
|
|
|
|
|
|
Here, ``unzip_path`` is the directory where you unzip your learnware file, and ``rkme.json`` is your learnware's |
|
|
|
statistical specification. |
|
|
|
|
|
|
|
.. code-block:: python |
|
|
|
|
|
|
|
import learnware.specification as specification |
|
|
|
|
|
|
|
user_spec = specification.rkme.RKMEStatSpecification() |
|
|
|
user_spec.load(os.path.join(unzip_path, "rkme.json")) |
|
|
|
user_info = BaseUserInfo( |
|
|
|
id="user", semantic_spec=user_semantic, stat_info={"RKMEStatSpecification": user_spec} |
|
|
|
) |
|
|
|
(sorted_score_list, single_learnware_list, |
|
|
|
mixture_score, mixture_learnware_list) = easy_market.search_learnware(user_info) |
|
|
|
|
|
|
|
5. Reuse learnwares: |
|
|
|
|
|
|
|
Based on the returned list of learnwares ``mixture_learnware_list`` in the previous step, |
|
|
|
you can easily reuse them to make predictions your own data, instead of training a model from scratch. |
|
|
|
We provide two baseline methods for reusing a given list of learnwares, namely ``JobSelectorReuser`` and ``AveragingReuser``. |
|
|
|
|
|
|
|
.. code-block:: python |
|
|
|
|
|
|
|
reuse_job_selector = JobSelectorReuser(learnware_list=mixture_learnware_list) |
|
|
|
job_selector_predict_y = reuse_job_selector.predict(user_data=test_x) |
|
|
|
|
|
|
|
reuse_ensemble = AveragingReuser(learnware_list=mixture_learnware_list, mode='vote') |
|
|
|
ensemble_predict_y = reuse_ensemble.predict(user_data=test_x) |
|
|
|
|
|
|
|
.. _script: |
|
|
|
|
|
|
|
Example: Learnware Files |
|
|
|
|