autogluon.tabular 1.5.1b20260105__py3-none-any.whl → 1.5.1b20260117__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.

Potentially problematic release.


This version of autogluon.tabular might be problematic. Click here for more details.

Files changed (135) hide show
  1. autogluon/tabular/__init__.py +1 -0
  2. autogluon/tabular/configs/config_helper.py +18 -6
  3. autogluon/tabular/configs/feature_generator_presets.py +3 -1
  4. autogluon/tabular/configs/hyperparameter_configs.py +42 -9
  5. autogluon/tabular/configs/presets_configs.py +38 -14
  6. autogluon/tabular/configs/zeroshot/zeroshot_portfolio_2023.py +84 -14
  7. autogluon/tabular/configs/zeroshot/zeroshot_portfolio_2025.py +48 -48
  8. autogluon/tabular/configs/zeroshot/zeroshot_portfolio_cpu_2025_12_18.py +774 -1
  9. autogluon/tabular/configs/zeroshot/zeroshot_portfolio_gpu_2025_12_18.py +421 -1
  10. autogluon/tabular/experimental/_scikit_mixin.py +6 -2
  11. autogluon/tabular/experimental/_tabular_classifier.py +3 -1
  12. autogluon/tabular/experimental/_tabular_regressor.py +3 -1
  13. autogluon/tabular/experimental/plot_leaderboard.py +73 -19
  14. autogluon/tabular/learner/abstract_learner.py +160 -42
  15. autogluon/tabular/learner/default_learner.py +78 -22
  16. autogluon/tabular/models/__init__.py +2 -2
  17. autogluon/tabular/models/_utils/rapids_utils.py +3 -1
  18. autogluon/tabular/models/abstract/abstract_torch_model.py +2 -0
  19. autogluon/tabular/models/automm/automm_model.py +12 -3
  20. autogluon/tabular/models/automm/ft_transformer.py +5 -1
  21. autogluon/tabular/models/catboost/callbacks.py +2 -2
  22. autogluon/tabular/models/catboost/catboost_model.py +93 -29
  23. autogluon/tabular/models/catboost/catboost_softclass_utils.py +4 -1
  24. autogluon/tabular/models/catboost/catboost_utils.py +3 -1
  25. autogluon/tabular/models/ebm/ebm_model.py +8 -13
  26. autogluon/tabular/models/ebm/hyperparameters/parameters.py +1 -0
  27. autogluon/tabular/models/ebm/hyperparameters/searchspaces.py +1 -0
  28. autogluon/tabular/models/fastainn/callbacks.py +20 -3
  29. autogluon/tabular/models/fastainn/hyperparameters/searchspaces.py +11 -1
  30. autogluon/tabular/models/fastainn/quantile_helpers.py +10 -2
  31. autogluon/tabular/models/fastainn/tabular_nn_fastai.py +65 -18
  32. autogluon/tabular/models/fasttext/fasttext_model.py +3 -1
  33. autogluon/tabular/models/image_prediction/image_predictor.py +7 -2
  34. autogluon/tabular/models/knn/knn_model.py +41 -8
  35. autogluon/tabular/models/lgb/callbacks.py +32 -9
  36. autogluon/tabular/models/lgb/hyperparameters/searchspaces.py +3 -1
  37. autogluon/tabular/models/lgb/lgb_model.py +150 -34
  38. autogluon/tabular/models/lgb/lgb_utils.py +12 -4
  39. autogluon/tabular/models/lr/hyperparameters/searchspaces.py +5 -1
  40. autogluon/tabular/models/lr/lr_model.py +40 -10
  41. autogluon/tabular/models/lr/lr_rapids_model.py +22 -13
  42. autogluon/tabular/models/mitra/_internal/__init__.py +1 -1
  43. autogluon/tabular/models/mitra/_internal/config/__init__.py +1 -1
  44. autogluon/tabular/models/mitra/_internal/config/config_pretrain.py +36 -40
  45. autogluon/tabular/models/mitra/_internal/config/config_run.py +2 -14
  46. autogluon/tabular/models/mitra/_internal/config/enums.py +27 -26
  47. autogluon/tabular/models/mitra/_internal/core/__init__.py +1 -1
  48. autogluon/tabular/models/mitra/_internal/core/callbacks.py +14 -21
  49. autogluon/tabular/models/mitra/_internal/core/get_loss.py +10 -12
  50. autogluon/tabular/models/mitra/_internal/core/get_optimizer.py +17 -32
  51. autogluon/tabular/models/mitra/_internal/core/get_scheduler.py +12 -27
  52. autogluon/tabular/models/mitra/_internal/core/prediction_metrics.py +16 -21
  53. autogluon/tabular/models/mitra/_internal/core/trainer_finetune.py +130 -111
  54. autogluon/tabular/models/mitra/_internal/data/__init__.py +1 -1
  55. autogluon/tabular/models/mitra/_internal/data/collator.py +30 -26
  56. autogluon/tabular/models/mitra/_internal/data/dataset_finetune.py +18 -26
  57. autogluon/tabular/models/mitra/_internal/data/dataset_split.py +10 -7
  58. autogluon/tabular/models/mitra/_internal/data/preprocessor.py +70 -100
  59. autogluon/tabular/models/mitra/_internal/models/__init__.py +1 -1
  60. autogluon/tabular/models/mitra/_internal/models/base.py +7 -10
  61. autogluon/tabular/models/mitra/_internal/models/embedding.py +46 -56
  62. autogluon/tabular/models/mitra/_internal/models/tab2d.py +140 -120
  63. autogluon/tabular/models/mitra/_internal/utils/__init__.py +1 -1
  64. autogluon/tabular/models/mitra/_internal/utils/set_seed.py +3 -1
  65. autogluon/tabular/models/mitra/mitra_model.py +16 -11
  66. autogluon/tabular/models/mitra/sklearn_interface.py +178 -162
  67. autogluon/tabular/models/realmlp/realmlp_model.py +28 -15
  68. autogluon/tabular/models/rf/compilers/onnx.py +1 -1
  69. autogluon/tabular/models/rf/rf_model.py +45 -12
  70. autogluon/tabular/models/rf/rf_quantile.py +4 -2
  71. autogluon/tabular/models/tabdpt/tabdpt_model.py +8 -17
  72. autogluon/tabular/models/tabicl/tabicl_model.py +8 -1
  73. autogluon/tabular/models/tabm/_tabm_internal.py +6 -4
  74. autogluon/tabular/models/tabm/rtdl_num_embeddings.py +80 -127
  75. autogluon/tabular/models/tabm/tabm_model.py +8 -4
  76. autogluon/tabular/models/tabm/tabm_reference.py +53 -85
  77. autogluon/tabular/models/tabpfnmix/_internal/core/callbacks.py +7 -16
  78. autogluon/tabular/models/tabpfnmix/_internal/core/collator.py +16 -24
  79. autogluon/tabular/models/tabpfnmix/_internal/core/dataset_split.py +5 -7
  80. autogluon/tabular/models/tabpfnmix/_internal/core/enums.py +0 -2
  81. autogluon/tabular/models/tabpfnmix/_internal/core/get_loss.py +0 -1
  82. autogluon/tabular/models/tabpfnmix/_internal/core/get_optimizer.py +7 -18
  83. autogluon/tabular/models/tabpfnmix/_internal/core/get_scheduler.py +3 -14
  84. autogluon/tabular/models/tabpfnmix/_internal/core/trainer_finetune.py +79 -64
  85. autogluon/tabular/models/tabpfnmix/_internal/core/y_transformer.py +3 -5
  86. autogluon/tabular/models/tabpfnmix/_internal/data/dataset_finetune.py +17 -30
  87. autogluon/tabular/models/tabpfnmix/_internal/data/preprocessor.py +15 -35
  88. autogluon/tabular/models/tabpfnmix/_internal/models/foundation/embedding.py +21 -38
  89. autogluon/tabular/models/tabpfnmix/_internal/models/foundation/foundation_transformer.py +33 -51
  90. autogluon/tabular/models/tabpfnmix/_internal/results/prediction_metrics.py +4 -4
  91. autogluon/tabular/models/tabpfnmix/_internal/tabpfnmix_classifier.py +32 -12
  92. autogluon/tabular/models/tabpfnmix/_internal/tabpfnmix_regressor.py +32 -13
  93. autogluon/tabular/models/tabpfnmix/tabpfnmix_model.py +55 -19
  94. autogluon/tabular/models/tabpfnv2/tabpfnv2_5_model.py +21 -48
  95. autogluon/tabular/models/tabprep/prep_mixin.py +34 -26
  96. autogluon/tabular/models/tabular_nn/compilers/onnx.py +36 -8
  97. autogluon/tabular/models/tabular_nn/torch/tabular_nn_torch.py +130 -36
  98. autogluon/tabular/models/tabular_nn/torch/tabular_torch_dataset.py +8 -4
  99. autogluon/tabular/models/tabular_nn/torch/torch_network_modules.py +26 -5
  100. autogluon/tabular/models/tabular_nn/utils/categorical_encoders.py +41 -24
  101. autogluon/tabular/models/tabular_nn/utils/data_preprocessor.py +33 -8
  102. autogluon/tabular/models/tabular_nn/utils/nn_architecture_utils.py +21 -6
  103. autogluon/tabular/models/xgboost/callbacks.py +9 -3
  104. autogluon/tabular/models/xgboost/xgboost_model.py +59 -11
  105. autogluon/tabular/models/xt/xt_model.py +1 -0
  106. autogluon/tabular/predictor/interpretable_predictor.py +3 -1
  107. autogluon/tabular/predictor/predictor.py +409 -128
  108. autogluon/tabular/registry/__init__.py +1 -1
  109. autogluon/tabular/registry/_ag_model_registry.py +4 -5
  110. autogluon/tabular/registry/_model_registry.py +1 -0
  111. autogluon/tabular/testing/fit_helper.py +55 -15
  112. autogluon/tabular/testing/generate_datasets.py +1 -1
  113. autogluon/tabular/testing/model_fit_helper.py +10 -4
  114. autogluon/tabular/trainer/abstract_trainer.py +644 -230
  115. autogluon/tabular/trainer/auto_trainer.py +19 -8
  116. autogluon/tabular/trainer/model_presets/presets.py +33 -9
  117. autogluon/tabular/trainer/model_presets/presets_distill.py +16 -2
  118. autogluon/tabular/version.py +1 -1
  119. {autogluon_tabular-1.5.1b20260105.dist-info → autogluon_tabular-1.5.1b20260117.dist-info}/METADATA +27 -27
  120. {autogluon_tabular-1.5.1b20260105.dist-info → autogluon_tabular-1.5.1b20260117.dist-info}/RECORD +127 -135
  121. autogluon/tabular/models/tabpfnv2/rfpfn/__init__.py +0 -20
  122. autogluon/tabular/models/tabpfnv2/rfpfn/configs.py +0 -40
  123. autogluon/tabular/models/tabpfnv2/rfpfn/scoring_utils.py +0 -201
  124. autogluon/tabular/models/tabpfnv2/rfpfn/sklearn_based_decision_tree_tabpfn.py +0 -1464
  125. autogluon/tabular/models/tabpfnv2/rfpfn/sklearn_based_random_forest_tabpfn.py +0 -747
  126. autogluon/tabular/models/tabpfnv2/rfpfn/sklearn_compat.py +0 -863
  127. autogluon/tabular/models/tabpfnv2/rfpfn/utils.py +0 -106
  128. autogluon/tabular/models/tabpfnv2/tabpfnv2_model.py +0 -466
  129. /autogluon.tabular-1.5.1b20260105-py3.11-nspkg.pth → /autogluon.tabular-1.5.1b20260117-py3.11-nspkg.pth +0 -0
  130. {autogluon_tabular-1.5.1b20260105.dist-info → autogluon_tabular-1.5.1b20260117.dist-info}/WHEEL +0 -0
  131. {autogluon_tabular-1.5.1b20260105.dist-info → autogluon_tabular-1.5.1b20260117.dist-info}/licenses/LICENSE +0 -0
  132. {autogluon_tabular-1.5.1b20260105.dist-info → autogluon_tabular-1.5.1b20260117.dist-info}/licenses/NOTICE +0 -0
  133. {autogluon_tabular-1.5.1b20260105.dist-info → autogluon_tabular-1.5.1b20260117.dist-info}/namespace_packages.txt +0 -0
  134. {autogluon_tabular-1.5.1b20260105.dist-info → autogluon_tabular-1.5.1b20260117.dist-info}/top_level.txt +0 -0
  135. {autogluon_tabular-1.5.1b20260105.dist-info → autogluon_tabular-1.5.1b20260117.dist-info}/zip-safe +0 -0
@@ -16,8 +16,8 @@ from sklearn.impute import SimpleImputer
16
16
 
17
17
  from autogluon.common.utils.pandas_utils import get_approximate_df_mem_usage
18
18
  from autogluon.common.utils.resource_utils import ResourceManager
19
- from autogluon.tabular.models.abstract.abstract_torch_model import AbstractTorchModel
20
19
  from autogluon.tabular import __version__
20
+ from autogluon.tabular.models.abstract.abstract_torch_model import AbstractTorchModel
21
21
 
22
22
  logger = logging.getLogger(__name__)
23
23
 
@@ -48,6 +48,7 @@ class RealMLPModel(AbstractTorchModel):
48
48
 
49
49
  .. versionadded:: 1.4.0
50
50
  """
51
+
51
52
  ag_key = "REALMLP"
52
53
  ag_name = "RealMLP"
53
54
  ag_priority = 75
@@ -71,7 +72,7 @@ class RealMLPModel(AbstractTorchModel):
71
72
  )
72
73
 
73
74
  assert default_hyperparameters in ["td", "td_s"]
74
- if self.problem_type in ['binary', 'multiclass']:
75
+ if self.problem_type in ["binary", "multiclass"]:
75
76
  if default_hyperparameters == "td":
76
77
  model_cls = RealMLP_TD_Classifier
77
78
  else:
@@ -172,7 +173,11 @@ class RealMLPModel(AbstractTorchModel):
172
173
  name_categories = hyp.pop("name_categories", True)
173
174
 
174
175
  n_features = len(X.columns)
175
- if "predict_batch_size" in hyp and isinstance(hyp["predict_batch_size"], str) and hyp["predict_batch_size"] == "auto":
176
+ if (
177
+ "predict_batch_size" in hyp
178
+ and isinstance(hyp["predict_batch_size"], str)
179
+ and hyp["predict_batch_size"] == "auto"
180
+ ):
176
181
  # simple heuristic to avoid OOM during inference time
177
182
  # note: this isn't fool-proof, and ignores the actual memory availability of the machine.
178
183
  # note: this is based on an assumption of 32 GB of memory available on the instance
@@ -191,7 +196,7 @@ class RealMLPModel(AbstractTorchModel):
191
196
  # FIXME: In rare cases can cause exceptions if name_categories=False, unknown why
192
197
  extra_fit_kwargs = {}
193
198
  if name_categories:
194
- cat_col_names = X.select_dtypes(include='category').columns.tolist()
199
+ cat_col_names = X.select_dtypes(include="category").columns.tolist()
195
200
  extra_fit_kwargs["cat_col_names"] = cat_col_names
196
201
 
197
202
  if X_val is not None:
@@ -213,7 +218,9 @@ class RealMLPModel(AbstractTorchModel):
213
218
 
214
219
  # TODO: Move missing indicator + mean fill to a generic preprocess flag available to all models
215
220
  # FIXME: bool_to_cat is a hack: Maybe move to abstract model?
216
- def _preprocess(self, X: pd.DataFrame, is_train: bool = False, bool_to_cat: bool = False, impute_bool: bool = True, **kwargs) -> pd.DataFrame:
221
+ def _preprocess(
222
+ self, X: pd.DataFrame, is_train: bool = False, bool_to_cat: bool = False, impute_bool: bool = True, **kwargs
223
+ ) -> pd.DataFrame:
217
224
  """
218
225
  Imputes missing values via the mean and adds indicator columns for numerical features.
219
226
  Converts indicator columns to categorical features to avoid them being treated as numerical by RealMLP.
@@ -229,12 +236,18 @@ class RealMLPModel(AbstractTorchModel):
229
236
  self._features_to_impute = self._feature_metadata.get_features(valid_raw_types=["int", "float"])
230
237
  self._features_to_keep = self._feature_metadata.get_features(invalid_raw_types=["int", "float"])
231
238
  else:
232
- self._features_to_impute = self._feature_metadata.get_features(valid_raw_types=["int", "float"], invalid_special_types=["bool"])
233
- self._features_to_keep = [f for f in self._feature_metadata.get_features() if f not in self._features_to_impute]
239
+ self._features_to_impute = self._feature_metadata.get_features(
240
+ valid_raw_types=["int", "float"], invalid_special_types=["bool"]
241
+ )
242
+ self._features_to_keep = [
243
+ f for f in self._feature_metadata.get_features() if f not in self._features_to_impute
244
+ ]
234
245
  if self._features_to_impute:
235
246
  self._imputer = SimpleImputer(strategy="mean", add_indicator=True)
236
247
  self._imputer.fit(X=X[self._features_to_impute])
237
- self._indicator_columns = [c for c in self._imputer.get_feature_names_out() if c not in self._features_to_impute]
248
+ self._indicator_columns = [
249
+ c for c in self._imputer.get_feature_names_out() if c not in self._features_to_impute
250
+ ]
238
251
  if self._imputer is not None:
239
252
  X_impute = self._imputer.transform(X=X[self._features_to_impute])
240
253
  X_impute = pd.DataFrame(X_impute, index=X.index, columns=self._imputer.get_feature_names_out())
@@ -254,23 +267,17 @@ class RealMLPModel(AbstractTorchModel):
254
267
  use_early_stopping=False,
255
268
  early_stopping_additive_patience=40,
256
269
  early_stopping_multiplicative_patience=3,
257
-
258
270
  # verdict: use_ls="auto" is much better than None.
259
271
  use_ls="auto",
260
-
261
272
  # verdict: no impact, but makes more sense to be False.
262
273
  impute_bool=False,
263
-
264
274
  # verdict: name_categories=True avoids random exceptions being raised in rare cases
265
275
  name_categories=True,
266
-
267
276
  # verdict: bool_to_cat=True is equivalent to False in terms of quality, but can be slightly faster in training time
268
277
  # and slightly slower in inference time
269
278
  bool_to_cat=True,
270
-
271
279
  # verdict: "td" is better than "td_s"
272
280
  default_hyperparameters="td", # options ["td", "td_s"]
273
-
274
281
  predict_batch_size="auto", # if auto, uses AutoGluon's heuristic to set a value between 8192 and 64.
275
282
  )
276
283
  for param, val in default_params.items():
@@ -293,7 +300,13 @@ class RealMLPModel(AbstractTorchModel):
293
300
 
294
301
  def _estimate_memory_usage(self, X: pd.DataFrame, **kwargs) -> int:
295
302
  hyperparameters = self._get_model_params()
296
- return self.estimate_memory_usage_static(X=X, problem_type=self.problem_type, num_classes=self.num_classes, hyperparameters=hyperparameters, **kwargs)
303
+ return self.estimate_memory_usage_static(
304
+ X=X,
305
+ problem_type=self.problem_type,
306
+ num_classes=self.num_classes,
307
+ hyperparameters=hyperparameters,
308
+ **kwargs,
309
+ )
297
310
 
298
311
  @classmethod
299
312
  def _estimate_memory_usage_static(
@@ -83,7 +83,7 @@ class RFOnnxCompiler:
83
83
  The compiler would optimize the model to perform best with the given input type.
84
84
  """
85
85
  if input_types is None or not isinstance(input_types[0], tuple):
86
- raise RuntimeError("input_types argument should contain at least one tuple" ", e.g. [((1, 14), np.float32)]")
86
+ raise RuntimeError("input_types argument should contain at least one tuple, e.g. [((1, 14), np.float32)]")
87
87
  if isinstance(model, RFOnnxPredictor):
88
88
  return model
89
89
 
@@ -27,6 +27,7 @@ class RFModel(AbstractModel):
27
27
  """
28
28
  Random Forest model (scikit-learn): https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html
29
29
  """
30
+
30
31
  ag_key = "RF"
31
32
  ag_name = "RandomForest"
32
33
  ag_priority = 80
@@ -135,7 +136,13 @@ class RFModel(AbstractModel):
135
136
 
136
137
  def _estimate_memory_usage(self, X: pd.DataFrame, **kwargs) -> int:
137
138
  hyperparameters = self._get_model_params()
138
- return self.estimate_memory_usage_static(X=X, problem_type=self.problem_type, num_classes=self.num_classes, hyperparameters=hyperparameters, **kwargs)
139
+ return self.estimate_memory_usage_static(
140
+ X=X,
141
+ problem_type=self.problem_type,
142
+ num_classes=self.num_classes,
143
+ hyperparameters=hyperparameters,
144
+ **kwargs,
145
+ )
139
146
 
140
147
  @classmethod
141
148
  def _estimate_memory_usage_static(
@@ -154,14 +161,25 @@ class RFModel(AbstractModel):
154
161
  n_estimators = n_estimators_final
155
162
  else: # if search space
156
163
  n_estimators = 40
157
- num_trees_per_estimator = cls._get_num_trees_per_estimator_static(problem_type=problem_type, num_classes=num_classes)
164
+ num_trees_per_estimator = cls._get_num_trees_per_estimator_static(
165
+ problem_type=problem_type, num_classes=num_classes
166
+ )
158
167
  bytes_per_estimator = num_trees_per_estimator * len(X) / 60000 * 1e6 # Underestimates by 3x on ExtraTrees
159
168
  expected_memory_usage = int(bytes_per_estimator * n_estimators)
160
169
  return expected_memory_usage
161
170
 
162
- def _validate_fit_memory_usage(self, mem_error_threshold: float = 0.5, mem_warning_threshold: float = 0.4, mem_size_threshold: int = 1e7, **kwargs):
171
+ def _validate_fit_memory_usage(
172
+ self,
173
+ mem_error_threshold: float = 0.5,
174
+ mem_warning_threshold: float = 0.4,
175
+ mem_size_threshold: int = 1e7,
176
+ **kwargs,
177
+ ):
163
178
  return super()._validate_fit_memory_usage(
164
- mem_error_threshold=mem_error_threshold, mem_warning_threshold=mem_warning_threshold, mem_size_threshold=mem_size_threshold, **kwargs
179
+ mem_error_threshold=mem_error_threshold,
180
+ mem_warning_threshold=mem_warning_threshold,
181
+ mem_size_threshold=mem_size_threshold,
182
+ **kwargs,
165
183
  )
166
184
 
167
185
  def _expected_mem_usage(self, n_estimators_final, bytes_per_estimator):
@@ -194,7 +212,9 @@ class RFModel(AbstractModel):
194
212
  n_estimator_increments = [n_estimators_test, n_estimators_final]
195
213
  params["warm_start"] = True
196
214
  else:
197
- if expected_memory_usage > (0.05 * max_memory_usage_ratio): # Somewhat arbitrary, consider finding a better value, should it scale by cores?
215
+ if expected_memory_usage > (
216
+ 0.05 * max_memory_usage_ratio
217
+ ): # Somewhat arbitrary, consider finding a better value, should it scale by cores?
198
218
  # Causes ~10% training slowdown, so try to avoid if memory is not an issue
199
219
  n_estimator_increments = [n_estimators_test, n_estimators_final]
200
220
  params["warm_start"] = True
@@ -218,7 +238,9 @@ class RFModel(AbstractModel):
218
238
  model = model_cls(**params)
219
239
  model = model.fit(X, y, sample_weight=sample_weight)
220
240
  if (i == 0) and (len(n_estimator_increments) > 1):
221
- time_elapsed = max(time.time() - time_train_start, 0.001) # avoid it being too small and being truncated to 0
241
+ time_elapsed = max(
242
+ time.time() - time_train_start, 0.001
243
+ ) # avoid it being too small and being truncated to 0
222
244
  model_size_bytes = 0
223
245
  for estimator in model.estimators_: # Uses far less memory than pickling the entire forest at once
224
246
  model_size_bytes += sys.getsizeof(pickle.dumps(estimator))
@@ -227,19 +249,25 @@ class RFModel(AbstractModel):
227
249
  model_memory_ratio = expected_final_model_size_bytes / available_mem
228
250
 
229
251
  ideal_memory_ratio = 0.15 * max_memory_usage_ratio
230
- n_estimators_ideal = min(n_estimators_final, math.floor(ideal_memory_ratio / model_memory_ratio * n_estimators_final))
252
+ n_estimators_ideal = min(
253
+ n_estimators_final, math.floor(ideal_memory_ratio / model_memory_ratio * n_estimators_final)
254
+ )
231
255
 
232
256
  if n_estimators_final > n_estimators_ideal:
233
257
  if n_estimators_ideal < n_estimators_minimum:
234
- logger.warning(f"\tWarning: Model is expected to require {round(model_memory_ratio*100, 2)}% of available memory...")
258
+ logger.warning(
259
+ f"\tWarning: Model is expected to require {round(model_memory_ratio * 100, 2)}% of available memory..."
260
+ )
235
261
  raise NotEnoughMemoryError # don't train full model to avoid OOM error
236
262
  logger.warning(
237
- f"\tWarning: Reducing model 'n_estimators' from {n_estimators_final} -> {n_estimators_ideal} due to low memory. Expected memory usage reduced from {round(model_memory_ratio*100, 2)}% -> {round(ideal_memory_ratio*100, 2)}% of available memory..."
263
+ f"\tWarning: Reducing model 'n_estimators' from {n_estimators_final} -> {n_estimators_ideal} due to low memory. Expected memory usage reduced from {round(model_memory_ratio * 100, 2)}% -> {round(ideal_memory_ratio * 100, 2)}% of available memory..."
238
264
  )
239
265
 
240
266
  if time_limit is not None:
241
267
  time_expected = time_train_start - time_start + (time_elapsed * n_estimators_ideal / n_estimators)
242
- n_estimators_time = math.floor((time_limit - time_train_start + time_start) * n_estimators / time_elapsed)
268
+ n_estimators_time = math.floor(
269
+ (time_limit - time_train_start + time_start) * n_estimators / time_elapsed
270
+ )
243
271
  if n_estimators_time < n_estimators_ideal:
244
272
  if n_estimators_time < n_estimators_minimum:
245
273
  logger.warning(
@@ -293,9 +321,14 @@ class RFModel(AbstractModel):
293
321
  # FIXME: Unknown if this works with quantile regression
294
322
  def _predict_proba_oof(self, X, y, **kwargs):
295
323
  if not self.model.bootstrap:
296
- raise ValueError("Forest models must set `bootstrap=True` to compute out-of-fold predictions via out-of-bag predictions.")
324
+ raise ValueError(
325
+ "Forest models must set `bootstrap=True` to compute out-of-fold predictions via out-of-bag predictions."
326
+ )
297
327
 
298
- oob_is_not_set = getattr(self.model, "oob_decision_function_", None) is None and getattr(self.model, "oob_prediction_", None) is None
328
+ oob_is_not_set = (
329
+ getattr(self.model, "oob_decision_function_", None) is None
330
+ and getattr(self.model, "oob_prediction_", None) is None
331
+ )
299
332
 
300
333
  if oob_is_not_set and self._daal:
301
334
  raise AssertionError("DAAL forest backend does not support out-of-bag predictions.")
@@ -85,7 +85,7 @@ def weighted_percentile(a, q, weights=None, sorter=None, is_filtered=False):
85
85
  if weights is None:
86
86
  weights = np.ones_like(a)
87
87
  if q > 100 or q < 0:
88
- raise ValueError("q should be in-between 0 and 100, " "got %d" % q)
88
+ raise ValueError("q should be in-between 0 and 100, got %d" % q)
89
89
 
90
90
  a = np.asarray(a, dtype=np.float32)
91
91
  weights = np.asarray(weights, dtype=np.float32)
@@ -555,7 +555,9 @@ class BaseForestQuantileRegressor(ForestRegressor):
555
555
  samples_with_weighted_neighbors = get_weighted_neighbors_dataframe(
556
556
  X_leaves=X_leaves, y_train_leaves=self.y_train_leaves_, y_train=self.y_train_, y_weights=self.y_weights_
557
557
  )
558
- quantile_preds = samples_with_weighted_neighbors.groupby("item_id").apply(partial(get_quantiles, quantile_levels=quantile_levels), include_groups=False)
558
+ quantile_preds = samples_with_weighted_neighbors.groupby("item_id").apply(
559
+ partial(get_quantiles, quantile_levels=quantile_levels), include_groups=False
560
+ )
559
561
  return np.stack(quantile_preds.values.tolist())
560
562
 
561
563
 
@@ -64,11 +64,7 @@ class TabDPTModel(AbstractTorchModel):
64
64
  )
65
65
  from tabdpt import TabDPTClassifier, TabDPTRegressor
66
66
 
67
- model_cls = (
68
- TabDPTClassifier
69
- if self.problem_type in [BINARY, MULTICLASS]
70
- else TabDPTRegressor
71
- )
67
+ model_cls = TabDPTClassifier if self.problem_type in [BINARY, MULTICLASS] else TabDPTRegressor
72
68
  fit_params, self._predict_hps = self._get_tabdpt_params(num_gpus=num_gpus)
73
69
 
74
70
  X = self.preprocess(X)
@@ -117,6 +113,9 @@ class TabDPTModel(AbstractTorchModel):
117
113
  if not torch.cuda.is_available():
118
114
  return False
119
115
 
116
+ if not torch.backends.cuda.is_flash_attention_available():
117
+ return False
118
+
120
119
  device = torch.device("cuda:0")
121
120
  capability = torch.cuda.get_device_capability(device)
122
121
 
@@ -147,9 +146,7 @@ class TabDPTModel(AbstractTorchModel):
147
146
 
148
147
  return num_cpus, num_gpus
149
148
 
150
- def get_minimum_resources(
151
- self, is_gpu_available: bool = False
152
- ) -> dict[str, int | float]:
149
+ def get_minimum_resources(self, is_gpu_available: bool = False) -> dict[str, int | float]:
153
150
  return {
154
151
  "num_cpus": 1,
155
152
  "num_gpus": 0.5 if is_gpu_available else 0,
@@ -173,9 +170,7 @@ class TabDPTModel(AbstractTorchModel):
173
170
  self._feature_generator.fit(X=X)
174
171
  if self._feature_generator.features_in:
175
172
  X = X.copy()
176
- X[self._feature_generator.features_in] = self._feature_generator.transform(
177
- X=X
178
- )
173
+ X[self._feature_generator.features_in] = self._feature_generator.transform(X=X)
179
174
  return X.to_numpy()
180
175
 
181
176
  @classmethod
@@ -232,14 +227,10 @@ class TabDPTModel(AbstractTorchModel):
232
227
  model_mem = 14489108 # Based on TabPFNv2 default
233
228
 
234
229
  n_samples, n_features = X.shape[0], min(X.shape[1], 500)
235
- n_feature_groups = (
236
- n_features
237
- ) / features_per_group + 1 # TODO: Unsure how to calculate this
230
+ n_feature_groups = (n_features) / features_per_group + 1 # TODO: Unsure how to calculate this
238
231
 
239
232
  X_mem = n_samples * n_feature_groups * dtype_byte_size
240
- activation_mem = (
241
- n_samples * n_feature_groups * embedding_size * n_layers * dtype_byte_size
242
- )
233
+ activation_mem = n_samples * n_feature_groups * embedding_size * n_layers * dtype_byte_size
243
234
 
244
235
  baseline_overhead_mem_est = 1e9 # 1 GB generic overhead
245
236
 
@@ -32,6 +32,7 @@ class TabICLModel(AbstractTorchModel):
32
32
 
33
33
  .. versionadded:: 1.4.0
34
34
  """
35
+
35
36
  ag_key = "TABICL"
36
37
  ag_name = "TabICL"
37
38
  ag_priority = 65
@@ -133,7 +134,13 @@ class TabICLModel(AbstractTorchModel):
133
134
 
134
135
  def _estimate_memory_usage(self, X: pd.DataFrame, **kwargs) -> int:
135
136
  hyperparameters = self._get_model_params()
136
- return self.estimate_memory_usage_static(X=X, problem_type=self.problem_type, num_classes=self.num_classes, hyperparameters=hyperparameters, **kwargs)
137
+ return self.estimate_memory_usage_static(
138
+ X=X,
139
+ problem_type=self.problem_type,
140
+ num_classes=self.num_classes,
141
+ hyperparameters=hyperparameters,
142
+ **kwargs,
143
+ )
137
144
 
138
145
  @classmethod
139
146
  def _estimate_memory_usage_static(
@@ -212,10 +212,12 @@ class TabMImplementation:
212
212
  ) # Unique ordinal encoder -> replaces nan and missing values with the cardinality
213
213
  self.ord_enc_.fit(X_train[self.cat_col_names_])
214
214
  # TODO: fix transformer to be able to work with empty input data like the sklearn default
215
- self.num_prep_ = Pipeline(steps=[
216
- ("qt", RTDLQuantileTransformer(random_state=self.config.get("random_state", None))),
217
- ("imp", SimpleImputer(add_indicator=True)),
218
- ])
215
+ self.num_prep_ = Pipeline(
216
+ steps=[
217
+ ("qt", RTDLQuantileTransformer(random_state=self.config.get("random_state", None))),
218
+ ("imp", SimpleImputer(add_indicator=True)),
219
+ ]
220
+ )
219
221
  self.has_num_cols = bool(set(X_train.columns) - set(cat_col_names))
220
222
  for part, X, y in [("train", X_train, y_train), ("val", X_val, y_val)]:
221
223
  tensors = dict()