dslighting 1.7.1__py3-none-any.whl → 1.7.6__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 (352) hide show
  1. dslighting/__init__.py +1 -1
  2. dslighting/core/agent.py +78 -62
  3. {dslighting-1.7.1.dist-info → dslighting-1.7.6.dist-info}/METADATA +1 -1
  4. {dslighting-1.7.1.dist-info → dslighting-1.7.6.dist-info}/RECORD +352 -7
  5. {dslighting-1.7.1.dist-info → dslighting-1.7.6.dist-info}/top_level.txt +1 -0
  6. mlebench/README.md +39 -0
  7. mlebench/__init__.py +0 -0
  8. mlebench/cli.py +221 -0
  9. mlebench/competitions/3d-object-detection-for-autonomous-vehicles/grade.py +161 -0
  10. mlebench/competitions/3d-object-detection-for-autonomous-vehicles/mAP_evaluation.py +425 -0
  11. mlebench/competitions/3d-object-detection-for-autonomous-vehicles/prepare.py +483 -0
  12. mlebench/competitions/3d-object-detection-for-autonomous-vehicles/prepare_val.py +719 -0
  13. mlebench/competitions/AI4Code/grade.py +70 -0
  14. mlebench/competitions/AI4Code/prepare.py +84 -0
  15. mlebench/competitions/AI4Code/prepare_val.py +159 -0
  16. mlebench/competitions/__init__.py +0 -0
  17. mlebench/competitions/aerial-cactus-identification/grade.py +11 -0
  18. mlebench/competitions/aerial-cactus-identification/prepare.py +71 -0
  19. mlebench/competitions/aerial-cactus-identification/prepare_val.py +133 -0
  20. mlebench/competitions/alaska2-image-steganalysis/grade.py +136 -0
  21. mlebench/competitions/alaska2-image-steganalysis/prepare.py +88 -0
  22. mlebench/competitions/alaska2-image-steganalysis/prepare_val.py +148 -0
  23. mlebench/competitions/aptos2019-blindness-detection/grade.py +35 -0
  24. mlebench/competitions/aptos2019-blindness-detection/prepare.py +75 -0
  25. mlebench/competitions/aptos2019-blindness-detection/prepare_val.py +123 -0
  26. mlebench/competitions/bike-sharing-demand/__init__.py +0 -0
  27. mlebench/competitions/bike-sharing-demand/grade.py +55 -0
  28. mlebench/competitions/bike-sharing-demand/prepare.py +37 -0
  29. mlebench/competitions/billion-word-imputation/grade.py +37 -0
  30. mlebench/competitions/billion-word-imputation/prepare.py +107 -0
  31. mlebench/competitions/billion-word-imputation/prepare_val.py +179 -0
  32. mlebench/competitions/bms-molecular-translation/grade.py +40 -0
  33. mlebench/competitions/bms-molecular-translation/prepare.py +68 -0
  34. mlebench/competitions/bms-molecular-translation/prepare_val.py +131 -0
  35. mlebench/competitions/cassava-leaf-disease-classification/grade.py +12 -0
  36. mlebench/competitions/cassava-leaf-disease-classification/prepare.py +113 -0
  37. mlebench/competitions/cassava-leaf-disease-classification/prepare_val.py +186 -0
  38. mlebench/competitions/cdiscount-image-classification-challenge/grade.py +11 -0
  39. mlebench/competitions/cdiscount-image-classification-challenge/prepare.py +144 -0
  40. mlebench/competitions/cdiscount-image-classification-challenge/prepare_val.py +205 -0
  41. mlebench/competitions/chaii-hindi-and-tamil-question-answering/grade.py +67 -0
  42. mlebench/competitions/chaii-hindi-and-tamil-question-answering/prepare.py +31 -0
  43. mlebench/competitions/chaii-hindi-and-tamil-question-answering/prepare_val.py +94 -0
  44. mlebench/competitions/champs-scalar-coupling/grade.py +60 -0
  45. mlebench/competitions/champs-scalar-coupling/prepare.py +116 -0
  46. mlebench/competitions/champs-scalar-coupling/prepare_val.py +155 -0
  47. mlebench/competitions/conways-reverse-game-of-life-2020/__init__.py +0 -0
  48. mlebench/competitions/conways-reverse-game-of-life-2020/grade.py +40 -0
  49. mlebench/competitions/conways-reverse-game-of-life-2020/prepare.py +41 -0
  50. mlebench/competitions/demand-forecasting-kernels-only/__init__.py +0 -0
  51. mlebench/competitions/demand-forecasting-kernels-only/grade.py +66 -0
  52. mlebench/competitions/demand-forecasting-kernels-only/prepare.py +27 -0
  53. mlebench/competitions/demand_forecasting_kernels_only/__init__.py +0 -0
  54. mlebench/competitions/demand_forecasting_kernels_only/grade.py +66 -0
  55. mlebench/competitions/demand_forecasting_kernels_only/prepare.py +27 -0
  56. mlebench/competitions/denoising-dirty-documents/grade.py +44 -0
  57. mlebench/competitions/denoising-dirty-documents/prepare.py +134 -0
  58. mlebench/competitions/denoising-dirty-documents/prepare_val.py +178 -0
  59. mlebench/competitions/detecting-insults-in-social-commentary/grade.py +11 -0
  60. mlebench/competitions/detecting-insults-in-social-commentary/prepare.py +72 -0
  61. mlebench/competitions/detecting-insults-in-social-commentary/prepare_val.py +128 -0
  62. mlebench/competitions/dog-breed-identification/dogs.py +124 -0
  63. mlebench/competitions/dog-breed-identification/grade.py +42 -0
  64. mlebench/competitions/dog-breed-identification/prepare.py +55 -0
  65. mlebench/competitions/dog-breed-identification/prepare_val.py +104 -0
  66. mlebench/competitions/dogs-vs-cats-redux-kernels-edition/grade.py +43 -0
  67. mlebench/competitions/dogs-vs-cats-redux-kernels-edition/prepare.py +70 -0
  68. mlebench/competitions/dogs-vs-cats-redux-kernels-edition/prepare_val.py +143 -0
  69. mlebench/competitions/ethanol-concentration/grade.py +23 -0
  70. mlebench/competitions/ethanol-concentration/prepare.py +90 -0
  71. mlebench/competitions/facebook-recruiting-iii-keyword-extraction/grade.py +60 -0
  72. mlebench/competitions/facebook-recruiting-iii-keyword-extraction/prepare.py +41 -0
  73. mlebench/competitions/facebook-recruiting-iii-keyword-extraction/prepare_val.py +92 -0
  74. mlebench/competitions/feedback-prize-english-language-learning/__init__.py +0 -0
  75. mlebench/competitions/feedback-prize-english-language-learning/grade.py +60 -0
  76. mlebench/competitions/feedback-prize-english-language-learning/prepare.py +39 -0
  77. mlebench/competitions/freesound-audio-tagging-2019/grade.py +64 -0
  78. mlebench/competitions/freesound-audio-tagging-2019/prepare.py +94 -0
  79. mlebench/competitions/freesound-audio-tagging-2019/prepare_val.py +175 -0
  80. mlebench/competitions/freesound-audio-tagging-2019/vocabulary.py +83 -0
  81. mlebench/competitions/google-quest-challenge/classes.py +32 -0
  82. mlebench/competitions/google-quest-challenge/grade.py +45 -0
  83. mlebench/competitions/google-quest-challenge/prepare.py +58 -0
  84. mlebench/competitions/google-quest-challenge/prepare_val.py +120 -0
  85. mlebench/competitions/google-research-identify-contrails-reduce-global-warming/grade.py +77 -0
  86. mlebench/competitions/google-research-identify-contrails-reduce-global-warming/prepare.py +155 -0
  87. mlebench/competitions/google-research-identify-contrails-reduce-global-warming/prepare_val.py +211 -0
  88. mlebench/competitions/h-and-m-personalized-fashion-recommendations/grade.py +42 -0
  89. mlebench/competitions/h-and-m-personalized-fashion-recommendations/prepare.py +102 -0
  90. mlebench/competitions/h-and-m-personalized-fashion-recommendations/prepare_val.py +132 -0
  91. mlebench/competitions/handwriting/grade.py +23 -0
  92. mlebench/competitions/handwriting/prepare.py +179 -0
  93. mlebench/competitions/herbarium-2020-fgvc7/grade.py +34 -0
  94. mlebench/competitions/herbarium-2020-fgvc7/prepare.py +251 -0
  95. mlebench/competitions/herbarium-2020-fgvc7/prepare_val.py +242 -0
  96. mlebench/competitions/herbarium-2021-fgvc8/grade.py +34 -0
  97. mlebench/competitions/herbarium-2021-fgvc8/prepare.py +251 -0
  98. mlebench/competitions/herbarium-2021-fgvc8/prepare_val.py +222 -0
  99. mlebench/competitions/herbarium-2022-fgvc9/grade.py +31 -0
  100. mlebench/competitions/herbarium-2022-fgvc9/prepare.py +233 -0
  101. mlebench/competitions/herbarium-2022-fgvc9/prepare_val.py +213 -0
  102. mlebench/competitions/histopathologic-cancer-detection/grade.py +12 -0
  103. mlebench/competitions/histopathologic-cancer-detection/prepare.py +59 -0
  104. mlebench/competitions/histopathologic-cancer-detection/prepare_val.py +131 -0
  105. mlebench/competitions/hms-harmful-brain-activity-classification/constants.py +9 -0
  106. mlebench/competitions/hms-harmful-brain-activity-classification/grade.py +43 -0
  107. mlebench/competitions/hms-harmful-brain-activity-classification/kaggle_metric_utilities.py +96 -0
  108. mlebench/competitions/hms-harmful-brain-activity-classification/kullback_leibler_divergence.py +118 -0
  109. mlebench/competitions/hms-harmful-brain-activity-classification/prepare.py +121 -0
  110. mlebench/competitions/hms-harmful-brain-activity-classification/prepare_val.py +190 -0
  111. mlebench/competitions/hotel-id-2021-fgvc8/grade.py +41 -0
  112. mlebench/competitions/hotel-id-2021-fgvc8/prepare.py +63 -0
  113. mlebench/competitions/hotel-id-2021-fgvc8/prepare_val.py +132 -0
  114. mlebench/competitions/hubmap-kidney-segmentation/grade.py +62 -0
  115. mlebench/competitions/hubmap-kidney-segmentation/prepare.py +108 -0
  116. mlebench/competitions/hubmap-kidney-segmentation/prepare_val.py +153 -0
  117. mlebench/competitions/icecube-neutrinos-in-deep-ice/grade.py +111 -0
  118. mlebench/competitions/icecube-neutrinos-in-deep-ice/prepare.py +127 -0
  119. mlebench/competitions/icecube-neutrinos-in-deep-ice/prepare_val.py +183 -0
  120. mlebench/competitions/ili/grade.py +60 -0
  121. mlebench/competitions/ili/prepare.py +99 -0
  122. mlebench/competitions/imet-2020-fgvc7/grade.py +54 -0
  123. mlebench/competitions/imet-2020-fgvc7/prepare.py +77 -0
  124. mlebench/competitions/imet-2020-fgvc7/prepare_val.py +157 -0
  125. mlebench/competitions/inaturalist-2019-fgvc6/grade.py +35 -0
  126. mlebench/competitions/inaturalist-2019-fgvc6/prepare.py +259 -0
  127. mlebench/competitions/inaturalist-2019-fgvc6/prepare_val.py +304 -0
  128. mlebench/competitions/instant-gratification/__init__.py +0 -0
  129. mlebench/competitions/instant-gratification/grade.py +55 -0
  130. mlebench/competitions/instant-gratification/prepare.py +25 -0
  131. mlebench/competitions/instant_gratification/__init__.py +0 -0
  132. mlebench/competitions/instant_gratification/grade.py +55 -0
  133. mlebench/competitions/instant_gratification/prepare.py +25 -0
  134. mlebench/competitions/invasive-species-monitoring/grade.py +11 -0
  135. mlebench/competitions/invasive-species-monitoring/prepare.py +97 -0
  136. mlebench/competitions/invasive-species-monitoring/prepare_val.py +164 -0
  137. mlebench/competitions/iwildcam-2019-fgvc6/grade.py +44 -0
  138. mlebench/competitions/iwildcam-2019-fgvc6/prepare.py +118 -0
  139. mlebench/competitions/iwildcam-2019-fgvc6/prepare_val.py +194 -0
  140. mlebench/competitions/iwildcam-2020-fgvc7/grade.py +11 -0
  141. mlebench/competitions/iwildcam-2020-fgvc7/prepare.py +164 -0
  142. mlebench/competitions/iwildcam-2020-fgvc7/prepare_val.py +245 -0
  143. mlebench/competitions/jigsaw-toxic-comment-classification-challenge/classes.py +1 -0
  144. mlebench/competitions/jigsaw-toxic-comment-classification-challenge/grade.py +54 -0
  145. mlebench/competitions/jigsaw-toxic-comment-classification-challenge/prepare.py +42 -0
  146. mlebench/competitions/jigsaw-toxic-comment-classification-challenge/prepare_val.py +88 -0
  147. mlebench/competitions/jigsaw-unintended-bias-in-toxicity-classification/grade.py +153 -0
  148. mlebench/competitions/jigsaw-unintended-bias-in-toxicity-classification/prepare.py +36 -0
  149. mlebench/competitions/jigsaw-unintended-bias-in-toxicity-classification/prepare_val.py +117 -0
  150. mlebench/competitions/kuzushiji-recognition/grade.py +58 -0
  151. mlebench/competitions/kuzushiji-recognition/kuzushiji_metric.py +118 -0
  152. mlebench/competitions/kuzushiji-recognition/prepare.py +92 -0
  153. mlebench/competitions/kuzushiji-recognition/prepare_val.py +149 -0
  154. mlebench/competitions/leaf-classification/classes.py +101 -0
  155. mlebench/competitions/leaf-classification/grade.py +44 -0
  156. mlebench/competitions/leaf-classification/prepare.py +60 -0
  157. mlebench/competitions/leaf-classification/prepare_val.py +116 -0
  158. mlebench/competitions/learning-agency-lab-automated-essay-scoring-2/grade.py +44 -0
  159. mlebench/competitions/learning-agency-lab-automated-essay-scoring-2/prepare.py +51 -0
  160. mlebench/competitions/learning-agency-lab-automated-essay-scoring-2/prepare_val.py +96 -0
  161. mlebench/competitions/liverpool-ion-switching/__init__.py +0 -0
  162. mlebench/competitions/liverpool-ion-switching/grade.py +52 -0
  163. mlebench/competitions/liverpool-ion-switching/prepare.py +27 -0
  164. mlebench/competitions/liverpool_ion_switching/__init__.py +0 -0
  165. mlebench/competitions/liverpool_ion_switching/grade.py +52 -0
  166. mlebench/competitions/liverpool_ion_switching/prepare.py +27 -0
  167. mlebench/competitions/lmsys-chatbot-arena/grade.py +63 -0
  168. mlebench/competitions/lmsys-chatbot-arena/prepare.py +52 -0
  169. mlebench/competitions/lmsys-chatbot-arena/prepare_val.py +115 -0
  170. mlebench/competitions/mcm_2024_c_test/grade.py +107 -0
  171. mlebench/competitions/mcm_2024_c_test/prepare.py +2 -0
  172. mlebench/competitions/ml2021spring-hw2/grade.py +11 -0
  173. mlebench/competitions/ml2021spring-hw2/prepare.py +58 -0
  174. mlebench/competitions/ml2021spring-hw2/prepare_val.py +135 -0
  175. mlebench/competitions/mlsp-2013-birds/grade.py +11 -0
  176. mlebench/competitions/mlsp-2013-birds/prepare.py +182 -0
  177. mlebench/competitions/mlsp-2013-birds/prepare_val.py +241 -0
  178. mlebench/competitions/movie-review-sentiment-analysis-kernels-only/grade.py +11 -0
  179. mlebench/competitions/movie-review-sentiment-analysis-kernels-only/prepare.py +58 -0
  180. mlebench/competitions/movie-review-sentiment-analysis-kernels-only/prepare_val.py +120 -0
  181. mlebench/competitions/multi-modal-gesture-recognition/grade.py +58 -0
  182. mlebench/competitions/multi-modal-gesture-recognition/prepare.py +85 -0
  183. mlebench/competitions/multi-modal-gesture-recognition/prepare_val.py +139 -0
  184. mlebench/competitions/my-custom-task-01/prepare.py +2 -0
  185. mlebench/competitions/new-my-task-01/prepare.py +2 -0
  186. mlebench/competitions/new-my-task-03/grade.py +107 -0
  187. mlebench/competitions/new-my-task-03/prepare.py +2 -0
  188. mlebench/competitions/new-york-city-taxi-fare-prediction/grade.py +28 -0
  189. mlebench/competitions/new-york-city-taxi-fare-prediction/prepare.py +44 -0
  190. mlebench/competitions/new-york-city-taxi-fare-prediction/prepare_val.py +89 -0
  191. mlebench/competitions/nfl-player-contact-detection/grade.py +36 -0
  192. mlebench/competitions/nfl-player-contact-detection/prepare.py +101 -0
  193. mlebench/competitions/nfl-player-contact-detection/prepare_val.py +186 -0
  194. mlebench/competitions/nomad2018-predict-transparent-conductors/grade.py +47 -0
  195. mlebench/competitions/nomad2018-predict-transparent-conductors/prepare.py +77 -0
  196. mlebench/competitions/nomad2018-predict-transparent-conductors/prepare_val.py +144 -0
  197. mlebench/competitions/osic-pulmonary-fibrosis-progression/grade.py +74 -0
  198. mlebench/competitions/osic-pulmonary-fibrosis-progression/prepare.py +95 -0
  199. mlebench/competitions/osic-pulmonary-fibrosis-progression/prepare_val.py +167 -0
  200. mlebench/competitions/paddy-disease-classification/grade.py +35 -0
  201. mlebench/competitions/paddy-disease-classification/prepare.py +69 -0
  202. mlebench/competitions/paddy-disease-classification/prepare_val.py +122 -0
  203. mlebench/competitions/petfinder-pawpularity-score/grade.py +41 -0
  204. mlebench/competitions/petfinder-pawpularity-score/prepare.py +76 -0
  205. mlebench/competitions/petfinder-pawpularity-score/prepare_val.py +154 -0
  206. mlebench/competitions/plant-pathology-2020-fgvc7/grade.py +41 -0
  207. mlebench/competitions/plant-pathology-2020-fgvc7/prepare.py +74 -0
  208. mlebench/competitions/plant-pathology-2020-fgvc7/prepare_val.py +160 -0
  209. mlebench/competitions/plant-pathology-2021-fgvc8/grade.py +54 -0
  210. mlebench/competitions/plant-pathology-2021-fgvc8/prepare.py +65 -0
  211. mlebench/competitions/plant-pathology-2021-fgvc8/prepare_val.py +130 -0
  212. mlebench/competitions/plant-seedlings-classification/grade.py +39 -0
  213. mlebench/competitions/plant-seedlings-classification/prepare.py +91 -0
  214. mlebench/competitions/plant-seedlings-classification/prepare_val.py +158 -0
  215. mlebench/competitions/playground-series-s3e1/__init__.py +0 -0
  216. mlebench/competitions/playground-series-s3e1/grade.py +52 -0
  217. mlebench/competitions/playground-series-s3e1/prepare.py +25 -0
  218. mlebench/competitions/playground-series-s3e11/__init__.py +0 -0
  219. mlebench/competitions/playground-series-s3e11/grade.py +55 -0
  220. mlebench/competitions/playground-series-s3e11/prepare.py +25 -0
  221. mlebench/competitions/playground-series-s3e18/grade.py +39 -0
  222. mlebench/competitions/playground-series-s3e18/prepare.py +36 -0
  223. mlebench/competitions/playground-series-s3e18/prepare_val.py +89 -0
  224. mlebench/competitions/playground_series_s3e1/__init__.py +0 -0
  225. mlebench/competitions/playground_series_s3e1/grade.py +52 -0
  226. mlebench/competitions/playground_series_s3e1/prepare.py +25 -0
  227. mlebench/competitions/playground_series_s3e11/__init__.py +0 -0
  228. mlebench/competitions/playground_series_s3e11/grade.py +55 -0
  229. mlebench/competitions/playground_series_s3e11/prepare.py +25 -0
  230. mlebench/competitions/predict-volcanic-eruptions-ingv-oe/grade.py +44 -0
  231. mlebench/competitions/predict-volcanic-eruptions-ingv-oe/prepare.py +68 -0
  232. mlebench/competitions/predict-volcanic-eruptions-ingv-oe/prepare_val.py +146 -0
  233. mlebench/competitions/random-acts-of-pizza/grade.py +14 -0
  234. mlebench/competitions/random-acts-of-pizza/prepare.py +80 -0
  235. mlebench/competitions/random-acts-of-pizza/prepare_val.py +144 -0
  236. mlebench/competitions/ranzcr-clip-catheter-line-classification/classes.py +11 -0
  237. mlebench/competitions/ranzcr-clip-catheter-line-classification/grade.py +31 -0
  238. mlebench/competitions/ranzcr-clip-catheter-line-classification/prepare.py +53 -0
  239. mlebench/competitions/ranzcr-clip-catheter-line-classification/prepare_val.py +113 -0
  240. mlebench/competitions/rsna-2022-cervical-spine-fracture-detection/grade.py +124 -0
  241. mlebench/competitions/rsna-2022-cervical-spine-fracture-detection/prepare.py +219 -0
  242. mlebench/competitions/rsna-2022-cervical-spine-fracture-detection/prepare_val.py +257 -0
  243. mlebench/competitions/rsna-breast-cancer-detection/grade.py +65 -0
  244. mlebench/competitions/rsna-breast-cancer-detection/prepare.py +141 -0
  245. mlebench/competitions/rsna-breast-cancer-detection/prepare_val.py +201 -0
  246. mlebench/competitions/rsna-miccai-brain-tumor-radiogenomic-classification/grade.py +13 -0
  247. mlebench/competitions/rsna-miccai-brain-tumor-radiogenomic-classification/prepare.py +47 -0
  248. mlebench/competitions/rsna-miccai-brain-tumor-radiogenomic-classification/prepare_val.py +97 -0
  249. mlebench/competitions/santander-customer-satisfaction/grade.py +10 -0
  250. mlebench/competitions/santander-customer-satisfaction/prepare.py +41 -0
  251. mlebench/competitions/sciencebench-001-clintox-nn/__init__.py +0 -0
  252. mlebench/competitions/sciencebench-001-clintox-nn/grade.py +56 -0
  253. mlebench/competitions/sciencebench-001-clintox-nn/prepare.py +75 -0
  254. mlebench/competitions/sciencebench-015-aai/grade.py +37 -0
  255. mlebench/competitions/sciencebench-015-aai/prepare.py +102 -0
  256. mlebench/competitions/sciencebench-051-brain-blood-qsar/grade.py +58 -0
  257. mlebench/competitions/sciencebench-051-brain-blood-qsar/prepare.py +69 -0
  258. mlebench/competitions/sciencebench-101-experimental-band-gap-prediction/grade.py +55 -0
  259. mlebench/competitions/sciencebench-101-experimental-band-gap-prediction/prepare.py +88 -0
  260. mlebench/competitions/see-click-predict-fix/__init__.py +0 -0
  261. mlebench/competitions/see-click-predict-fix/grade.py +66 -0
  262. mlebench/competitions/see-click-predict-fix/prepare.py +25 -0
  263. mlebench/competitions/see_click_predict_fix/__init__.py +0 -0
  264. mlebench/competitions/see_click_predict_fix/grade.py +66 -0
  265. mlebench/competitions/see_click_predict_fix/prepare.py +25 -0
  266. mlebench/competitions/seti-breakthrough-listen/grade.py +11 -0
  267. mlebench/competitions/seti-breakthrough-listen/prepare.py +71 -0
  268. mlebench/competitions/seti-breakthrough-listen/prepare_val.py +159 -0
  269. mlebench/competitions/siim-covid19-detection/grade.py +194 -0
  270. mlebench/competitions/siim-covid19-detection/prepare.py +123 -0
  271. mlebench/competitions/siim-covid19-detection/prepare_val.py +164 -0
  272. mlebench/competitions/siim-isic-melanoma-classification/grade.py +11 -0
  273. mlebench/competitions/siim-isic-melanoma-classification/prepare.py +127 -0
  274. mlebench/competitions/siim-isic-melanoma-classification/prepare_val.py +158 -0
  275. mlebench/competitions/smartphone-decimeter-2022/grade.py +55 -0
  276. mlebench/competitions/smartphone-decimeter-2022/notebook.py +86 -0
  277. mlebench/competitions/smartphone-decimeter-2022/prepare.py +143 -0
  278. mlebench/competitions/smartphone-decimeter-2022/prepare_val.py +199 -0
  279. mlebench/competitions/spaceship-titanic/grade.py +11 -0
  280. mlebench/competitions/spaceship-titanic/prepare.py +23 -0
  281. mlebench/competitions/spaceship-titanic/prepare_val.py +61 -0
  282. mlebench/competitions/spooky-author-identification/classes.py +1 -0
  283. mlebench/competitions/spooky-author-identification/grade.py +38 -0
  284. mlebench/competitions/spooky-author-identification/prepare.py +40 -0
  285. mlebench/competitions/spooky-author-identification/prepare_val.py +78 -0
  286. mlebench/competitions/stanford-covid-vaccine/grade.py +65 -0
  287. mlebench/competitions/stanford-covid-vaccine/prepare.py +129 -0
  288. mlebench/competitions/stanford-covid-vaccine/prepare_val.py +199 -0
  289. mlebench/competitions/statoil-iceberg-classifier-challenge/grade.py +41 -0
  290. mlebench/competitions/statoil-iceberg-classifier-challenge/prepare.py +105 -0
  291. mlebench/competitions/statoil-iceberg-classifier-challenge/prepare_val.py +157 -0
  292. mlebench/competitions/tabular-playground-series-dec-2021/grade.py +11 -0
  293. mlebench/competitions/tabular-playground-series-dec-2021/prepare.py +39 -0
  294. mlebench/competitions/tabular-playground-series-dec-2021/prepare_val.py +99 -0
  295. mlebench/competitions/tabular-playground-series-may-2022/grade.py +9 -0
  296. mlebench/competitions/tabular-playground-series-may-2022/prepare.py +56 -0
  297. mlebench/competitions/tabular-playground-series-may-2022/prepare_val.py +116 -0
  298. mlebench/competitions/tensorflow-speech-recognition-challenge/grade.py +11 -0
  299. mlebench/competitions/tensorflow-speech-recognition-challenge/prepare.py +90 -0
  300. mlebench/competitions/tensorflow-speech-recognition-challenge/prepare_val.py +148 -0
  301. mlebench/competitions/tensorflow2-question-answering/grade.py +122 -0
  302. mlebench/competitions/tensorflow2-question-answering/prepare.py +122 -0
  303. mlebench/competitions/tensorflow2-question-answering/prepare_val.py +187 -0
  304. mlebench/competitions/text-normalization-challenge-english-language/grade.py +49 -0
  305. mlebench/competitions/text-normalization-challenge-english-language/prepare.py +115 -0
  306. mlebench/competitions/text-normalization-challenge-english-language/prepare_val.py +213 -0
  307. mlebench/competitions/text-normalization-challenge-russian-language/grade.py +49 -0
  308. mlebench/competitions/text-normalization-challenge-russian-language/prepare.py +113 -0
  309. mlebench/competitions/text-normalization-challenge-russian-language/prepare_val.py +165 -0
  310. mlebench/competitions/tgs-salt-identification-challenge/grade.py +144 -0
  311. mlebench/competitions/tgs-salt-identification-challenge/prepare.py +158 -0
  312. mlebench/competitions/tgs-salt-identification-challenge/prepare_val.py +166 -0
  313. mlebench/competitions/the-icml-2013-whale-challenge-right-whale-redux/grade.py +11 -0
  314. mlebench/competitions/the-icml-2013-whale-challenge-right-whale-redux/prepare.py +95 -0
  315. mlebench/competitions/the-icml-2013-whale-challenge-right-whale-redux/prepare_val.py +141 -0
  316. mlebench/competitions/tmdb-box-office-prediction/__init__.py +0 -0
  317. mlebench/competitions/tmdb-box-office-prediction/grade.py +55 -0
  318. mlebench/competitions/tmdb-box-office-prediction/prepare.py +35 -0
  319. mlebench/competitions/tweet-sentiment-extraction/grade.py +67 -0
  320. mlebench/competitions/tweet-sentiment-extraction/prepare.py +36 -0
  321. mlebench/competitions/tweet-sentiment-extraction/prepare_val.py +106 -0
  322. mlebench/competitions/us-patent-phrase-to-phrase-matching/grade.py +31 -0
  323. mlebench/competitions/us-patent-phrase-to-phrase-matching/prepare.py +33 -0
  324. mlebench/competitions/us-patent-phrase-to-phrase-matching/prepare_val.py +71 -0
  325. mlebench/competitions/utils.py +266 -0
  326. mlebench/competitions/uw-madison-gi-tract-image-segmentation/grade.py +158 -0
  327. mlebench/competitions/uw-madison-gi-tract-image-segmentation/prepare.py +139 -0
  328. mlebench/competitions/uw-madison-gi-tract-image-segmentation/prepare_val.py +193 -0
  329. mlebench/competitions/ventilator-pressure-prediction/__init__.py +0 -0
  330. mlebench/competitions/ventilator-pressure-prediction/grade.py +52 -0
  331. mlebench/competitions/ventilator-pressure-prediction/prepare.py +27 -0
  332. mlebench/competitions/ventilator-pressure-prediction/prepare_val.py +142 -0
  333. mlebench/competitions/ventilator_pressure_prediction/__init__.py +0 -0
  334. mlebench/competitions/ventilator_pressure_prediction/grade.py +52 -0
  335. mlebench/competitions/ventilator_pressure_prediction/prepare.py +27 -0
  336. mlebench/competitions/vesuvius-challenge-ink-detection/grade.py +97 -0
  337. mlebench/competitions/vesuvius-challenge-ink-detection/prepare.py +122 -0
  338. mlebench/competitions/vesuvius-challenge-ink-detection/prepare_val.py +170 -0
  339. mlebench/competitions/vinbigdata-chest-xray-abnormalities-detection/grade.py +220 -0
  340. mlebench/competitions/vinbigdata-chest-xray-abnormalities-detection/prepare.py +129 -0
  341. mlebench/competitions/vinbigdata-chest-xray-abnormalities-detection/prepare_val.py +204 -0
  342. mlebench/competitions/whale-categorization-playground/grade.py +41 -0
  343. mlebench/competitions/whale-categorization-playground/prepare.py +103 -0
  344. mlebench/competitions/whale-categorization-playground/prepare_val.py +196 -0
  345. mlebench/data.py +420 -0
  346. mlebench/grade.py +209 -0
  347. mlebench/grade_helpers.py +235 -0
  348. mlebench/metrics.py +75 -0
  349. mlebench/registry.py +332 -0
  350. mlebench/utils.py +346 -0
  351. {dslighting-1.7.1.dist-info → dslighting-1.7.6.dist-info}/WHEEL +0 -0
  352. {dslighting-1.7.1.dist-info → dslighting-1.7.6.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,102 @@
1
+ """Prepare data for ScienceBench task 15 (admet_ai)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+ import shutil
7
+ import pandas as pd
8
+
9
+
10
+ DATASET_ROOT = Path("/path/to/ScienceAgent-bench/benchmark/datasets/ames")
11
+ GOLD_FILE = Path("/path/to/ScienceAgent-bench/benchmark/eval_programs/gold_results/admet_ai_gold.csv")
12
+ EXPECTED_OUTPUT = "aai_preds.csv"
13
+
14
+
15
+ def _ensure_dir(path: Path) -> None:
16
+ path.mkdir(parents=True, exist_ok=True)
17
+
18
+
19
+ def _copy_dataset(dataset_root: Path, target_root: Path) -> int:
20
+ """Copy the Ames dataset into the public directory."""
21
+ if not dataset_root.exists():
22
+ raise FileNotFoundError(f"Source dataset not found: {dataset_root}")
23
+
24
+ copied = 0
25
+ for item in dataset_root.rglob("*"):
26
+ if not item.is_file() or item.name.startswith("."):
27
+ continue
28
+ relative = item.relative_to(dataset_root)
29
+ destination = target_root / relative
30
+ destination.parent.mkdir(parents=True, exist_ok=True)
31
+ shutil.copy2(item, destination)
32
+ copied += 1
33
+ if copied <= 10:
34
+ print(f" ✓ Copied: {relative}")
35
+ if copied > 10:
36
+ print(f" ... and {copied - 10} more files")
37
+ return copied
38
+
39
+
40
+ def _write_sample_submission(dataset_root: Path, public_dir: Path) -> None:
41
+ """Build a sample submission aligned with the gold file schema."""
42
+ test_path = dataset_root / "test.csv"
43
+ if not test_path.exists():
44
+ raise FileNotFoundError(f"Test file not found at {test_path}")
45
+
46
+ test_df = pd.read_csv(test_path, index_col=0)
47
+ sample_df = test_df[["Drug_ID", "Drug"]].copy()
48
+ sample_df["Y"] = 0.5 # Placeholder probability
49
+ sample_path = public_dir / "sample_submission.csv"
50
+ sample_df.to_csv(sample_path, index=False)
51
+ print(f"✓ Created {sample_path.name} with {len(sample_df)} rows")
52
+
53
+
54
+ def _write_answers(private_dir: Path) -> None:
55
+ """Copy the gold answers used by the grader."""
56
+ if not GOLD_FILE.exists():
57
+ raise FileNotFoundError(f"Gold file missing: {GOLD_FILE}")
58
+ gold_df = pd.read_csv(GOLD_FILE)
59
+ first_col = gold_df.columns[0]
60
+ if first_col.startswith("Unnamed"):
61
+ gold_df = gold_df.drop(columns=[first_col])
62
+ answer_path = private_dir / "answer.csv"
63
+ gold_df.to_csv(answer_path, index=False)
64
+ print(f"✓ Copied answer.csv with {len(gold_df)} rows")
65
+
66
+
67
+ def prepare(raw: Path, public: Path, private: Path) -> None:
68
+ """
69
+ Stage the Ames mutagenicity dataset for ScienceBench task 15.
70
+
71
+ Args:
72
+ raw: Optional pre-staged dataset directory. If empty, the canonical dataset is used.
73
+ public: Directory exposed to participants.
74
+ private: Directory used internally for grading.
75
+ """
76
+ print("=" * 60)
77
+ print("Preparing ScienceBench Task 15: admet_ai")
78
+ print("=" * 60)
79
+ print(f"Raw directory: {raw}")
80
+ print(f"Public directory: {public}")
81
+ print(f"Private directory: {private}")
82
+
83
+ _ensure_dir(public)
84
+ _ensure_dir(private)
85
+
86
+ dataset_root = raw if raw.exists() and any(raw.iterdir()) else DATASET_ROOT
87
+ if dataset_root is not DATASET_ROOT:
88
+ print("✓ Using provided raw dataset directory.")
89
+ else:
90
+ print(f"⚠ Raw directory missing or empty. Using canonical dataset: {DATASET_ROOT}")
91
+
92
+ total_copied = _copy_dataset(dataset_root, public)
93
+ print(f" Total files copied: {total_copied}")
94
+
95
+ _write_sample_submission(dataset_root, public)
96
+ _write_answers(private)
97
+
98
+ print(f"\nData preparation completed. Expected submission file: pred_results/{EXPECTED_OUTPUT}")
99
+
100
+
101
+ if __name__ == "__main__":
102
+ raise SystemExit("Use via the benchmark preparation tooling.")
@@ -0,0 +1,58 @@
1
+ """Grading function for ScienceBench task 51 (brain-blood QSAR)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+ from typing import Any
7
+
8
+ import pandas as pd
9
+ from sklearn.metrics import balanced_accuracy_score
10
+
11
+ EXPECTED_FILE = "pred_results/brain_blood_qsar.csv"
12
+ GOLD_FILE = Path("benchmark/eval_programs/gold_results/brain_blood_qsar_gold.csv")
13
+ THRESHOLD = 0.70
14
+
15
+
16
+ def _extract_labels(data: Any) -> pd.Series:
17
+ if isinstance(data, pd.DataFrame):
18
+ if "label" not in data.columns:
19
+ raise ValueError("Data must contain a 'label' column.")
20
+ return data["label"]
21
+ if isinstance(data, (str, Path)):
22
+ df = pd.read_csv(data)
23
+ if "label" not in df.columns:
24
+ raise ValueError(f"CSV at {data} must contain a 'label' column.")
25
+ return df["label"]
26
+ raise TypeError(f"Unsupported data type: {type(data)}")
27
+
28
+
29
+ def _load_submission(submission: Any) -> pd.Series:
30
+ try:
31
+ return _extract_labels(submission)
32
+ except TypeError:
33
+ path = Path(EXPECTED_FILE)
34
+ if not path.exists():
35
+ raise FileNotFoundError(f"Expected prediction file missing: {EXPECTED_FILE}")
36
+ return _extract_labels(path)
37
+
38
+
39
+ def _load_answers(answers: Any) -> pd.Series:
40
+ try:
41
+ return _extract_labels(answers)
42
+ except TypeError:
43
+ if not GOLD_FILE.exists():
44
+ raise FileNotFoundError(f"Gold file not found: {GOLD_FILE}")
45
+ return _extract_labels(GOLD_FILE)
46
+
47
+
48
+ def grade(submission: Any, answers: Any) -> float:
49
+ pred_labels = _load_submission(submission)
50
+ gold_labels = _load_answers(answers)
51
+
52
+ if len(pred_labels) != len(gold_labels):
53
+ print(f"Row count mismatch: {len(pred_labels)} vs {len(gold_labels)}")
54
+ return 0.0
55
+
56
+ score = balanced_accuracy_score(gold_labels, pred_labels)
57
+ print(f"Balanced accuracy: {score}")
58
+ return 1.0 if score >= THRESHOLD else 0.0
@@ -0,0 +1,69 @@
1
+ """
2
+ Data preparation for ScienceBench task 51
3
+ Dataset: brain-blood
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ import shutil
9
+ from pathlib import Path
10
+
11
+ import pandas as pd
12
+
13
+ EXPECTED_FILE = "brain_blood_qsar.csv"
14
+ DATASET_DIR = Path("/path/to/ScienceAgent-bench/benchmark/datasets/brain-blood")
15
+ GOLD_FILE = Path("/path/to/ScienceAgent-bench/benchmark/eval_programs/gold_results/brain_blood_qsar_gold.csv")
16
+
17
+
18
+ def _ensure_dir(path: Path) -> None:
19
+ path.mkdir(parents=True, exist_ok=True)
20
+
21
+
22
+ def prepare(raw: Path, public: Path, private: Path) -> None:
23
+ print("=" * 60)
24
+ print("Preparing ScienceBench Task 51")
25
+ print("Dataset: brain-blood")
26
+ print("=" * 60)
27
+ print("Raw directory:", raw)
28
+ print("Public directory:", public)
29
+ print("Private directory:", private)
30
+
31
+ source = raw if raw.exists() else DATASET_DIR
32
+ if not source.exists():
33
+ raise FileNotFoundError(f"Dataset directory not found: {source}")
34
+
35
+ _ensure_dir(public)
36
+ _ensure_dir(private)
37
+
38
+ required = [
39
+ source / "logBB.sdf",
40
+ source / "logBB_test.sdf",
41
+ ]
42
+ missing = [str(path) for path in required if not path.exists()]
43
+ if missing:
44
+ raise FileNotFoundError("Missing dataset files: " + ", ".join(missing))
45
+
46
+ for path in required:
47
+ target = public / path.relative_to(source.parent)
48
+ target.parent.mkdir(parents=True, exist_ok=True)
49
+ shutil.copy2(path, target)
50
+ print("✓ Copied logBB SDF files")
51
+
52
+ sample_df = pd.DataFrame(
53
+ {
54
+ "label": [1, 0],
55
+ }
56
+ )
57
+ sample_df.to_csv(public / "sample_submission.csv", index=False)
58
+ print("✓ Created sample_submission.csv")
59
+
60
+ if not GOLD_FILE.exists():
61
+ raise FileNotFoundError(f"Gold CSV not found: {GOLD_FILE}")
62
+ shutil.copy2(GOLD_FILE, private / "answer.csv")
63
+ print("✓ Copied answer.csv")
64
+
65
+ print("Preparation complete. Expected submission file: pred_results/brain_blood_qsar.csv")
66
+
67
+
68
+ if __name__ == "__main__":
69
+ raise SystemExit("Use this module via the benchmark preparation tooling.")
@@ -0,0 +1,55 @@
1
+ """Grader for ScienceBench task 101 (experimental band-gap prediction)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+
7
+ import pandas as pd
8
+
9
+
10
+ PRED_FILENAME = "experimental_band_gap_prediction_pred.csv"
11
+ GOLD_FILENAME = "experimental_band_gap_prediction_gold.csv"
12
+ TARGET_COLUMN = "gap_expt_eV"
13
+ THRESHOLD = 0.6
14
+
15
+
16
+ def _repo_root() -> Path:
17
+ return Path(__file__).resolve().parents[2]
18
+
19
+
20
+ def _pred_path() -> Path:
21
+ return Path("pred_results") / PRED_FILENAME
22
+
23
+
24
+ def _gold_path() -> Path:
25
+ return (
26
+ _repo_root()
27
+ / "benchmark"
28
+ / "eval_programs"
29
+ / "gold_results"
30
+ / GOLD_FILENAME
31
+ )
32
+
33
+
34
+ def _load_csv(path: Path) -> pd.DataFrame:
35
+ if not path.exists():
36
+ raise FileNotFoundError(f"Required file missing: {path}")
37
+ return pd.read_csv(path)
38
+
39
+
40
+ def grade(submission, answers) -> float:
41
+ pred_df = _load_csv(_pred_path())
42
+ gold_df = _load_csv(_gold_path())
43
+
44
+ if TARGET_COLUMN not in pred_df.columns:
45
+ print(f"Missing '{TARGET_COLUMN}' column in prediction.")
46
+ return 0.0
47
+
48
+ merged = gold_df[[TARGET_COLUMN]].join(pred_df[[TARGET_COLUMN]], how="inner", rsuffix="_pred")
49
+ if merged.empty:
50
+ print("No overlapping rows between prediction and gold.")
51
+ return 0.0
52
+
53
+ mae = (merged[TARGET_COLUMN] - merged[f"{TARGET_COLUMN}_pred"]).abs().mean()
54
+ print(f"MAE: {mae}")
55
+ return 1.0 if mae < THRESHOLD else 0.0
@@ -0,0 +1,88 @@
1
+ """Data preparation for ScienceBench task 101 (experimental band-gap prediction)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import shutil
6
+ from pathlib import Path
7
+
8
+ import pandas as pd
9
+
10
+
11
+ DATASET_NAME = "experimental_band_gap"
12
+ PRED_FILENAME = "experimental_band_gap_prediction_pred.csv"
13
+ GOLD_FILENAME = "experimental_band_gap_prediction_gold.csv"
14
+ SAMPLE_FILENAME = "sample_submission.csv"
15
+
16
+
17
+ def _repo_root() -> Path:
18
+ return Path(__file__).resolve().parents[2]
19
+
20
+
21
+ def _dataset_dir() -> Path:
22
+ return _repo_root() / "benchmark" / "datasets" / DATASET_NAME
23
+
24
+
25
+ def _gold_path() -> Path:
26
+ return (
27
+ _repo_root()
28
+ / "benchmark"
29
+ / "eval_programs"
30
+ / "gold_results"
31
+ / GOLD_FILENAME
32
+ )
33
+
34
+
35
+ def _ensure_dir(path: Path) -> None:
36
+ path.mkdir(parents=True, exist_ok=True)
37
+
38
+
39
+ def _copy_dataset(src: Path, public: Path) -> None:
40
+ dest_root = public / DATASET_NAME
41
+ dest_root.mkdir(parents=True, exist_ok=True)
42
+ copied = 0
43
+ for item in src.iterdir():
44
+ if not item.is_file():
45
+ continue
46
+ shutil.copy2(item, dest_root / item.name)
47
+ copied += 1
48
+ print(f"✓ Copied {copied} dataset file(s) to {dest_root}")
49
+
50
+
51
+ def prepare(raw: Path, public: Path, private: Path) -> None:
52
+ print("=" * 60)
53
+ print("Preparing ScienceBench Task 101")
54
+ print("Dataset:", DATASET_NAME)
55
+ print("=" * 60)
56
+ print("Raw directory:", raw)
57
+ print("Public directory:", public)
58
+ print("Private directory:", private)
59
+
60
+ source_dir = raw if raw.exists() else _dataset_dir()
61
+ if not source_dir.exists():
62
+ raise FileNotFoundError(f"Dataset directory not found: {source_dir}")
63
+
64
+ gold_path = _gold_path()
65
+ if not gold_path.exists():
66
+ raise FileNotFoundError(f"Gold CSV not found: {gold_path}")
67
+
68
+ _ensure_dir(public)
69
+ _ensure_dir(private)
70
+
71
+ _copy_dataset(source_dir, public)
72
+
73
+ gold_df = pd.read_csv(gold_path)
74
+ sample = gold_df.head(3).copy()
75
+ sample["gap_expt_eV"] = 0.0
76
+ sample.to_csv(public / SAMPLE_FILENAME, index=False)
77
+ print("✓ Created sample_submission.csv placeholder")
78
+
79
+ gold_df.to_csv(private / "answer.csv", index=False)
80
+ print("✓ Copied gold CSV to private directory")
81
+
82
+ (private / "notes.txt").write_text(
83
+ f"Expected submission: pred_results/{PRED_FILENAME}\nMAE threshold: 0.6 eV\n",
84
+ encoding="utf-8",
85
+ )
86
+ print("✓ Wrote notes.txt")
87
+
88
+ print("Data preparation completed.")
@@ -0,0 +1,66 @@
1
+ import numpy as np
2
+ import pandas as pd
3
+ from sklearn.metrics import mean_squared_log_error
4
+
5
+ from mlebench.grade_helpers import InvalidSubmissionError
6
+
7
+
8
+ TARGET_COLUMNS = ['num_views', 'num_votes', 'num_comments']
9
+
10
+
11
+ def prepare_for_metric(submission: pd.DataFrame, answers: pd.DataFrame):
12
+ """Prepare submission and answers for RMSLE calculation."""
13
+ if len(submission) != len(answers):
14
+ raise InvalidSubmissionError(
15
+ f"Submission length ({len(submission)}) != answers length ({len(answers)})"
16
+ )
17
+
18
+ if "id" not in submission.columns:
19
+ raise InvalidSubmissionError("Submission must have an 'id' column")
20
+
21
+ for col in TARGET_COLUMNS:
22
+ if col not in submission.columns:
23
+ raise InvalidSubmissionError(f"Submission must have a '{col}' column")
24
+
25
+ # Sort by id
26
+ submission = submission.sort_values("id").reset_index(drop=True)
27
+ answers = answers.sort_values("id").reset_index(drop=True)
28
+
29
+ # Check id alignment
30
+ if not (submission["id"] == answers["id"]).all():
31
+ raise InvalidSubmissionError("Submission and answers id mismatch")
32
+
33
+ # Validate predictions
34
+ for col in TARGET_COLUMNS:
35
+ try:
36
+ submission[col] = submission[col].astype(float)
37
+ except (ValueError, TypeError):
38
+ raise InvalidSubmissionError(f"'{col}' predictions must be numeric")
39
+
40
+ if submission[col].isnull().any():
41
+ raise InvalidSubmissionError(f"'{col}' predictions cannot contain NaN values")
42
+
43
+ if (submission[col] < 0).any():
44
+ raise InvalidSubmissionError(f"'{col}' predictions cannot be negative")
45
+
46
+ return submission, answers
47
+
48
+
49
+ def grade(submission: pd.DataFrame, answers: pd.DataFrame) -> float:
50
+ """Calculate RMSLE score across all target columns."""
51
+ submission, answers = prepare_for_metric(submission, answers)
52
+
53
+ # Concatenate all predictions and true values
54
+ all_pred = []
55
+ all_true = []
56
+ for col in TARGET_COLUMNS:
57
+ all_pred.extend(submission[col].values)
58
+ all_true.extend(answers[col].values)
59
+
60
+ all_pred = np.array(all_pred)
61
+ all_true = np.array(all_true)
62
+
63
+ # RMSLE
64
+ rmsle = np.sqrt(mean_squared_log_error(all_true, all_pred))
65
+
66
+ return rmsle
@@ -0,0 +1,25 @@
1
+ from pathlib import Path
2
+ import pandas as pd
3
+
4
+
5
+ def prepare(raw: Path, public: Path, private: Path):
6
+ """
7
+ Prepare see-click-predict-fix dataset.
8
+ """
9
+ # Read data
10
+ train = pd.read_csv(raw / "train.csv")
11
+ test = pd.read_csv(raw / "test.csv")
12
+ sample_submission = pd.read_csv(raw / "sample_submission.csv")
13
+ test_answer = pd.read_csv(raw / "test_answer.csv")
14
+
15
+ # Public files (visible to agents)
16
+ train.to_csv(public / "train.csv", index=False)
17
+ test.to_csv(public / "test.csv", index=False)
18
+ sample_submission.to_csv(public / "sample_submission.csv", index=False)
19
+
20
+ # Private files (for grading)
21
+ test_answer.to_csv(private / "test.csv", index=False)
22
+
23
+ # Validation checks
24
+ assert len(test_answer) == len(sample_submission), \
25
+ f"Test answer ({len(test_answer)}) and sample submission ({len(sample_submission)}) must have same length"
@@ -0,0 +1,66 @@
1
+ import numpy as np
2
+ import pandas as pd
3
+ from sklearn.metrics import mean_squared_log_error
4
+
5
+ from mlebench.grade_helpers import InvalidSubmissionError
6
+
7
+
8
+ TARGET_COLUMNS = ['num_views', 'num_votes', 'num_comments']
9
+
10
+
11
+ def prepare_for_metric(submission: pd.DataFrame, answers: pd.DataFrame):
12
+ """Prepare submission and answers for RMSLE calculation."""
13
+ if len(submission) != len(answers):
14
+ raise InvalidSubmissionError(
15
+ f"Submission length ({len(submission)}) != answers length ({len(answers)})"
16
+ )
17
+
18
+ if "id" not in submission.columns:
19
+ raise InvalidSubmissionError("Submission must have an 'id' column")
20
+
21
+ for col in TARGET_COLUMNS:
22
+ if col not in submission.columns:
23
+ raise InvalidSubmissionError(f"Submission must have a '{col}' column")
24
+
25
+ # Sort by id
26
+ submission = submission.sort_values("id").reset_index(drop=True)
27
+ answers = answers.sort_values("id").reset_index(drop=True)
28
+
29
+ # Check id alignment
30
+ if not (submission["id"] == answers["id"]).all():
31
+ raise InvalidSubmissionError("Submission and answers id mismatch")
32
+
33
+ # Validate predictions
34
+ for col in TARGET_COLUMNS:
35
+ try:
36
+ submission[col] = submission[col].astype(float)
37
+ except (ValueError, TypeError):
38
+ raise InvalidSubmissionError(f"'{col}' predictions must be numeric")
39
+
40
+ if submission[col].isnull().any():
41
+ raise InvalidSubmissionError(f"'{col}' predictions cannot contain NaN values")
42
+
43
+ if (submission[col] < 0).any():
44
+ raise InvalidSubmissionError(f"'{col}' predictions cannot be negative")
45
+
46
+ return submission, answers
47
+
48
+
49
+ def grade(submission: pd.DataFrame, answers: pd.DataFrame) -> float:
50
+ """Calculate RMSLE score across all target columns."""
51
+ submission, answers = prepare_for_metric(submission, answers)
52
+
53
+ # Concatenate all predictions and true values
54
+ all_pred = []
55
+ all_true = []
56
+ for col in TARGET_COLUMNS:
57
+ all_pred.extend(submission[col].values)
58
+ all_true.extend(answers[col].values)
59
+
60
+ all_pred = np.array(all_pred)
61
+ all_true = np.array(all_true)
62
+
63
+ # RMSLE
64
+ rmsle = np.sqrt(mean_squared_log_error(all_true, all_pred))
65
+
66
+ return rmsle
@@ -0,0 +1,25 @@
1
+ from pathlib import Path
2
+ import pandas as pd
3
+
4
+
5
+ def prepare(raw: Path, public: Path, private: Path):
6
+ """
7
+ Prepare see-click-predict-fix dataset.
8
+ """
9
+ # Read data
10
+ train = pd.read_csv(raw / "train.csv")
11
+ test = pd.read_csv(raw / "test.csv")
12
+ sample_submission = pd.read_csv(raw / "sample_submission.csv")
13
+ test_answer = pd.read_csv(raw / "test_answer.csv")
14
+
15
+ # Public files (visible to agents)
16
+ train.to_csv(public / "train.csv", index=False)
17
+ test.to_csv(public / "test.csv", index=False)
18
+ sample_submission.to_csv(public / "sample_submission.csv", index=False)
19
+
20
+ # Private files (for grading)
21
+ test_answer.to_csv(private / "test.csv", index=False)
22
+
23
+ # Validation checks
24
+ assert len(test_answer) == len(sample_submission), \
25
+ f"Test answer ({len(test_answer)}) and sample submission ({len(sample_submission)}) must have same length"
@@ -0,0 +1,11 @@
1
+ import pandas as pd
2
+ from sklearn.metrics import roc_auc_score
3
+
4
+ from mlebench.competitions.utils import prepare_for_auroc_metric
5
+
6
+
7
+ def grade(submission: pd.DataFrame, answers: pd.DataFrame) -> float:
8
+ roc_auc_inputs = prepare_for_auroc_metric(
9
+ submission=submission, answers=answers, id_col="id", target_col="target"
10
+ )
11
+ return roc_auc_score(y_true=roc_auc_inputs["y_true"], y_score=roc_auc_inputs["y_score"])
@@ -0,0 +1,71 @@
1
+ import shutil
2
+ from pathlib import Path
3
+
4
+ from sklearn.model_selection import train_test_split
5
+ from tqdm import tqdm
6
+
7
+ from mlebench.utils import read_csv
8
+
9
+
10
+ def prepare(raw: Path, public: Path, private: Path):
11
+
12
+ # Create train, test from train split
13
+ old_train = read_csv(raw / "train_labels.csv")
14
+ new_train, new_test = train_test_split(old_train, test_size=0.1, random_state=0)
15
+
16
+ # Copy over files
17
+ new_train.to_csv(public / "train_labels.csv", index=False)
18
+ new_test.to_csv(private / "test.csv", index=False)
19
+
20
+ shutil.copytree(raw / "old_leaky_data", public / "old_leaky_data", dirs_exist_ok=True)
21
+
22
+ for file_id in tqdm(new_train["id"], desc="Copying train files"):
23
+ subdir = file_id[0]
24
+ src = raw / "train" / subdir / f"{file_id}.npy"
25
+ dst = public / "train" / subdir / f"{file_id}.npy"
26
+ dst.parent.mkdir(parents=True, exist_ok=True)
27
+ shutil.copy(src, dst)
28
+
29
+ for file_id in tqdm(new_test["id"], desc="Copying test files"):
30
+ subdir = file_id[0]
31
+ src = raw / "train" / subdir / f"{file_id}.npy"
32
+ dst = public / "test" / subdir / f"{file_id}.npy"
33
+ dst.parent.mkdir(parents=True, exist_ok=True)
34
+ shutil.copy(src, dst)
35
+
36
+ # Create sample submission
37
+ sample_submission = new_test.copy()
38
+ sample_submission["target"] = 0.5 # Overwrite with dummy values
39
+ sample_submission.to_csv(public / "sample_submission.csv", index=False)
40
+
41
+ # Checks
42
+ assert len(sample_submission) == len(
43
+ new_test
44
+ ), "Sample submission length does not match test length."
45
+ assert not set(new_train["id"]).intersection(
46
+ set(new_test["id"])
47
+ ), "There are overlapping IDs in train and test sets."
48
+
49
+ train_files = {
50
+ file_path.name: file_path
51
+ for file_path in (public / "train").rglob("*")
52
+ if file_path.is_file()
53
+ }
54
+ test_files = {
55
+ file_path.name: file_path
56
+ for file_path in (public / "test").rglob("*")
57
+ if file_path.is_file()
58
+ }
59
+
60
+ assert len(train_files) == len(
61
+ new_train
62
+ ), "Number of train files does not match the number of train records."
63
+ assert len(test_files) == len(
64
+ new_test
65
+ ), "Number of test files does not match the number of test records."
66
+ assert train_files.keys().isdisjoint(
67
+ test_files.keys()
68
+ ), "There are overlapping files in train and test directories."
69
+ assert len(sample_submission) == len(
70
+ new_test
71
+ ), "Sample submission length does not match new test length."