robert 2.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. robert/__init__.py +9 -0
  2. robert/__main__.py +20 -0
  3. robert/_version.py +3 -0
  4. robert/api.py +646 -0
  5. robert/aqme.py +280 -0
  6. robert/argument_parser.py +98 -0
  7. robert/checkml.py +433 -0
  8. robert/checkml_score.py +50 -0
  9. robert/curate.py +217 -0
  10. robert/evaluate_bot_retrieval.py +125 -0
  11. robert/evaluate_bot_support.py +102 -0
  12. robert/evaluate_workflow_summaries.py +87 -0
  13. robert/export_bot_docs_knowledge.py +1632 -0
  14. robert/generate.py +249 -0
  15. robert/generate_utils.py +311 -0
  16. robert/gui_easyrob/__init__.py +0 -0
  17. robert/gui_easyrob/assets/gif_easyrob.gif +0 -0
  18. robert/gui_easyrob/bot/__init__.py +47 -0
  19. robert/gui_easyrob/bot/answer_metadata.py +198 -0
  20. robert/gui_easyrob/bot/bot_context.py +679 -0
  21. robert/gui_easyrob/bot/bot_engine.py +1100 -0
  22. robert/gui_easyrob/bot/bot_panel.py +1231 -0
  23. robert/gui_easyrob/bot/bot_rag.py +1178 -0
  24. robert/gui_easyrob/bot/bot_window.py +39 -0
  25. robert/gui_easyrob/bot/bot_worker.py +149 -0
  26. robert/gui_easyrob/bot/credential_store.py +143 -0
  27. robert/gui_easyrob/bot/error_parser.py +105 -0
  28. robert/gui_easyrob/bot/evidence_policy.py +164 -0
  29. robert/gui_easyrob/bot/heuristics.py +859 -0
  30. robert/gui_easyrob/bot/icons.py +56 -0
  31. robert/gui_easyrob/bot/input_csv_audit.py +212 -0
  32. robert/gui_easyrob/bot/knowledge/aqme_context.json +5907 -0
  33. robert/gui_easyrob/bot/knowledge/robert_context.json +4817 -0
  34. robert/gui_easyrob/bot/knowledge/ui_context.json +8293 -0
  35. robert/gui_easyrob/bot/knowledge_schema.py +1252 -0
  36. robert/gui_easyrob/bot/knowledge_sources/aqme_user_guidance.json +442 -0
  37. robert/gui_easyrob/bot/knowledge_sources/coverage_manifest.json +95 -0
  38. robert/gui_easyrob/bot/knowledge_sources/robert_user_guidance.json +471 -0
  39. robert/gui_easyrob/bot/knowledge_sources/ui_user_guidance.json +1312 -0
  40. robert/gui_easyrob/bot/llm_providers.py +1573 -0
  41. robert/gui_easyrob/bot/online_docs.py +105 -0
  42. robert/gui_easyrob/bot/prompt_policy.py +575 -0
  43. robert/gui_easyrob/bot/question_intent.py +562 -0
  44. robert/gui_easyrob/bot/response_quality.py +104 -0
  45. robert/gui_easyrob/bot/result_insights.py +225 -0
  46. robert/gui_easyrob/bot/token_usage.py +75 -0
  47. robert/gui_easyrob/bot/workflow_results.py +1396 -0
  48. robert/gui_easyrob/checkml_launcher.py +15 -0
  49. robert/gui_easyrob/easyrob.py +29 -0
  50. robert/gui_easyrob/easyrob_launcher.py +113 -0
  51. robert/gui_easyrob/main/__init__.py +9 -0
  52. robert/gui_easyrob/main/window.py +5152 -0
  53. robert/gui_easyrob/result_navigation.py +14 -0
  54. robert/gui_easyrob/tabs/__init__.py +23 -0
  55. robert/gui_easyrob/tabs/advanced_options.py +370 -0
  56. robert/gui_easyrob/tabs/aqme.py +1234 -0
  57. robert/gui_easyrob/tabs/checkml.py +898 -0
  58. robert/gui_easyrob/tabs/images.py +427 -0
  59. robert/gui_easyrob/tabs/interactive_predictions.py +555 -0
  60. robert/gui_easyrob/tabs/molssi.py +447 -0
  61. robert/gui_easyrob/tabs/predictions.py +484 -0
  62. robert/gui_easyrob/tabs/result_catalog.py +170 -0
  63. robert/gui_easyrob/tabs/results.py +490 -0
  64. robert/gui_easyrob/tabs/results_workspace.py +120 -0
  65. robert/gui_easyrob/test_bot_input_csv_audit.py +152 -0
  66. robert/gui_easyrob/test_bot_question_routing.py +383 -0
  67. robert/gui_easyrob/test_bot_result_analysis.py +356 -0
  68. robert/gui_easyrob/test_bot_retrieval_evaluation.py +110 -0
  69. robert/gui_easyrob/test_bot_ui_integration.py +278 -0
  70. robert/gui_easyrob/test_checkml_app_mode.py +124 -0
  71. robert/gui_easyrob/test_checkml_completion.py +57 -0
  72. robert/gui_easyrob/test_checkml_defaults.py +37 -0
  73. robert/gui_easyrob/test_checkml_result_summary.py +113 -0
  74. robert/gui_easyrob/test_checkml_web_mode.py +57 -0
  75. robert/gui_easyrob/test_dialog_layout.py +33 -0
  76. robert/gui_easyrob/test_gui_bot_regressions.py +320 -0
  77. robert/gui_easyrob/test_molssi_auto.py +569 -0
  78. robert/gui_easyrob/test_tutorial_view.py +215 -0
  79. robert/gui_easyrob/tutorials/check_model.md +25 -0
  80. robert/gui_easyrob/tutorials/chemdraw.md +49 -0
  81. robert/gui_easyrob/tutorials/csv.md +53 -0
  82. robert/gui_easyrob/tutorials/descriptors.md +21 -0
  83. robert/gui_easyrob/tutorials/overview.md +65 -0
  84. robert/gui_easyrob/tutorials/predictions.md +25 -0
  85. robert/gui_easyrob/tutorials/robbot.md +29 -0
  86. robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_1.png +0 -0
  87. robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_2.png +0 -0
  88. robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_3.png +0 -0
  89. robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_4.png +0 -0
  90. robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_5.png +0 -0
  91. robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_6.png +0 -0
  92. robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_7.png +0 -0
  93. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_1.png +0 -0
  94. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_10.png +0 -0
  95. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_11.png +0 -0
  96. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_12.png +0 -0
  97. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_13.png +0 -0
  98. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_2.png +0 -0
  99. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_3.png +0 -0
  100. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_4.png +0 -0
  101. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_5.png +0 -0
  102. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_6.png +0 -0
  103. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_7.png +0 -0
  104. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_8.png +0 -0
  105. robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_9.png +0 -0
  106. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1.png +0 -0
  107. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1_1.png +0 -0
  108. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1_2.png +0 -0
  109. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1_3.png +0 -0
  110. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1_4.png +0 -0
  111. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1_5.png +0 -0
  112. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_2.png +0 -0
  113. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_3.png +0 -0
  114. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_4.png +0 -0
  115. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_5.png +0 -0
  116. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_6.png +0 -0
  117. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_7.png +0 -0
  118. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_8.png +0 -0
  119. robert/gui_easyrob/tutorials/tutorial_images/csv/csv_9.png +0 -0
  120. robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_1.png +0 -0
  121. robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_2.png +0 -0
  122. robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_3.png +0 -0
  123. robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_4.png +0 -0
  124. robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_5.png +0 -0
  125. robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_6.png +0 -0
  126. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1.png +0 -0
  127. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_1.png +0 -0
  128. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_2.png +0 -0
  129. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_3.png +0 -0
  130. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_4.png +0 -0
  131. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_5.png +0 -0
  132. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_6.png +0 -0
  133. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_7.png +0 -0
  134. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_8.png +0 -0
  135. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_2.png +0 -0
  136. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_3.png +0 -0
  137. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_4.png +0 -0
  138. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_5.png +0 -0
  139. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_5_1.png +0 -0
  140. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_5_2.png +0 -0
  141. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_5_3.png +0 -0
  142. robert/gui_easyrob/tutorials/tutorial_images/overview/overview_6.png +0 -0
  143. robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_1.png +0 -0
  144. robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_1_1.png +0 -0
  145. robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_2.png +0 -0
  146. robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_3.png +0 -0
  147. robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_4.png +0 -0
  148. robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_5.png +0 -0
  149. robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_6.png +0 -0
  150. robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_1.png +0 -0
  151. robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_2.png +0 -0
  152. robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_3.png +0 -0
  153. robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_4.png +0 -0
  154. robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_5.png +0 -0
  155. robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_6.png +0 -0
  156. robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_7.png +0 -0
  157. robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_8.png +0 -0
  158. robert/gui_easyrob/utils/__init__.py +0 -0
  159. robert/gui_easyrob/utils/aqme_utils.py +238 -0
  160. robert/gui_easyrob/utils/molssi_utils.py +584 -0
  161. robert/gui_easyrob/utils/predictions_utils.py +985 -0
  162. robert/gui_easyrob/utils/utils_gui.py +738 -0
  163. robert/gui_easyrob/version.py +68 -0
  164. robert/gui_easyrob/web/app.css +484 -0
  165. robert/gui_easyrob/web/app.html +134 -0
  166. robert/gui_easyrob/web/app.js +764 -0
  167. robert/gui_easyrob/web/checkml_brand.png +0 -0
  168. robert/gui_easyrob/web/easyrob_background.gif +0 -0
  169. robert/gui_easyrob/web/easyrob_background.png +0 -0
  170. robert/gui_easyrob/web/images.css +89 -0
  171. robert/gui_easyrob/web/images.html +39 -0
  172. robert/gui_easyrob/web/images.js +101 -0
  173. robert/gui_easyrob/web/results.js +499 -0
  174. robert/gui_easyrob/web/robert_brand.png +0 -0
  175. robert/gui_easyrob/web_dialogs.py +64 -0
  176. robert/gui_easyrob/web_results.py +253 -0
  177. robert/gui_easyrob/web_shell.py +684 -0
  178. robert/gui_easyrob/workflow_progress.py +89 -0
  179. robert/gui_easyrob/workflow_run_lock.py +27 -0
  180. robert/icons/CheckML_icon.png +0 -0
  181. robert/icons/Robert_icon.png +0 -0
  182. robert/icons/Robert_logo.jpg +0 -0
  183. robert/icons/Robert_logo_transparent.png +0 -0
  184. robert/icons/documentation_icon.png +0 -0
  185. robert/icons/info_icon.png +0 -0
  186. robert/icons/pdf_icon.png +0 -0
  187. robert/icons/play_icon.png +0 -0
  188. robert/icons/stop_icon.png +0 -0
  189. robert/icons/youtube_icon.ico +0 -0
  190. robert/predict.py +193 -0
  191. robert/predict_utils.py +410 -0
  192. robert/report/CheckML_logo.jpg +0 -0
  193. robert/report/GENERATE.png +0 -0
  194. robert/report/Robert_icon.ico +0 -0
  195. robert/report/Robert_logo.jpg +0 -0
  196. robert/report/Robert_logo1.jpg +0 -0
  197. robert/report/abbrev.png +0 -0
  198. robert/report/adv_anal.png +0 -0
  199. robert/report/checkml_pass.svg +3 -0
  200. robert/report/checkml_unclear.svg +3 -0
  201. robert/report/checkml_warning.svg +3 -0
  202. robert/report/features.png +0 -0
  203. robert/report/outliers.png +0 -0
  204. robert/report/pred.png +0 -0
  205. robert/report/repro.png +0 -0
  206. robert/report/robust_x.png +0 -0
  207. robert/report/robust_y_high.png +0 -0
  208. robert/report/robust_y_low.png +0 -0
  209. robert/report/score.png +0 -0
  210. robert/report/score_0.jpg +0 -0
  211. robert/report/score_1.jpg +0 -0
  212. robert/report/score_10.jpg +0 -0
  213. robert/report/score_2.jpg +0 -0
  214. robert/report/score_3.jpg +0 -0
  215. robert/report/score_4.jpg +0 -0
  216. robert/report/score_5.jpg +0 -0
  217. robert/report/score_6.jpg +0 -0
  218. robert/report/score_7.jpg +0 -0
  219. robert/report/score_8.jpg +0 -0
  220. robert/report/score_9.jpg +0 -0
  221. robert/report/score_gray_0.jpg +0 -0
  222. robert/report/score_gray_1.jpg +0 -0
  223. robert/report/score_gray_10.jpg +0 -0
  224. robert/report/score_gray_2.jpg +0 -0
  225. robert/report/score_gray_3.jpg +0 -0
  226. robert/report/score_gray_4.jpg +0 -0
  227. robert/report/score_gray_5.jpg +0 -0
  228. robert/report/score_gray_6.jpg +0 -0
  229. robert/report/score_gray_7.jpg +0 -0
  230. robert/report/score_gray_8.jpg +0 -0
  231. robert/report/score_gray_9.jpg +0 -0
  232. robert/report/score_w_1_0.jpg +0 -0
  233. robert/report/score_w_1_1.jpg +0 -0
  234. robert/report/score_w_2_0.jpg +0 -0
  235. robert/report/score_w_2_1.jpg +0 -0
  236. robert/report/score_w_2_2.jpg +0 -0
  237. robert/report/score_w_2_gray_0.jpg +0 -0
  238. robert/report/score_w_2_gray_1.jpg +0 -0
  239. robert/report/score_w_2_gray_2.jpg +0 -0
  240. robert/report/score_w_3_0.jpg +0 -0
  241. robert/report/score_w_3_1.jpg +0 -0
  242. robert/report/score_w_3_2.jpg +0 -0
  243. robert/report/score_w_3_3.jpg +0 -0
  244. robert/report/score_w_4_0.jpg +0 -0
  245. robert/report/score_w_4_1.JPG +0 -0
  246. robert/report/score_w_4_2.jpg +0 -0
  247. robert/report/score_w_4_3.jpg +0 -0
  248. robert/report/score_w_4_4.jpg +0 -0
  249. robert/report/transpa.png +0 -0
  250. robert/report/y_distrib.png +0 -0
  251. robert/report.py +2880 -0
  252. robert/report_utils.py +2270 -0
  253. robert/robert.py +181 -0
  254. robert/utils.py +4763 -0
  255. robert/verify.py +606 -0
  256. robert-2.2.0.dist-info/METADATA +55 -0
  257. robert-2.2.0.dist-info/RECORD +261 -0
  258. robert-2.2.0.dist-info/WHEEL +5 -0
  259. robert-2.2.0.dist-info/entry_points.txt +3 -0
  260. robert-2.2.0.dist-info/licenses/LICENSE +21 -0
  261. robert-2.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,14 @@
1
+ """Pure navigation policy for the consolidated results workspace."""
2
+
3
+
4
+ RESULT_VIEW_ORDER = ("Report", "Predictions", "Images", "Interactive plots")
5
+
6
+
7
+ def choose_available_result_view(availability, current_view, has_selection):
8
+ """Keep a selected available view, or choose the first available view."""
9
+ if has_selection and availability.get(current_view, False):
10
+ return current_view
11
+ return next(
12
+ (view for view in RESULT_VIEW_ORDER if availability.get(view, False)),
13
+ None,
14
+ )
@@ -0,0 +1,23 @@
1
+ """Public tab components used by the easyROB main window.
2
+
3
+ The package re-exports each tab widget so the main window can assemble the
4
+ interface from a small, stable import surface.
5
+ """
6
+
7
+ from .predictions import PredictionsTab
8
+ from .aqme import AQMETab
9
+ from .advanced_options import AdvancedOptionsTab
10
+ from .molssi import MolSSIDatabasesTab
11
+ from .results import ResultsTab
12
+ from .results_workspace import ResultsWorkspace
13
+ from .images import ImagesTab
14
+
15
+ __all__ = [
16
+ "PredictionsTab",
17
+ "AQMETab",
18
+ "AdvancedOptionsTab",
19
+ "MolSSIDatabasesTab",
20
+ "ResultsTab",
21
+ "ResultsWorkspace",
22
+ "ImagesTab",
23
+ ]
@@ -0,0 +1,370 @@
1
+ """
2
+ Advanced options tab for easyROB.
3
+
4
+ This module implements a form-based interface that allows users to configure
5
+ advanced parameters for different stages of the ROBERT workflow.
6
+
7
+ Each section (GENERAL, CURATE, GENERATE, PREDICT) maps directly to a stage
8
+ in the pipeline, enabling structured configuration without overloading the
9
+ main application window.
10
+
11
+ Import strategy:
12
+ - Supports dual execution modes:
13
+ 1. Local (portable execution from source folder)
14
+ 2. Installed package (environment / entry point)
15
+
16
+ - Imports use a try/except fallback:
17
+ local modules are attempted first, with package imports as fallback.
18
+
19
+ Notes:
20
+ - This module focuses purely on UI configuration.
21
+ - No execution logic or background processing is handled here.
22
+
23
+ """
24
+
25
+ # ------------------------------------------------------------
26
+ # Import resolution (local vs installed package)
27
+ # ------------------------------------------------------------
28
+ # Attempt local imports first (portable mode). If they fail,
29
+ # fall back to installed package imports.
30
+ try:
31
+
32
+ from utils.utils_gui import (
33
+ AssetLibrary,
34
+ QCheckBox,
35
+ QComboBox,
36
+ QDesktopServices,
37
+ QFormLayout,
38
+ QGridLayout,
39
+ QGroupBox,
40
+ QIcon,
41
+ QLabel,
42
+ QLineEdit,
43
+ QMessageBox,
44
+ QPushButton,
45
+ QUrl,
46
+ QVBoxLayout,
47
+ QWidget,
48
+ Qt,
49
+ )
50
+
51
+ except ImportError as e:
52
+
53
+ from robert.gui_easyrob.utils.utils_gui import (
54
+ AssetLibrary,
55
+ QCheckBox,
56
+ QComboBox,
57
+ QDesktopServices,
58
+ QFormLayout,
59
+ QGridLayout,
60
+ QGroupBox,
61
+ QIcon,
62
+ QLabel,
63
+ QLineEdit,
64
+ QMessageBox,
65
+ QPushButton,
66
+ QUrl,
67
+ QVBoxLayout,
68
+ QWidget,
69
+ Qt,
70
+ )
71
+
72
+ class AdvancedOptionsTab(QWidget):
73
+ """Tab for advanced options in the easyROB application."""
74
+ def __init__(self, type_dropdown, tab_widget):
75
+ super().__init__()
76
+ self.type = type_dropdown
77
+ self.tab_widget = tab_widget # Reference to the main QTabWidget
78
+ main_layout = QVBoxLayout(self)
79
+ grid_layout = QGridLayout()
80
+ self.box_features = "QGroupBox { font-weight: bold; }"
81
+
82
+ # Create section boxes
83
+ general_box = self.create_general_section()
84
+ curate_box = self.create_curate_section()
85
+ generate_box = self.create_generate_section()
86
+ predict_box = self.create_predict_section()
87
+
88
+ # GENERAL (Top Row)
89
+ grid_layout.addWidget(general_box, 0, 0, 1, 2)
90
+
91
+ # CURATE / GENERATE (Middle Row)
92
+ grid_layout.addWidget(curate_box, 1, 0, 1, 1)
93
+ grid_layout.addWidget(generate_box, 1, 1, 1, 1)
94
+
95
+ # PREDICT (Bottom Row, Full Width)
96
+ grid_layout.addWidget(predict_box, 2, 0, 1, 2)
97
+
98
+
99
+ # Add the grid layout to the main layout
100
+ main_layout.addLayout(grid_layout)
101
+ self.setLayout(main_layout)
102
+
103
+ def go_to_help_section(self, anchor):
104
+ """Open a documentation section in the browser."""
105
+
106
+ base_url = "https://robert.readthedocs.io/en/latest/Technical/defaults.html"
107
+
108
+ if anchor.upper() == "GENERAL":
109
+ full_url = base_url
110
+ else:
111
+ full_url = f"{base_url}#{anchor.lower()}"
112
+
113
+ QDesktopServices.openUrl(QUrl(full_url))
114
+
115
+ def create_help_button(self, topic: str) -> QPushButton:
116
+ """Return a styled Help button linking to documentation."""
117
+
118
+ button = QPushButton(f"Help {topic.upper()} parameters")
119
+
120
+ with AssetLibrary.Info_icon.get_path() as icon_path:
121
+ button.setIcon(QIcon(str(icon_path)))
122
+
123
+ button.setCursor(Qt.PointingHandCursor)
124
+ button.setStyleSheet("padding: 4px; font-weight: bold;")
125
+
126
+ button.clicked.connect(lambda: self.go_to_help_section(topic))
127
+
128
+ return button
129
+
130
+ def create_general_section(self):
131
+ """Creates the GENERAL section box."""
132
+ box = QGroupBox("GENERAL")
133
+ box.setStyleSheet(self.box_features)
134
+
135
+ layout = QFormLayout()
136
+
137
+ self.auto_type = QCheckBox()
138
+ self.auto_type.setChecked(True)
139
+ layout.addRow(QLabel("auto_type:"), self.auto_type)
140
+
141
+ self.seed = QLineEdit()
142
+ self.seed.setPlaceholderText("0")
143
+ layout.addRow(QLabel("seed:"), self.seed)
144
+
145
+ self.kfold = QLineEdit()
146
+ self.kfold.setPlaceholderText("5")
147
+ layout.addRow(QLabel("kfold:"), self.kfold)
148
+
149
+ self.repeat_kfolds = QLineEdit()
150
+ self.repeat_kfolds.setPlaceholderText("10")
151
+ layout.addRow(QLabel("repeat_kfolds:"), self.repeat_kfolds)
152
+
153
+ self.split = QComboBox()
154
+ self.split.addItems([ "even", "RND", "stratified", "KN", "extra_q1", "extra_q5" ])
155
+ layout.addRow(QLabel("split:"), self.split)
156
+
157
+ # --- Help button at the bottom ---
158
+ help_button = self.create_help_button("GENERAL")
159
+
160
+ # Add with right alignment
161
+ layout.addRow("", help_button) # Adds it as a new row with empty label
162
+ layout.setAlignment(help_button, Qt.AlignRight)
163
+
164
+ box.setLayout(layout)
165
+ return box
166
+
167
+ def create_curate_section(self):
168
+ """Creates the CURATE section with a box and input fields."""
169
+ box = QGroupBox("CURATE")
170
+ box.setStyleSheet(self.box_features)
171
+ layout = QFormLayout()
172
+
173
+ # Add new input fields for additional options
174
+ self.categoricalstr = QComboBox()
175
+ self.categoricalstr.addItems(["onehot", "numbers"])
176
+ layout.addRow(QLabel("categorical:"), self.categoricalstr)
177
+
178
+ self.corr_filter_xbool = QCheckBox()
179
+ self.corr_filter_xbool.setChecked(True)
180
+ layout.addRow(QLabel("corr_filter_x:"), self.corr_filter_xbool)
181
+
182
+ self.corr_filter_ybool = QCheckBox()
183
+ self.corr_filter_ybool.setChecked(False)
184
+ layout.addRow(QLabel("corr_filter_y:"), self.corr_filter_ybool)
185
+
186
+ self.rfecv_filterbool = QCheckBox()
187
+ self.rfecv_filterbool.setChecked(True)
188
+ layout.addRow(QLabel("rfecv_filter:"), self.rfecv_filterbool)
189
+
190
+ self.thres_xfloat = QLineEdit()
191
+ self.thres_xfloat.setPlaceholderText("0.7")
192
+ layout.addRow(QLabel("thres_x:"), self.thres_xfloat)
193
+
194
+ self.thres_yfloat = QLineEdit()
195
+ self.thres_yfloat.setPlaceholderText("0.001")
196
+ layout.addRow(QLabel("thres_y:"), self.thres_yfloat)
197
+
198
+ # --- Help button at the bottom ---
199
+ help_button = self.create_help_button("CURATE")
200
+
201
+ # Add with right alignment
202
+ layout.addRow("", help_button) # Adds it as a new row with empty label
203
+ layout.setAlignment(help_button, Qt.AlignRight)
204
+
205
+ box.setLayout(layout)
206
+ return box
207
+
208
+ def create_generate_section(self):
209
+ """Creates the GENERATE section with a box and input fields."""
210
+ box = QGroupBox("GENERATE")
211
+ box.setStyleSheet(self.box_features)
212
+ layout = QFormLayout()
213
+
214
+ self.model_group = QGroupBox("Models")
215
+ self.model_layout = QGridLayout() # Grid layout for better spacing
216
+ self.modellist = {}
217
+ self.model_group.setLayout(self.model_layout)
218
+ layout.addRow(self.model_group)
219
+
220
+ # models restricted to a single prediction type - RF/GB/NN/GP/AdaB have both a
221
+ # regressor and a classifier version under the same short code, so they aren't listed
222
+ # here (valid for either type)
223
+ model_type_restriction = {
224
+ "MVL": "Regression",
225
+ "Ridge": "Regression",
226
+ "Logistic": "Classification",
227
+ }
228
+
229
+ def update_model_options():
230
+ """Updates the model options based on the selected type."""
231
+
232
+ # Determine which models should be checked by default
233
+ if self.type.currentText() == "Regression":
234
+ default_checked_models = ["RF", "GB", "NN", "MVL"] # Regression defaults
235
+ else:
236
+ # Classification defaults: Logistic is the linear counterpart of MVL
237
+ default_checked_models = ["RF", "GB", "NN", "Logistic"]
238
+
239
+ # Update check states instead of recreating widgets
240
+ for model, checkbox in self.modellist.items():
241
+ checkbox.setChecked(model in default_checked_models)
242
+
243
+ def on_model_checkbox_toggled(model, checked):
244
+ """Warns and immediately unchecks a model that isn't valid for the current type -
245
+ same restriction sanity_checks() already enforces for the CLI (--model/--type), just
246
+ caught here before a run is even launched instead of failing partway through."""
247
+
248
+ if not checked:
249
+ return
250
+ required_type = model_type_restriction.get(model)
251
+ if required_type is not None and self.type.currentText() != required_type:
252
+ self.modellist[model].blockSignals(True)
253
+ self.modellist[model].setChecked(False)
254
+ self.modellist[model].blockSignals(False)
255
+ QMessageBox.warning(
256
+ self, "Incompatible model",
257
+ f"'{model}' is only valid for {required_type.lower()}, not "
258
+ f"{self.type.currentText().lower()}. It has been deselected."
259
+ )
260
+
261
+ # Create checkboxes (only once) - Ridge isn't checked by default, but is available to
262
+ # opt into; Logistic is a classification default (see update_model_options())
263
+ all_models = ["RF", "MVL", "GB", "NN", "GP", "AdaB", "Ridge", "Logistic"]
264
+ row, col = 0, 0
265
+ for model in all_models:
266
+ checkbox = QCheckBox(model)
267
+ checkbox.toggled.connect(lambda checked, m=model: on_model_checkbox_toggled(m, checked))
268
+ self.modellist[model] = checkbox
269
+ self.model_layout.addWidget(checkbox, row, col)
270
+
271
+ col += 1 # Move to the next column
272
+ if col > 1: # Two columns max
273
+ col = 0
274
+ row += 1
275
+
276
+ # Connect signal to update check states when type changes
277
+ self.type.currentIndexChanged.connect(update_model_options)
278
+ update_model_options() # Initialize with correct models
279
+
280
+ # all_models (whether every selected model above gets its own full PDF, instead of
281
+ # just the best one) lives on the main screen, next to the workflow selector - it's an
282
+ # impactful choice (run time), not an advanced detail - see window.py's all_models_toggle
283
+
284
+ # Error type selection that changes dynamically but is also user-selectable
285
+ self.error_type = QComboBox()
286
+ layout.addRow(QLabel("error_type:"), self.error_type)
287
+
288
+ def update_error_type():
289
+ self.error_type.clear()
290
+ if self.type.currentText() == "Regression":
291
+ self.error_type.addItems(["rmse", "mae", "r2"])
292
+ else:
293
+ self.error_type.addItems(["mcc", "f1", "acc"])
294
+
295
+ self.type.currentIndexChanged.connect(update_error_type)
296
+ update_error_type() # Initialize with the correct default values
297
+
298
+ self.init_points = QLineEdit()
299
+ self.init_points.setPlaceholderText("10")
300
+ layout.addRow(QLabel("init_points:"), self.init_points)
301
+
302
+ self.n_iter = QLineEdit()
303
+ self.n_iter.setPlaceholderText("10")
304
+ layout.addRow(QLabel("n_iter:"), self.n_iter)
305
+
306
+ self.expect_improv = QLineEdit()
307
+ self.expect_improv.setPlaceholderText("0.05")
308
+ layout.addRow(QLabel("expect_improv:"), self.expect_improv)
309
+
310
+ self.pfi_filter = QCheckBox()
311
+ self.pfi_filter.setChecked(True)
312
+ layout.addRow(QLabel("pfi_filter:"), self.pfi_filter)
313
+
314
+ self.pfi_epochs = QLineEdit()
315
+ self.pfi_epochs.setPlaceholderText("5")
316
+ layout.addRow(QLabel("pfi_epochs:"), self.pfi_epochs)
317
+
318
+ self.pfi_threshold = QLineEdit()
319
+ self.pfi_threshold.setPlaceholderText("0.2")
320
+ layout.addRow(QLabel("pfi_threshold:"), self.pfi_threshold)
321
+
322
+ self.pfi_max = QLineEdit()
323
+ self.pfi_max.setPlaceholderText("0")
324
+ layout.addRow(QLabel("pfi_max:"), self.pfi_max)
325
+
326
+ self.auto_test = QCheckBox()
327
+ self.auto_test.setChecked(True)
328
+ layout.addRow(QLabel("auto_test:"), self.auto_test)
329
+
330
+ self.test_set = QLineEdit()
331
+ self.test_set.setPlaceholderText("0.1")
332
+ layout.addRow(QLabel("test_set:"), self.test_set)
333
+
334
+ # --- Help button at the bottom ---
335
+ help_button = self.create_help_button("GENERATE")
336
+
337
+ # Add with right alignment
338
+ layout.addRow("", help_button) # Adds it as a new row with empty label
339
+ layout.setAlignment(help_button, Qt.AlignRight)
340
+
341
+ box.setLayout(layout)
342
+ return box
343
+
344
+ def create_predict_section(self):
345
+ """Creates the PREDICT section with a box and input fields."""
346
+ box = QGroupBox("PREDICT")
347
+ box.setStyleSheet(self.box_features)
348
+ layout = QFormLayout()
349
+
350
+ self.t_value = QLineEdit()
351
+ self.t_value.setPlaceholderText("2")
352
+ layout.addRow(QLabel("t_value:"), self.t_value)
353
+
354
+ self.shap_show = QLineEdit()
355
+ self.shap_show.setPlaceholderText("10")
356
+ layout.addRow(QLabel("shap_show:"), self.shap_show)
357
+
358
+ self.pfi_show = QLineEdit()
359
+ self.pfi_show.setPlaceholderText("10")
360
+ layout.addRow(QLabel("pfi_show:"), self.pfi_show)
361
+
362
+ # --- Help button at the bottom ---
363
+ help_button = self.create_help_button("PREDICT")
364
+
365
+ # Add with right alignment
366
+ layout.addRow("", help_button) # Adds it as a new row with empty label
367
+ layout.setAlignment(help_button, Qt.AlignRight)
368
+
369
+ box.setLayout(layout)
370
+ return box