コンテンツにスキップ

Result Class

ml_debugger.result.base.result.Result

Bases: ABC

Base class for ML evaluation results.

Manages polling for evaluation completion, issue retrieval, and provides abstract methods for summarizing and viewing results.

属性:

名前 タイプ デスクリプション
result_id str

Unique evaluation job identifier.

result_name str

Alias for the evaluation result.

model_name str

Name of the evaluated model.

version_name str

Version identifier of the evaluated model.

service_client ServiceClient

Client interface for API calls.

evaluation_completed bool

True once evaluation has finished.

issues_data Optional[Dict[str, Any]]

Cached issues once retrieved.

__init__(result_id, result_name, model_name, version_name, service_client)

Initialize the Result and wait for evaluation completion.

引数:

名前 タイプ デスクリプション デフォルト

result_id

str

Unique identifier of the evaluation job.

必須

result_name

str

User-facing alias for the result.

必須

model_name

str

Name of the evaluated model.

必須

version_name

str

Version of the evaluated model.

必須

service_client

ServiceClient

Client for service API interactions.

必須

metrics_summary(dataset_type=None)

issue_category_summary(dataset_type=None)

get_summary(dataset_type=None)

Print a formatted summary of evaluation results to stdout.

Template method: renders the shared section skeleton (evaluation metadata, optional analysis note, per-dataset_type category detail, and the trailing term-definition block) identically for every task. The only task-specific pieces are supplied by overridable hooks / class attributes: :meth:_build_category_metric_lines (per-category Metrics: rows), :attr:_ERROR_CODE_PAD (ErrorCodes column width), and :attr:_TERM_DEFINITION (error-code legend).

引数:

名前 タイプ デスクリプション デフォルト

dataset_type

Optional[str]

dataset_type filter.

None

get_issues()

Retrieve list of issues.

戻り値:

タイプ デスクリプション
DataFrame

The final evaluation result from the server

get_view(*args, **kwargs) abstractmethod

Retrieve the final evaluation result.

戻り値:

タイプ デスクリプション
DataFrame

pd.DataFrame: summary of the evaluation result

get_heatmap(x_axis=None, y_axis=None, target=None, n_bins=20, dataset_type=None, aggregation_level='input_id', bbox_strategy=None, input_strategy=None, property_filters=None, sequence_mapping=None)

Fetch a heatmap for the requested configuration (one server call).

Returns a :class:~ml_debugger.visualization.schemas.Heatmap. Render it with .show() (display), .to_figure() (Figure only) or .save(path); subtract two heatmaps (hm_a - hm_b) for a :class:~ml_debugger.visualization.schemas.HeatmapDelta. Rendering options (mode / cmap / color_scale / figsize) live on those methods, so the fetched data can be re-rendered without another server call.

引数:

名前 タイプ デスクリプション デフォルト

x_axis

str | None

X-axis column key. None uses the task default (e.g. pred_score).

None

y_axis

str | None

Y-axis column key. None uses the task default (e.g. error_proba).

None

target

str | None

Target column key used for error coloring. None uses the task default.

None

n_bins

int

Bins per axis (1-100).

20

dataset_type

str | None

Which dataset to read out of the result (e.g. 'train' / 'val' / 'pool'). None (default) reads every dataset the result holds and returns a HeatmapGroup. Not part of the fetch itself, so passing it inside property_filters is a ValueError.

None

aggregation_level

Literal['bbox', 'input_id', 'sequence']

'bbox', 'input_id' (default), or 'sequence'.

'input_id'

bbox_strategy

Union[BBoxStrategy, Dict[str, Any], str] | None

BBox aggregation/filter config (same shape as DataFilter's BBoxStrategy); may be a yaml/json path.

None

input_strategy

Union[SequenceAggregation, Dict[str, Any], str] | None

Sequence aggregation config; may be a yaml/json path.

None

property_filters

Dict[str, List[Any]] | None

Additional discrete filters keyed by column name (e.g. {'pred_class_id': [0, 1]}). Must not include 'dataset_type' — pass that as the explicit argument.

None

sequence_mapping

Dict[str, Any] | None

Explicit input_id -> sequence_id mapping for sequence aggregation. None lets the server use any cached mapping.

None

戻り値:

名前 タイプ デスクリプション
Heatmap Union[Heatmap, HeatmapGroup]

single-dataset flattened heatmap.

発生:

タイプ デスクリプション
ValueError

dataset_type was passed inside property_filters.

get_note(analysis_type='performance_analyst', language=None, use_cached=True, wait=True, timeout=600.0, polling_interval=5.0)

Fetch (or generate) a plain-language analysis note for this result.

Returns the latest completed performance_analyst note when one exists (default use_cached=True); otherwise triggers the server-side analysis, waits for it to finish, and returns an :class:~ml_debugger.result.note.AnalysisNote. Render it with .show() / print(note) (terminals) or just evaluate it in Jupyter (markdown).

引数:

名前 タイプ デスクリプション デフォルト

analysis_type

str

Recipe name (default "performance_analyst").

'performance_analyst'

language

str | None

Language for the note (e.g. "ja"). None (default) yields English. Only used when a fresh analysis is triggered.

None

use_cached

bool

When True (default), reuse the latest completed note instead of generating a new one (the GUI may have generated it already). Note the cache is not scoped by language — the envelope carries no language info, so a cached note may be in a different language. Pass use_cached=False to force regeneration or to switch language.

True

wait

bool

When True (default), block until the analysis completes and return an :class:~ml_debugger.result.note.AnalysisNote. When False, return a :class:~ml_debugger.result.note.NoteHandle immediately (only when a fresh analysis is triggered; a cache hit still returns the note directly).

True

timeout

float

Max seconds to wait for completion (wait=True).

600.0

polling_interval

float

Seconds between status polls.

5.0

戻り値:

タイプ デスクリプション
Any

AnalysisNote when wait=True; NoteHandle when wait=False.

発生:

タイプ デスクリプション
ValueError

Local mode (agentic analyses need the API server).

ConflictError

Result not completed / an analysis is already running.

UnprocessableEntityError

Unsupported task on the server side.

NotFoundError

Server without agentic-analysis support.

APIError

Analysis FAILED, timed out, or other transport errors.

recommend_heatmaps(analysis_type='heatmap_advisor', language=None, use_cached=True, wait=True, timeout=600.0, polling_interval=5.0)

Recommend heatmap views that surface where this model errs.

Returns the latest completed heatmap_advisor advice when one exists (default use_cached=True); otherwise triggers the server-side analysis, waits for it to finish, and returns a :class:~ml_debugger.result.heatmap_advice.HeatmapAdvice. The advice pairs a plain-language note with recommended heatmap views: render the note with .show_note() / print(advice.note) (terminals) or evaluate the advice in Jupyter (markdown), list the views with advice.summary(), and fetch a view with advice.get_heatmap(0).show() (cache-first, so it is fast).

Supported for classification / object_detection / object_detection_3d (all three tasks; no client-side gate).

引数:

名前 タイプ デスクリプション デフォルト

analysis_type

str

Recipe name (default "heatmap_advisor").

'heatmap_advisor'

language

str | None

Language for the note (e.g. "ja"). None (default) yields English. Only used when a fresh analysis is triggered.

None

use_cached

bool

When True (default), reuse the latest completed advice instead of generating a new one (the GUI may have generated it already). Note the cache is not scoped by language — the envelope carries no language info, so a cached advice may be in a different language. Pass use_cached=False to force regeneration or to switch language.

True

wait

bool

When True (default), block until the analysis completes and return a :class:~ml_debugger.result.heatmap_advice.HeatmapAdvice. When False, return a :class:~ml_debugger.result.heatmap_advice.HeatmapAdviceHandle immediately (only when a fresh analysis is triggered; a cache hit still returns the advice directly).

True

timeout

float

Max seconds to wait for completion (wait=True).

600.0

polling_interval

float

Seconds between status polls.

5.0

戻り値:

タイプ デスクリプション
Any

HeatmapAdvice when wait=True; HeatmapAdviceHandle when wait=False.

発生:

タイプ デスクリプション
ValueError

Local mode (agentic analyses need the API server).

ConflictError

Result not completed / an analysis is already running.

UnprocessableEntityError

Unsupported task on the server side.

NotFoundError

Server without agentic-analysis support.

APIError

Analysis FAILED, timed out, agent analysis is disabled in user settings, or other transport errors.

recommend_al_strategy(n_data=None, dataset_type=None, language=None, analysis_type='al_strategy_recommender', use_cached=False, wait=True, timeout=300.0, polling_interval=3.0, **agent_args)

Recommend an Active-Learning data-collection strategy for this result.

Triggers the server-side al_strategy_recommender agentic analysis, waits for it to finish, and returns an :class:ALRecommendation whose query_strategy feeds DataFilter.query(strategy=rec) and whose heatmap params drive :meth:ALRecommendation.get_heatmap.

Supported tasks: classification / object_detection / object_detection_3d. The server owns this list and answers with the reason when a task is not supported, so it can widen without an SDK upgrade.

引数:

名前 タイプ デスクリプション デフォルト

n_data

int | None

Labeling budget (images / sequences). It is echoed back in the recommendation and used by DataFilter.query when the recommendation is passed without an explicit n_data. None leaves the budget out, so query then needs one.

None

dataset_type

str | None

Evaluation split to analyse (e.g. "val"). None lets MLdebugger pick the split, preferring validation data.

None

language

str | None

Language for param_basis / rationale (e.g. "ja"). None (default) yields English.

None

analysis_type

str

Recipe name (default "al_strategy_recommender").

'al_strategy_recommender'

use_cached

bool

When True, reuse the latest completed analysis instead of running a fresh one. Default False because the cache is keyed only by result + recipe and cannot be scoped to dataset_type / n_data / language — a cached result may have used different params.

False

wait

bool

When True (default), block until the analysis completes and return an :class:ALRecommendation. When False, return an :class:AnalysisHandle immediately.

True

timeout

float

Max seconds to wait for completion (wait=True).

300.0

polling_interval

float

Seconds between status polls.

3.0

**agent_args

Any

Additional options for the analysis, forwarded as given — e.g. aggregation_level="input_id" to recommend at frame level, or a sequence_mapping for scene-level detection recommendations. The server decides which options a task accepts and rejects the rest.

{}

戻り値:

タイプ デスクリプション
Any

ALRecommendation when wait=True; AnalysisHandle when wait=False.

発生:

タイプ デスクリプション
ValueError

Local mode (the analysis runs on the server).

ConflictError

Result not completed / different-parameter analysis running.

UnprocessableEntityError

Unsupported task on the server side.

NotFoundError

Server without agentic-analysis support.

APIError

Analysis FAILED, timed out, or other transport errors.