ALRecommendation
Result.recommend_al_strategy が返します。DataFilter.query(strategy=rec) に渡せるほか、save_query_config() で query(strategy=<パス>) が読める戦略ファイルとして保存できます(to_query_config() は同じ内容を辞書で返します)。使い方は Agent Analysis を参照してください。
ml_debugger.result.recommendation.ALRecommendation
dataclass
A measured Active-Learning recommendation parsed from the server.
属性:
| 名前 | タイプ | デスクリプション |
|---|---|---|
reason |
str
|
|
al_recommended |
bool
|
|
task_name |
Optional[str]
|
|
query_strategy |
Optional[Union[BBoxStrategy, FilterConfig]]
|
Selection strategy for |
n_data |
Optional[int]
|
Labeling budget echoed back from the recommendation request.
|
sampling |
Any
|
|
aggregation_level |
str
|
|
sequence_aggregation |
Optional[SequenceAggregation]
|
How the inputs of one sequence fold into that
sequence's score, as recommended for a sequence-level selection (3D).
|
heatmap |
Dict[str, Any]
|
|
reason_detail |
Optional[str]
|
Why there is no usable strategy. |
param_basis |
str
|
Plain-language explanation of why these params. |
rationale |
str
|
Short plain-language justification. |
alternatives |
Any
|
Up to a few runner-up candidates (each carries its own
|
measured_profile |
Any
|
|
raw |
Dict[str, Any]
|
The full |
summary()
Return a formatted, human-readable summary of the recommendation.
get_heatmap(dataset_type=None, **overrides)
Fetch the recommended heatmap by delegating to Result.get_heatmap.
The recommended view is fetched as recommended: its axes, target, bins,
aggregation level and the strategies that go with that level. None
axes fall back to the task defaults of Result.get_heatmap. Any
keyword override (e.g. n_bins / aggregation_level /
input_strategy / sequence_mapping) wins over the recommended
value. Render the returned
:class:~ml_debugger.visualization.schemas.Heatmap with
.show(mode=..., cmap=...) / .to_figure() / .save(path).
引数:
| 名前 | タイプ | デスクリプション | デフォルト |
|---|---|---|---|
|
Optional[str]
|
Which dataset to visualize. |
None
|
|
Any
|
Forwarded to |
{}
|
save_query_config(path, n_data=None)
Save the recommendation as a query strategy file.
The file holds :meth:to_query_config and is read back by
DataFilter.query(strategy=<path>). Its format follows the suffix:
.yaml / .yml for YAML, .json for JSON.
引数:
| 名前 | タイプ | デスクリプション | デフォルト |
|---|---|---|---|
|
Union[str, Path]
|
Destination file path. |
必須 |
|
Optional[int]
|
Labeling budget to write into the file. Defaults to the
budget the recommendation was requested for ( |
None
|
戻り値:
| タイプ | デスクリプション |
|---|---|
Path
|
The path the file was written to. |
発生:
| タイプ | デスクリプション |
|---|---|
ValueError
|
If the recommendation has no strategy to save,
|
ImportError
|
If a YAML file is requested and PyYAML is not installed. |
例:
>>> path = rec.save_query_config("al_strategy.yaml")
>>> ids = data_filter.query(n_data=200, strategy="al_strategy.yaml")
to_query_config(n_data=None)
Return the recommendation as the content of a query strategy file.
The dict has the layout DataFilter.query(strategy=<path>) reads from a
strategy file: strategy (how to rank and pick the data), sequence
(only for a sequence-level recommendation: how the inputs of one sequence
fold into its score) and query (n_data / aggregation_level /
sampling to pass to query() alongside the file). Every value is a
plain builtin, so the dict can be written as YAML or JSON as is.
引数:
| 名前 | タイプ | デスクリプション | デフォルト |
|---|---|---|---|
|
Optional[int]
|
Labeling budget to write into the |
None
|
戻り値:
| タイプ | デスクリプション |
|---|---|
Dict[str, Any]
|
The strategy file content as a plain dict. |
発生:
| タイプ | デスクリプション |
|---|---|
ValueError
|
If the recommendation has no strategy to save, or
|
例:
>>> config = rec.to_query_config()
>>> config["query"]["n_data"]
200