pytabkit.models package
Subpackages
- pytabkit.models.alg_interfaces package
- Submodules
- pytabkit.models.alg_interfaces.alg_interfaces module
AlgInterfaceAlgInterface.__init__()AlgInterface.eval()AlgInterface.fit()AlgInterface.fit_and_eval()AlgInterface.get_available_predict_params()AlgInterface.get_current_predict_params_dict()AlgInterface.get_current_predict_params_name()AlgInterface.get_fit_params()AlgInterface.get_refit_interface()AlgInterface.get_required_resources()AlgInterface.predict()AlgInterface.set_current_predict_params()AlgInterface.to()
MultiSplitWrapperAlgInterfaceMultiSplitWrapperAlgInterface.__init__()MultiSplitWrapperAlgInterface.fit()MultiSplitWrapperAlgInterface.fit_and_eval()MultiSplitWrapperAlgInterface.get_available_predict_params()MultiSplitWrapperAlgInterface.get_refit_interface()MultiSplitWrapperAlgInterface.get_required_resources()MultiSplitWrapperAlgInterface.predict()MultiSplitWrapperAlgInterface.set_current_predict_params()
OptAlgInterfaceRandomParamsAlgInterfaceSingleSplitAlgInterface
- pytabkit.models.alg_interfaces.autogluon_model_interfaces module
- pytabkit.models.alg_interfaces.base module
- pytabkit.models.alg_interfaces.calibration module
- pytabkit.models.alg_interfaces.catboost_interfaces module
- pytabkit.models.alg_interfaces.ensemble_interfaces module
- pytabkit.models.alg_interfaces.lightgbm_interfaces module
- pytabkit.models.alg_interfaces.nn_interfaces module
NNAlgInterfaceNNAlgInterface.__init__()NNAlgInterface.fit()NNAlgInterface.get_available_predict_params()NNAlgInterface.get_first_layer_weights()NNAlgInterface.get_importances()NNAlgInterface.get_model_ram_gb()NNAlgInterface.get_refit_interface()NNAlgInterface.get_required_resources()NNAlgInterface.predict()NNAlgInterface.to()
NNHyperoptAlgInterfaceRandomParamsNNAlgInterfaceRealMLPParamSamplerget_lignting_accel_and_devices()
- pytabkit.models.alg_interfaces.other_interfaces module
ExtraTreesSubSplitInterfaceGBTSubSplitInterfaceGrandeSubSplitInterfaceGrandeWrapperKANSubSplitInterfaceKNNSubSplitInterfaceLinearModelSubSplitInterfaceRFSubSplitInterfaceRandomParamsExtraTreesAlgInterfaceRandomParamsKNNAlgInterfaceRandomParamsLinearModelAlgInterfaceRandomParamsRFAlgInterfaceSklearnMLPSubSplitInterfaceTabICLSubSplitInterfaceTabPFN2SubSplitInterface
- pytabkit.models.alg_interfaces.resource_computation module
- pytabkit.models.alg_interfaces.resource_params module
- pytabkit.models.alg_interfaces.rtdl_interfaces module
FTTransformerSubSplitInterfaceRTDL_MLPSubSplitInterfaceRTDL_MLP_ParamSamplerNewRTDL_ResNet_ParamSamplerRTDL_ResNet_ParamSamplerNewRandomParamsFTTransformerAlgInterfaceRandomParamsRTDLMLPAlgInterfaceRandomParamsResnetAlgInterfaceResnetSubSplitInterfaceSkorchSubSplitInterfaceallow_single_underscore()choose_batch_size_rtdl()choose_batch_size_rtdl_new()
- pytabkit.models.alg_interfaces.sub_split_interfaces module
SingleSplitWrapperAlgInterfaceSingleSplitWrapperAlgInterface.__init__()SingleSplitWrapperAlgInterface.fit()SingleSplitWrapperAlgInterface.get_available_predict_params()SingleSplitWrapperAlgInterface.get_refit_interface()SingleSplitWrapperAlgInterface.get_required_resources()SingleSplitWrapperAlgInterface.predict()SingleSplitWrapperAlgInterface.set_current_predict_params()
SklearnSubSplitInterfaceTreeBasedSubSplitInterface
- pytabkit.models.alg_interfaces.tabm_interface module
- pytabkit.models.alg_interfaces.tabr_interface module
- pytabkit.models.alg_interfaces.xgboost_interfaces module
- pytabkit.models.alg_interfaces.xrfm_interfaces module
- Module contents
- pytabkit.models.data package
- Submodules
- pytabkit.models.data.conversion module
- pytabkit.models.data.data module
- pytabkit.models.data.nested_dict module
- pytabkit.models.data.splits module
- Module contents
- pytabkit.models.hyper_opt package
- pytabkit.models.nn_models package
- Submodules
- pytabkit.models.nn_models.activations module
- pytabkit.models.nn_models.base module
BiasLayerConcatParallelFactoryConcatParallelFitterConcatParallelLayerContextAwareContextRecorderFilterTensorsFactoryFilterTensorsLayerFitterFitterFactoryFunctionFactoryFunctionFitterFunctionLayerIdentityFactoryIdentityFitterIdentityLayerLayerRenameTensorFactoryRenameTensorLayerResidualFitterResidualLayerScaleLayerScopeSequentialFactorySequentialFitterSequentialLayerStringConvertibleTrainContextVariableWeightLayerset_hp_context()set_scope_context()sub_scope_context()sub_scopes_context()
- pytabkit.models.nn_models.categorical module
ConstantFunctionEncodingFactoryEncodingFitterEncodingLayerSingleEmbeddingFactorySingleEmbeddingFitterSingleEmbeddingLayerSingleEncodingFactorySingleOneHotFactorySingleOneHotFitterSingleOneHotLayerSingleOrdinalEncodingFactorySingleOrdinalEncodingFitterSingleOrdinalEncodingLayerSingleTargetEncodingFactorySingleTargetEncodingFitterfastai_emb_size_fn()get_embedding_size()
- pytabkit.models.nn_models.models module
- pytabkit.models.nn_models.nn module
AntisymmetricInitializationFactoryAntisymmetricInitializationFitterBiasFitterClampLayerClampOutputFactoryDropoutFitterDropoutLayerFeatureImportanceFactoryFixedScaleFactoryFixedWeightFactoryLabelSmoothingFactoryLabelSmoothingFitterLabelSmoothingLayerNoiseFitterNoiseLayerNormWeightLayerNormalizeOutputFactoryNormalizeOutputLayerPLREmbeddingsFactoryPLREmbeddingsLayerPLREmbeddingsLayerCosBiasPeriodicEmbeddingsFactoryPeriodicEmbeddingsLayerSinCosRFFeatureImportanceFactoryScaleFactoryScaleFitterStochasticGateFactoryStochasticGateLayerStochasticLabelNoiseFactoryStochasticLabelNoiseFitterStochasticLabelNoiseLayerSubtractionLayerToSoftLabelFitterToSoftLabelLayerWeightFitter
- pytabkit.models.nn_models.pipeline module
CircleCodingFactoryCircleCodingLayerGlobalScaleNormalizeFactoryL1NormalizeFactoryL2NormalizeFactoryMeanCenterFactoryMeanReplaceMissingContFactoryMedianCenterFactoryMinMaxScaleFactoryReplaceMissingContLayerRobustScaleFactoryRobustScaleV2FactorySklearnTransformFactorySklearnTransformLayerThermometerCodingFactoryThermometerCodingLayerapply_tfms_rec()
- pytabkit.models.nn_models.rtdl_num_embeddings module
- pytabkit.models.nn_models.rtdl_resnet module
EarlyStoppingCustomErrorFT_TransformerInputShapeSetterResnetLearningRateLoggerMultiheadAttentionMyCustomErrorNeuralNetClassifierCustomOptimNeuralNetClassifierWrappedNeuralNetClassifierWrapped.__init__()NeuralNetClassifierWrapped.fit()NeuralNetClassifierWrapped.get_default_callbacks()NeuralNetClassifierWrapped.partial_fit()NeuralNetClassifierWrapped.set_categorical_indicator()NeuralNetClassifierWrapped.set_n_classes()NeuralNetClassifierWrapped.set_partial_fit_request()NeuralNetClassifierWrapped.set_score_request()
NeuralNetRegressorCustomOptimNeuralNetRegressorWrappedNeuralNetRegressorWrapped.__init__()NeuralNetRegressorWrapped.fit()NeuralNetRegressorWrapped.get_default_callbacks()NeuralNetRegressorWrapped.partial_fit()NeuralNetRegressorWrapped.predict()NeuralNetRegressorWrapped.set_categorical_indicator()NeuralNetRegressorWrapped.set_partial_fit_request()NeuralNetRegressorWrapped.set_predict_mean()NeuralNetRegressorWrapped.set_score_request()NeuralNetRegressorWrapped.set_y_train_mean()
RTDL_MLPResNetTokenizerUniquePrefixCheckpointcreate_classifier_skorch()create_ft_transformer_classifier_skorch()create_ft_transformer_regressor_skorch()create_mlp_classifier_skorch()create_mlp_regressor_skorch()create_regressor_skorch()create_resnet_classifier_skorch()create_resnet_regressor_skorch()geglu()get_activation_fn()get_nonglu_activation_fn()initialize_optimizer_ft_transformer()mse_constant_predictor()print_but_serializable()reglu()
- pytabkit.models.nn_models.tabm module
- pytabkit.models.nn_models.tabr module
- pytabkit.models.nn_models.tabr_context_freeze module
TabrLightningContextFreezeTabrLightningContextFreeze.__init__()TabrLightningContextFreeze.apply_model()TabrLightningContextFreeze.configure_optimizers()TabrLightningContextFreeze.evaluate()TabrLightningContextFreeze.get_Xy()TabrLightningContextFreeze.predict_step()TabrLightningContextFreeze.setup()TabrLightningContextFreeze.train_dataloader()TabrLightningContextFreeze.training_step()TabrLightningContextFreeze.val_dataloader()TabrLightningContextFreeze.validation_step()
TabrModelContextFreezezero_wd_condition()
- pytabkit.models.nn_models.tabr_lib module
CLSEmbeddingCatEmbeddingsLREmbeddingsLambdaLinearEmbeddingsMLPNLinearOneHotEncoderPBLDEmbeddingsPLREmbeddingsPeriodicEmbeddingscat()default_zero_weight_decay_condition()get_d_out()get_lr()get_n_parameters()is_oom_exception()iter_batches()make_module()make_optimizer()make_parameter_groups()make_trainable_vector()register_module()set_lr()
- Module contents
- pytabkit.models.optim package
- Submodules
- pytabkit.models.optim.adopt module
- pytabkit.models.optim.optimizers module
- pytabkit.models.optim.scheduling_adam module
- Module contents
- pytabkit.models.sklearn package
- Submodules
- pytabkit.models.sklearn.default_params module
DefaultParamsDefaultParams.CB_DDefaultParams.CB_TD_CLASSDefaultParams.CB_TD_REGDefaultParams.FTT_D_CLASSDefaultParams.FTT_D_REGDefaultParams.LGBM_DDefaultParams.LGBM_TD_CLASSDefaultParams.LGBM_TD_REGDefaultParams.MLP_PLR_D_CLASSDefaultParams.MLP_PLR_D_REGDefaultParams.MLP_RTDL_D_CLASS_GrinsztajnDefaultParams.MLP_RTDL_D_CLASS_TabZillaDefaultParams.MLP_RTDL_D_REG_GrinsztajnDefaultParams.MLP_RTDL_D_REG_TabZillaDefaultParams.MLP_SKL_DDefaultParams.RESNET_RTDL_D_CLASS_GrinsztajnDefaultParams.RESNET_RTDL_D_CLASS_TabZillaDefaultParams.RESNET_RTDL_D_REG_GrinsztajnDefaultParams.RESNET_RTDL_D_REG_TabZillaDefaultParams.RF_SKL_DDefaultParams.RealMLP_TD_CLASSDefaultParams.RealMLP_TD_REGDefaultParams.RealMLP_TD_S_CLASSDefaultParams.RealMLP_TD_S_REGDefaultParams.RealTABR_D_CLASSDefaultParams.RealTABR_D_REGDefaultParams.TABM_D_CLASSDefaultParams.TABM_D_REGDefaultParams.TABR_S_D_CLASSDefaultParams.TABR_S_D_CLASS_FREEZEDefaultParams.TABR_S_D_REGDefaultParams.TABR_S_D_REG_FREEZEDefaultParams.VANILLA_MLP_CLASSDefaultParams.VANILLA_MLP_REGDefaultParams.XGB_DDefaultParams.XGB_PBB_CLASSDefaultParams.XGB_TD_CLASSDefaultParams.XGB_TD_REGDefaultParams.XRFM_D_CLASSDefaultParams.XRFM_D_REG
- pytabkit.models.sklearn.sklearn_base module
- pytabkit.models.sklearn.sklearn_interfaces module
CatBoost_D_ClassifierCatBoost_D_RegressorCatBoost_HPO_ClassifierCatBoost_HPO_RegressorCatBoost_HPO_TPE_ClassifierCatBoost_HPO_TPE_RegressorCatBoost_TD_ClassifierCatBoost_TD_RegressorEnsemble_HPO_ClassifierEnsemble_HPO_RegressorEnsemble_TD_ClassifierEnsemble_TD_RegressorFTT_D_ClassifierFTT_D_RegressorFTT_HPO_ClassifierFTT_HPO_RegressorLGBM_D_ClassifierLGBM_D_RegressorLGBM_HPO_ClassifierLGBM_HPO_RegressorLGBM_HPO_TPE_ClassifierLGBM_HPO_TPE_RegressorLGBM_TD_ClassifierLGBM_TD_RegressorMLP_PLR_D_ClassifierMLP_PLR_D_RegressorMLP_PLR_HPO_ClassifierMLP_PLR_HPO_RegressorMLP_RTDL_D_ClassifierMLP_RTDL_D_RegressorMLP_RTDL_HPO_ClassifierMLP_RTDL_HPO_RegressorMLP_SKL_D_ClassifierMLP_SKL_D_RegressorRF_HPO_ClassifierRF_HPO_RegressorRF_SKL_D_ClassifierRF_SKL_D_RegressorRealMLP_HPO_ClassifierRealMLP_HPO_RegressorRealMLP_TD_ClassifierRealMLP_TD_RegressorRealMLP_TD_S_ClassifierRealMLP_TD_S_RegressorRealTabR_D_ClassifierRealTabR_D_RegressorResnet_RTDL_D_ClassifierResnet_RTDL_D_RegressorResnet_RTDL_HPO_ClassifierResnet_RTDL_HPO_RegressorTabM_D_ClassifierTabM_D_RegressorTabM_HPO_ClassifierTabM_HPO_RegressorTabR_HPO_ClassifierTabR_HPO_RegressorTabR_S_D_ClassifierTabR_S_D_RegressorXGB_D_ClassifierXGB_D_RegressorXGB_HPO_ClassifierXGB_HPO_RegressorXGB_HPO_TPE_ClassifierXGB_HPO_TPE_RegressorXGB_PBB_D_ClassifierXGB_TD_ClassifierXGB_TD_RegressorXRFM_D_ClassifierXRFM_D_RegressorXRFM_HPO_ClassifierXRFM_HPO_Regressor
- Module contents
- pytabkit.models.training package
- Submodules
- pytabkit.models.training.auc_mu module
- pytabkit.models.training.coord module
- pytabkit.models.training.lightning_callbacks module
- pytabkit.models.training.lightning_modules module
TabNNModuleTabNNModule.__init__()TabNNModule.compile_model()TabNNModule.configure_optimizers()TabNNModule.create_callbacks()TabNNModule.get_predict_dataloader()TabNNModule.on_fit_end()TabNNModule.on_fit_start()TabNNModule.on_predict_model_eval()TabNNModule.on_test_model_eval()TabNNModule.on_test_model_train()TabNNModule.on_validation_epoch_end()TabNNModule.on_validation_model_eval()TabNNModule.on_validation_model_train()TabNNModule.on_validation_start()TabNNModule.predict_step()TabNNModule.restore_ckpt_for_val_metric_name()TabNNModule.to()TabNNModule.training_step()TabNNModule.validation_step()
postprocess_multiquantile()
- pytabkit.models.training.logging module
- pytabkit.models.training.metrics module
- pytabkit.models.training.nn_creator module
- pytabkit.models.training.scheduling module
AltCoslogFuncConstantScheduleCoslogFuncEpochLengthSqMomScheduleExponentialScheduleFirstToLastScheduleFunctionScheduleGenCoslogFuncLearnerProgressProductSchedule_ProductTimeSchedule_ScaledScheduleScheduleScheduleSequenceStepFunctionScheduleSumSchedule_SumTimeSchedule_TimeSchedulecombine_scheds()connect_cos_scheds()connect_lin_scheds()cos_func()cos_warm_func()get_cos_sched()get_cos_warm_sched()get_id_sched()get_lin_sched()get_schedule()identity_func()lin_func()sched_prod()sched_sum()
- Module contents
Submodules
pytabkit.models.torch_utils module
- class pytabkit.models.torch_utils.ClampWithIdentityGradientFunc
Bases:
Function- static backward(ctx, grad_output)
Define a formula for differentiating the operation with backward mode automatic differentiation.
This function is to be overridden by all subclasses. (Defining this function is equivalent to defining the
vjpfunction.)It must accept a context
ctxas the first argument, followed by as many outputs as theforward()returned (None will be passed in for non tensor outputs of the forward function), and it should return as many tensors, as there were inputs toforward(). Each argument is the gradient w.r.t the given output, and each returned value should be the gradient w.r.t. the corresponding input. If an input is not a Tensor or is a Tensor not requiring grads, you can just pass None as a gradient for that input.The context can be used to retrieve tensors saved during the forward pass. It also has an attribute
ctx.needs_input_gradas a tuple of booleans representing whether each input needs gradient. E.g.,backward()will havectx.needs_input_grad[0] = Trueif the first input toforward()needs gradient computed w.r.t. the output.- Parameters:
grad_output (Tensor)
- static forward(ctx, input, low, high)
Define the forward of the custom autograd Function.
This function is to be overridden by all subclasses. There are two ways to define forward:
Usage 1 (Combined forward and ctx):
@staticmethod def forward(ctx: Any, *args: Any, **kwargs: Any) -> Any: pass
It must accept a context ctx as the first argument, followed by any number of arguments (tensors or other types).
See combining-forward-context for more details
Usage 2 (Separate forward and ctx):
@staticmethod def forward(*args: Any, **kwargs: Any) -> Any: pass @staticmethod def setup_context(ctx: Any, inputs: Tuple[Any, ...], output: Any) -> None: pass
The forward no longer accepts a ctx argument.
Instead, you must also override the
torch.autograd.Function.setup_context()staticmethod to handle setting up thectxobject.outputis the output of the forward,inputsare a Tuple of inputs to the forward.See extending-autograd for more details
The context can be used to store arbitrary data that can be then retrieved during the backward pass. Tensors should not be stored directly on ctx (though this is not currently enforced for backward compatibility). Instead, tensors should be saved either with
ctx.save_for_backward()if they are intended to be used inbackward(equivalently,vjp) orctx.save_for_forward()if they are intended to be used for injvp.- Parameters:
input (Tensor)
low (Tensor)
high (Tensor)
- class pytabkit.models.torch_utils.TorchTimer
Bases:
objectTimer for measuring code blocks, with optional CUDA synchronization.
- Usage:
- with TorchTimer() as t:
y = model(x)
print(t.elapsed)
# Or manual start/stop: t = TorchTimer() t.start() y = model(x) t.stop() print(t.elapsed)
- __init__(use_cuda=None, record_history=False)
- Args:
- use_cuda:
None (default): auto-detect; sync only if CUDA is in use.
True: force CUDA sync (if available).
False: never sync CUDA.
- record_history:
If True, every measurement is appended to self.history.
- Parameters:
use_cuda (bool | None)
record_history (bool)
- start()
- stop()
- pytabkit.models.torch_utils.batch_randperm(n_batch, n, device='cpu')
- pytabkit.models.torch_utils.cat_if_necessary(tensors, dim)
Implements torch.cat() but doesn’t copy if only one tensor is provided. This can make it faster if no copying behavior is needed. :param tensors: Tensors to be concatenated. :param dim: Dimension in which the tensor should be concatenated. :return: The concatenated tensor.
- Parameters:
tensors (List[Tensor])
dim (int)
- pytabkit.models.torch_utils.clamp_with_identity_gradient_func(x, low, high)
- pytabkit.models.torch_utils.gauss_cdf(x)
- pytabkit.models.torch_utils.get_available_device_names()
- Return type:
List[str]
- pytabkit.models.torch_utils.get_available_memory_gb(device)
Return the available memory (in GB) on the given device.
Parameters
- devicestr or torch.device
Device identifier, e.g. “cuda”, “cuda:0”, or torch.device(“cuda:0”).
Returns
- float
Available memory in gigabytes.
Notes
For CUDA devices, this uses torch.cuda.mem_get_info if available.
For CPU, it uses psutil.virtual_memory().available.
For other device types, NotImplementedError is raised.
- Parameters:
device (str | device)
- Return type:
float
- pytabkit.models.torch_utils.hash_tensor(tensor)
- Parameters:
tensor (Tensor)
- Return type:
int
- pytabkit.models.torch_utils.permute_idxs(idxs, seed)
- pytabkit.models.torch_utils.seeded_randperm(n, device, seed)
- pytabkit.models.torch_utils.torch_np_quantile(tensor, q, dim, keepdim=False)
Alternative implementation for torch.quantile() using np.quantile() since the implementation of torch.quantile() uses too much RAM (extreme for Airlines_DepDelay_10M) and can fail for too large tensors. See also https://github.com/pytorch/pytorch/issues/64947 :param tensor: tensor :param q: Quantile value. :param dim: As in torch.quantile() :param keepdim: As in torch.quantile() :return: Tensor with quantiles.
- Parameters:
tensor (Tensor)
q (float)
dim (int)
keepdim (bool)
- Return type:
Tensor
pytabkit.models.utils module
- class pytabkit.models.utils.FunctionProcess
Bases:
objectHelper class to run a single function in a separate process.
- __init__(f, *args, **kwargs)
- get_ram_usage_gb()
- Return type:
float
- is_done()
- Return type:
bool
- pop_result()
- Return type:
Any
- start()
- Return type:
- class pytabkit.models.utils.FunctionRunner
Bases:
object- __init__(dill_f_args_kwargs, result_queue)
- class pytabkit.models.utils.ObjectLoadingContext
Bases:
object- __init__(obj, filename=None)
- Parameters:
obj (Any)
filename (str | Path | None)
- class pytabkit.models.utils.ProcessPoolMapper
Bases:
object- __init__(n_processes, chunksize=1)
- Parameters:
n_processes (int)
- map(f, args_tuples)
- Parameters:
args_tuples (List[Tuple])
- Return type:
Any
- class pytabkit.models.utils.TabrQuantileTransformer
Bases:
BaseEstimator,TransformerMixin- __init__(noise=0.001, random_state=None, n_quantiles=1000, subsample=1000000000, output_distribution='normal')
- fit(X, y=None)
- transform(X, y=None)
- pytabkit.models.utils.adapt_config(config, **kwargs)
- pytabkit.models.utils.all_equal(lst)
- Parameters:
lst (List)
- pytabkit.models.utils.argsort(lst)
- pytabkit.models.utils.combine_seeds(seed_1, seed_2)
Combines two random seeds to a new seed in a hopefully “typically injective” way :param seed_1: First random seed. :param seed_2: Second random seed. :return: Another random seed
- Parameters:
seed_1 (int)
seed_2 (int)
- Return type:
int
- pytabkit.models.utils.convert_numpy_dtypes(data)
Converts NumPy dtypes in a dictionary to Python dtypes. Some hyperparameter search space’s generate configs with numpy dtypes which aren’t serializable to yaml. This fixes that.
- Parameters:
data (dict)
- Return type:
dict
- pytabkit.models.utils.copyFile(src, dst)
- pytabkit.models.utils.create_dir(path)
- pytabkit.models.utils.delete_file(path)
- pytabkit.models.utils.deserialize(filename, compressed=False, use_json=False, use_yaml=False, use_msgpack=False, use_pickle=False)
- Parameters:
filename (Path | str)
compressed (bool)
use_json (bool)
use_yaml (bool)
use_msgpack (bool)
use_pickle (bool)
- pytabkit.models.utils.ensureDir(file_path)
- pytabkit.models.utils.existsDir(directory)
- pytabkit.models.utils.existsFile(file_path)
- pytabkit.models.utils.extract_params(config, param_configs)
Convert parameters in config to correct parameter names for another method and (optionally) insert default values :param config: Dictionary with values for parameters :param param_configs: Tuples specifying parameter names, e.g.: (‘eta’, None) specifies that result[‘eta’] = config[‘eta’] should be set if ‘eta’ is in config (‘eta’, ‘lr’) specifies that result[‘eta’] = config[‘lr’] should be set if ‘lr’ is in config (‘eta, [‘eta’, ‘lr’]) specifies that either config[‘eta’] or config[‘lr’] should be used, if available A third value in the tuple specifies a default value that should be used if no value is available in config. :return: A dictionary as specified above.
- Parameters:
config (Dict[str, Any])
param_configs (List[Tuple[str, str | List[str] | None] | Tuple[str, str | List[str] | None, Any]])
- Return type:
Dict[str, Any]
- pytabkit.models.utils.getSubfolderNames(folder)
- pytabkit.models.utils.getSubfolders(folder)
- pytabkit.models.utils.get_batch_intervals(n_total, batch_size)
- Parameters:
n_total (int)
batch_size (int)
- Return type:
List[Tuple[int, int]]
- pytabkit.models.utils.get_uuid_str()
- pytabkit.models.utils.identity(x)
- pytabkit.models.utils.join_dicts(*dicts)
- pytabkit.models.utils.map_nested(obj, f, dim)
dim=0 will apply f to obj directly, dim=1 to all elements in obj, etc.
- Parameters:
obj (List | Dict | Any)
f (Callable)
dim (int)
- pytabkit.models.utils.matchFiles(file_matcher)
- pytabkit.models.utils.newDirname(prefix)
- pytabkit.models.utils.nsmallest(n, inputList)
- pytabkit.models.utils.numpy_to_native_rec(obj)
- Parameters:
obj (Any)
- pytabkit.models.utils.pretty_table_str(str_table)
- pytabkit.models.utils.readFromFile(filename)
- pytabkit.models.utils.reverse_argmin(x)
Does the same as np.argmin but in case of equality selects the last best one :param x: list or array of numbers :return: index of last minimum
- Parameters:
x (List | ndarray)
- pytabkit.models.utils.select_from_config(config, keys)
- Parameters:
config (Dict)
keys (List)
- pytabkit.models.utils.select_nested(obj, idx, dim)
- Parameters:
obj (List | Dict)
idx (Any)
dim (int)
- pytabkit.models.utils.serialize(filename, obj, compressed=False, use_json=False, use_yaml=False, use_msgpack=False, use_pickle=False)
- Parameters:
filename (Path | str)
obj (Any)
compressed (bool)
use_json (bool)
use_yaml (bool)
use_msgpack (bool)
use_pickle (bool)
- pytabkit.models.utils.set_none_except(lst, idxs)
- pytabkit.models.utils.shift_dim_nested(obj, dim1, dim2)
- Parameters:
obj (List | Dict)
dim1 (int)
dim2 (int)
- pytabkit.models.utils.update_dict(d, update=None, remove_keys=None)
- Parameters:
d (dict)
update (dict | None)
remove_keys (Any | List[Any] | None)
- pytabkit.models.utils.writeToFile(filename, content)