Mercurial > repos > goeckslab > pycaret_predict
comparison utils.py @ 17:c5c324ac29fc draft default tip
planemo upload for repository https://github.com/goeckslab/gleam commit 7fc20c9ddc2b641975138c9d67b5da240af0484c
| author | goeckslab |
|---|---|
| date | Sat, 06 Dec 2025 14:20:36 +0000 |
| parents | a2aeeb754d76 |
| children |
comparison
equal
deleted
inserted
replaced
| 16:4fee4504646e | 17:c5c324ac29fc |
|---|---|
| 61 text-align: left; | 61 text-align: left; |
| 62 } | 62 } |
| 63 th { | 63 th { |
| 64 background-color: #4CAF50; | 64 background-color: #4CAF50; |
| 65 color: white; | 65 color: white; |
| 66 } | |
| 67 | |
| 68 /* Center specific numeric columns */ | |
| 69 .table-dataset-overview td:nth-child(n+2), | |
| 70 .table-dataset-overview th:nth-child(n+2) { | |
| 71 text-align: center; | |
| 72 } | |
| 73 .table-perf-summary td:nth-child(n+2), | |
| 74 .table-perf-summary th:nth-child(n+2) { | |
| 75 text-align: center; | |
| 76 } | |
| 77 .table-setup-params td:nth-child(2), | |
| 78 .table-setup-params th:nth-child(2) { | |
| 79 text-align: center; | |
| 80 } | |
| 81 .table-hyperparams td:nth-child(2), | |
| 82 .table-hyperparams th:nth-child(2) { | |
| 83 text-align: center; | |
| 84 } | |
| 85 .table-fi-scope td:nth-child(2), | |
| 86 .table-fi-scope th:nth-child(2) { | |
| 87 text-align: center; | |
| 66 } | 88 } |
| 67 | 89 |
| 68 .plot { | 90 .plot { |
| 69 text-align: center; | 91 text-align: center; |
| 70 margin: 20px 0; | 92 margin: 20px 0; |
| 192 def build_tabbed_html( | 214 def build_tabbed_html( |
| 193 summary_html: str, | 215 summary_html: str, |
| 194 test_html: str, | 216 test_html: str, |
| 195 feature_html: str, | 217 feature_html: str, |
| 196 explainer_html: Optional[str] = None, | 218 explainer_html: Optional[str] = None, |
| 219 config_html: Optional[str] = None, | |
| 197 ) -> str: | 220 ) -> str: |
| 198 """ | 221 """ |
| 199 Render the tabbed sections and an always-visible Help button. | 222 Render the tabbed sections and an always-visible Help button. |
| 200 """ | 223 """ |
| 201 # CSS | 224 # CSS |
| 202 css = get_html_template().split("<body>")[1].rsplit("</style>", 1)[0] + "</style>" | 225 css = get_html_template().split("<body>")[1].rsplit("</style>", 1)[0] + "</style>" |
| 203 | 226 |
| 204 # Tabs header | 227 # Tabs header |
| 205 tabs = [ | 228 tabs = ['<div class="tabs">'] |
| 206 '<div class="tabs">', | 229 default_active = "summary" |
| 207 '<div class="tab active" onclick="showTab(\'summary\')">Validation Summary and Config</div>', | 230 if config_html: |
| 231 default_active = "config" | |
| 232 tabs.append( | |
| 233 '<div class="tab active" onclick="showTab(\'config\')">Model Config Summary</div>' | |
| 234 ) | |
| 235 tabs.append( | |
| 236 '<div class="tab" onclick="showTab(\'summary\')">Validation Summary</div>' | |
| 237 ) | |
| 238 else: | |
| 239 tabs.append( | |
| 240 '<div class="tab active" onclick="showTab(\'summary\')">Validation Summary</div>' | |
| 241 ) | |
| 242 tabs.extend([ | |
| 208 '<div class="tab" onclick="showTab(\'test\')">Test Summary</div>', | 243 '<div class="tab" onclick="showTab(\'test\')">Test Summary</div>', |
| 209 '<div class="tab" onclick="showTab(\'feature\')">Feature Importance</div>', | 244 '<div class="tab" onclick="showTab(\'feature\')">Feature Importance</div>', |
| 210 ] | 245 ]) |
| 211 if explainer_html: | 246 if explainer_html: |
| 212 tabs.append( | 247 tabs.append( |
| 213 '<div class="tab" onclick="showTab(\'explainer\')">Explainer Plots</div>' | 248 '<div class="tab" onclick="showTab(\'explainer\')">Explainer Plots</div>' |
| 214 ) | 249 ) |
| 215 tabs.append('<button id="openMetricsHelp" class="help-btn">Help</button>') | 250 tabs.append('<button id="openMetricsHelp" class="help-btn">Help</button>') |
| 216 tabs.append("</div>") | 251 tabs.append("</div>") |
| 217 tabs_section = "\n".join(tabs) | 252 tabs_section = "\n".join(tabs) |
| 218 | 253 |
| 219 # Content | 254 # Content |
| 220 contents = [ | 255 contents = [] |
| 221 f'<div id="summary" class="tab-content active">{summary_html}</div>', | 256 if config_html: |
| 222 f'<div id="test" class="tab-content">{test_html}</div>', | 257 contents.append( |
| 223 f'<div id="feature" class="tab-content">{feature_html}</div>', | 258 f'<div id="config" class="tab-content {"active" if default_active == "config" else ""}">{config_html}</div>' |
| 224 ] | 259 ) |
| 260 contents.append( | |
| 261 f'<div id="summary" class="tab-content {"active" if default_active == "summary" else ""}">{summary_html}</div>' | |
| 262 ) | |
| 263 contents.append(f'<div id="test" class="tab-content">{test_html}</div>') | |
| 264 contents.append(f'<div id="feature" class="tab-content">{feature_html}</div>') | |
| 225 if explainer_html: | 265 if explainer_html: |
| 226 contents.append( | 266 contents.append( |
| 227 f'<div id="explainer" class="tab-content">{explainer_html}</div>' | 267 f'<div id="explainer" class="tab-content">{explainer_html}</div>' |
| 228 ) | 268 ) |
| 229 content_section = "\n".join(contents) | 269 content_section = "\n".join(contents) |
