|
|
|
@@ -10,7 +10,42 @@ All the searchers are implemented as a subclass of ``BaseSearcher``. When initia |
|
|
|
Homo Search |
|
|
|
====================== |
|
|
|
|
|
|
|
The homogeneous search of helpful learnwares can be divided into two stages: semantic specification search and statistical specification search. Both of them needs ``BaseUserInfo`` as input. |
|
|
|
The homogeneous search of helpful learnwares can be divided into two stages: semantic specification search and statistical specification search. Both of them needs ``BaseUserInfo`` as input. The following codes shows how to use the searcher to search for helpful learnwares from a market ``easy_market`` for a user. The introduction of ``EasyMarket`` is in `COMPONENTS: Market <../components/market.html>`_. |
|
|
|
|
|
|
|
.. code-block:: python |
|
|
|
|
|
|
|
# generate BaseUserInfo(semantic_spec + stat_info) |
|
|
|
user_semantic = { |
|
|
|
"Data": {"Values": ["Table"], "Type": "Class"}, |
|
|
|
"Task": {"Values": ["Regression"], "Type": "Class"}, |
|
|
|
"Library": {"Values": ["Scikit-learn"], "Type": "Class"}, |
|
|
|
"Scenario": {"Values": ["Business"], "Type": "Tag"}, |
|
|
|
"Description": {"Values": "", "Type": "String"}, |
|
|
|
"Name": {"Values": "", "Type": "String"}, |
|
|
|
"Input": {"Dimension": 82, "Description": {},}, |
|
|
|
"Output": {"Dimension": 1, "Description": {},}, |
|
|
|
"License": {"Values": ["MIT"], "Type": "Class"}, |
|
|
|
} |
|
|
|
user_spec = generate_rkme_table_spec(X=x) |
|
|
|
user_info = BaseUserInfo( |
|
|
|
semantic_spec=user_semantic, |
|
|
|
stat_info={"RKMETableSpecification": user_spec} |
|
|
|
) |
|
|
|
|
|
|
|
# search the market for the user |
|
|
|
search_result = easy_market.search_learnware(user_info) |
|
|
|
|
|
|
|
# search result: single_result |
|
|
|
single_result = search_result.get_single_results() |
|
|
|
print(f"single model num: {len(single_result)}, |
|
|
|
max_score: {single_result[0].score}, |
|
|
|
min_score: {single_result[-1].score}" |
|
|
|
) |
|
|
|
|
|
|
|
# search result: multiple_result |
|
|
|
multiple_result = search_result.get_multiple_results() |
|
|
|
mixture_id = " ".join([learnware.id for learnware in multiple_result[0].learnwares]) |
|
|
|
print(f"mixture_score: {multiple_result[0].score}, mixture_learnwares: {mixture_id}") |
|
|
|
|
|
|
|
|
|
|
|
Hetero Search |