Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions ax/core/analysis_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,3 +431,17 @@ def _body_html(self, depth: int) -> str:
"""

return f"<div class='content'>{self.blob}</div>"


class NotApplicableStateAnalysisCard(AnalysisCard):
"""Card for analyses that are not applicable to the current experiment state.

This card represents a transient state where an analysis cannot be computed
due to the current experiment state (e.g., when the experiment doesn't have enough
data, when no model has been fit yet, or when required trials have not completed),
but may become available as the experiment progresses.
"""

def _body_html(self, depth: int) -> str:
"""Return the HTML body containing the not-applicable explanation text."""
return f"<div class='content'>{self.blob}</div>"
13 changes: 12 additions & 1 deletion ax/core/tests/test_analysis_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ax.analysis.analysis import AnalysisCard
from ax.analysis.markdown.markdown_analysis import MarkdownAnalysisCard
from ax.analysis.plotly.plotly_analysis import PlotlyAnalysisCard
from ax.core.analysis_card import AnalysisCardGroup
from ax.core.analysis_card import AnalysisCardGroup, NotApplicableStateAnalysisCard
from ax.utils.common.testutils import TestCase
from plotly import graph_objects as go, io as pio

Expand Down Expand Up @@ -67,3 +67,14 @@ def test_hierarchy_str(self) -> None:
test_markdown_analysis_card_title"""

self.assertEqual(big_group.hierarchy_str(), expected)

def test_not_applicable_card(self) -> None:
"""Test NotApplicableStateAnalysisCard._body_html renders blob content."""
card = NotApplicableStateAnalysisCard(
name="Test",
title="Test",
subtitle="",
df=pd.DataFrame(),
blob="Explanation text.",
)
self.assertIn("Explanation text.", card._body_html(depth=0))
Loading