From d6b5db19db8ba998235e433c8aaac42b67fa3498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98topepo=E2=80=99?= Date: Wed, 3 Dec 2025 11:42:12 -0500 Subject: [PATCH 1/5] new tab_pdf parameters --- NAMESPACE | 5 +++ NEWS.md | 2 ++ R/param_tab_pfn.R | 70 ++++++++++++++++++++++++++++++++++++ man/tab-pfn-param.Rd | 43 ++++++++++++++++++++++ tests/testthat/test-params.R | 11 ++++++ 5 files changed, 131 insertions(+) create mode 100644 R/param_tab_pfn.R create mode 100644 man/tab-pfn-param.Rd diff --git a/NAMESPACE b/NAMESPACE index e5df44c7..138ecf21 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -51,6 +51,8 @@ export(activation) export(activation_2) export(adjust_deg_free) export(all_neighbors) +export(average_before_softmax) +export(balance_probabilities) export(batch_size) export(buffer) export(cal_method_class) @@ -119,6 +121,7 @@ export(no_global_pruning) export(num_breaks) export(num_clusters) export(num_comp) +export(num_estimators) export(num_hash) export(num_knots) export(num_leaves) @@ -172,6 +175,7 @@ export(shrinkage_variance) export(signed_hash) export(significance_threshold) export(smoothness) +export(softmax_temperature) export(spline_degree) export(splitting_rule) export(stop_iter) @@ -182,6 +186,7 @@ export(svm_margin) export(target_weight) export(threshold) export(token) +export(training_set_limit) export(tree_depth) export(trees) export(trim_amount) diff --git a/NEWS.md b/NEWS.md index c1384934..b9e49d5c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,8 @@ * A bug was fixed where some space-filling designs did not respect the `original` argument (#409). +* Parameters were added for the `tab_pfn` model: `num_estimators()`, `softmax_temperature()`, `balance_probabilities()`, `average_before_softmax()`, and `training_set_limit()`. + # dials 1.4.2 * `prop_terms()` is a new parameter object used for recipes that do supervised feature selection (#395). diff --git a/R/param_tab_pfn.R b/R/param_tab_pfn.R new file mode 100644 index 00000000..f226cd44 --- /dev/null +++ b/R/param_tab_pfn.R @@ -0,0 +1,70 @@ +#' Parameters for TabPFN models +# +#' These parameters are used for constructing Prior data fitted network (TabPFN) +#' models. +#' +#' @inheritParams Laplace +#' @inheritParams select_features +#' +#' @details +#' These parameters are often used with TabPFN models via `parsnip::tab_pfn()`. +#' @name tab-pfn-param +#' @export +num_estimators <- function(range = c(1, 25), trans = NULL) { + new_quant_param( + type = "integer", + range = range, + inclusive = c(TRUE, TRUE), + trans = trans, + label = c(num_estimators = "# Estimators"), + finalize = NULL + ) +} + +#' @rdname tab-pfn-param +#' @export +softmax_temperature <- function(range = c(0, 10), trans = NULL) { + new_quant_param( + type = "double", + range = range, + inclusive = c(FALSE, TRUE), + trans = trans, + label = c(softmax_temperature = "Softmax Tmperature"), + finalize = NULL + ) +} + +#' @rdname tab-pfn-param +#' @export +balance_probabilities <- function(values = c(TRUE, FALSE)) { + new_qual_param( + type = "logical", + values = values, + label = c(balance_probabilities = "Balance Probabilities?"), + finalize = NULL + ) +} + +#' @rdname tab-pfn-param +#' @export +average_before_softmax <- function(values = c(TRUE, FALSE)) { + new_qual_param( + type = "logical", + values = values, + label = c(average_before_softmax = "Average Before Softmax?"), + finalize = NULL + ) +} + +#' @rdname tab-pfn-param +#' @export +training_set_limit <- function(range = c(2L, 10000L), trans = NULL) { + new_quant_param( + type = "integer", + range = range, + inclusive = c(TRUE, TRUE), + trans = trans, + label = c(training_set_limit = "Training Set Size"), + finalize = NULL + ) +} diff --git a/man/tab-pfn-param.Rd b/man/tab-pfn-param.Rd new file mode 100644 index 00000000..39b51efd --- /dev/null +++ b/man/tab-pfn-param.Rd @@ -0,0 +1,43 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/param_tab_pfn.R +\name{tab-pfn-param} +\alias{tab-pfn-param} +\alias{num_estimators} +\alias{softmax_temperature} +\alias{balance_probabilities} +\alias{average_before_softmax} +\alias{training_set_limit} +\title{Parameters for TabPFN models +These parameters are used for constructing Prior data fitted network (TabPFN) +models.} +\usage{ +num_estimators(range = c(1, 25), trans = NULL) + +softmax_temperature(range = c(0, 10), trans = NULL) + +balance_probabilities(values = c(TRUE, FALSE)) + +average_before_softmax(values = c(TRUE, FALSE)) + +training_set_limit(range = c(2L, 10000L), trans = NULL) +} +\arguments{ +\item{range}{A two-element vector holding the \emph{defaults} for the smallest and +largest possible values, respectively. If a transformation is specified, +these values should be in the \emph{transformed units}.} + +\item{trans}{A \code{trans} object from the \code{scales} package, such as +\code{scales::transform_log10()} or \code{scales::transform_reciprocal()}. If not provided, +the default is used which matches the units used in \code{range}. If no +transformation, \code{NULL}.} + +\item{values}{A vector of possible values (TRUE or FALSE).} +} +\description{ +Parameters for TabPFN models +These parameters are used for constructing Prior data fitted network (TabPFN) +models. +} +\details{ +These parameters are often used with TabPFN models via \code{parsnip::tab_pfn()}. +} diff --git a/tests/testthat/test-params.R b/tests/testthat/test-params.R index 431faf52..dd110e5b 100644 --- a/tests/testthat/test-params.R +++ b/tests/testthat/test-params.R @@ -143,6 +143,15 @@ test_that("param ranges", { expect_equal(mtry_prop(c(.1, .2))$range, list(lower = .1, upper = .2)) expect_equal(dropout(c(.1, .2))$range, list(lower = .1, upper = .2)) expect_equal(prop_terms(c(.1, .2))$range, list(lower = .1, upper = .2)) + expect_equal(num_estimators(c(1L, 10L))$range, list(lower = 1L, upper = 10L)) + expect_equal( + softmax_temperature(c(0.1, 2.0))$range, + list(lower = 0.1, upper = 2.0) + ) + expect_equal( + training_set_limit(c(2L, 10L))$range, + list(lower = 2L, upper = 10L) + ) }) @@ -179,4 +188,6 @@ test_that("param values", { expect_equal(all_neighbors(TRUE)$values, TRUE) expect_equal(cal_method_class()$values, values_cal_cls) expect_equal(cal_method_reg()$values, values_cal_reg) + expect_equal(balance_probabilities(TRUE)$values, TRUE) + expect_equal(average_before_softmax(TRUE)$values, TRUE) }) From c055aceb79f8f9c192abd1b498e7d2e1a2f2603f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98topepo=E2=80=99?= Date: Wed, 3 Dec 2025 12:08:20 -0500 Subject: [PATCH 2/5] typo --- R/param_tab_pfn.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/param_tab_pfn.R b/R/param_tab_pfn.R index f226cd44..732c9742 100644 --- a/R/param_tab_pfn.R +++ b/R/param_tab_pfn.R @@ -29,7 +29,7 @@ softmax_temperature <- function(range = c(0, 10), trans = NULL) { range = range, inclusive = c(FALSE, TRUE), trans = trans, - label = c(softmax_temperature = "Softmax Tmperature"), + label = c(softmax_temperature = "Softmax Temperature"), finalize = NULL ) } From c010aee3f37d34b14932828f67b12108433f1519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98topepo=E2=80=99?= Date: Wed, 3 Dec 2025 12:19:03 -0500 Subject: [PATCH 3/5] every. single. time. --- _pkgdown.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/_pkgdown.yml b/_pkgdown.yml index 5a19beef..e4edcb70 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -40,6 +40,8 @@ reference: - title: Parameter objects for preprocessing contents: - all_neighbors + - average_before_softmax + - balance_probabilities - freq_cut - harmonic_frequency - initial_umap @@ -56,6 +58,7 @@ reference: - prior_slab_dispersion - prop_terms - token + - training_set_limit - trim_amount - validation_set_prop - vocabulary_size @@ -82,6 +85,7 @@ reference: - neighbors - num_clusters - num_comp + - num_estimators - num_knots - penalty - predictor_prop @@ -91,11 +95,13 @@ reference: - regularization_method - select_features - smoothness + - softmax_temperature - stop_iter - summary_stat - surv_dist - survival_link - target_weight + - training_set_limit - threshold - trees - weight_func From ec240af9fd2685ce8b2da0598655ef2961733b82 Mon Sep 17 00:00:00 2001 From: Hannah Frick Date: Fri, 5 Dec 2025 13:51:10 +0000 Subject: [PATCH 4/5] remove duplicate entries --- _pkgdown.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/_pkgdown.yml b/_pkgdown.yml index e4edcb70..d1ec29a2 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -40,8 +40,6 @@ reference: - title: Parameter objects for preprocessing contents: - all_neighbors - - average_before_softmax - - balance_probabilities - freq_cut - harmonic_frequency - initial_umap @@ -58,7 +56,6 @@ reference: - prior_slab_dispersion - prop_terms - token - - training_set_limit - trim_amount - validation_set_prop - vocabulary_size @@ -95,13 +92,11 @@ reference: - regularization_method - select_features - smoothness - - softmax_temperature - stop_iter - summary_stat - surv_dist - survival_link - target_weight - - training_set_limit - threshold - trees - weight_func From f70b15f075652d2e7781390cccd012a267df96b2 Mon Sep 17 00:00:00 2001 From: Hannah Frick Date: Fri, 5 Dec 2025 13:51:43 +0000 Subject: [PATCH 5/5] fix roxygen --- R/param_schedulers.R | 2 +- R/param_tab_pfn.R | 2 +- man/scheduler-param.Rd | 4 +--- man/tab-pfn-param.Rd | 5 +---- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/R/param_schedulers.R b/R/param_schedulers.R index 1cfb5fcc..f0824f05 100644 --- a/R/param_schedulers.R +++ b/R/param_schedulers.R @@ -1,5 +1,5 @@ #' Parameters for neural network learning rate schedulers -# +#' #' These parameters are used for constructing neural network models. #' #' @inheritParams Laplace diff --git a/R/param_tab_pfn.R b/R/param_tab_pfn.R index 732c9742..36fd3d5b 100644 --- a/R/param_tab_pfn.R +++ b/R/param_tab_pfn.R @@ -1,5 +1,5 @@ #' Parameters for TabPFN models -# +#' #' These parameters are used for constructing Prior data fitted network (TabPFN) #' models. #' diff --git a/man/scheduler-param.Rd b/man/scheduler-param.Rd index 0410054c..867c54bf 100644 --- a/man/scheduler-param.Rd +++ b/man/scheduler-param.Rd @@ -11,8 +11,7 @@ \alias{rate_decay} \alias{rate_schedule} \alias{values_scheduler} -\title{Parameters for neural network learning rate schedulers -These parameters are used for constructing neural network models.} +\title{Parameters for neural network learning rate schedulers} \format{ An object of class \code{character} of length 5. } @@ -47,7 +46,6 @@ transformation, \code{NULL}.} in examples below.} } \description{ -Parameters for neural network learning rate schedulers These parameters are used for constructing neural network models. } \details{ diff --git a/man/tab-pfn-param.Rd b/man/tab-pfn-param.Rd index 39b51efd..ead8a341 100644 --- a/man/tab-pfn-param.Rd +++ b/man/tab-pfn-param.Rd @@ -7,9 +7,7 @@ \alias{balance_probabilities} \alias{average_before_softmax} \alias{training_set_limit} -\title{Parameters for TabPFN models -These parameters are used for constructing Prior data fitted network (TabPFN) -models.} +\title{Parameters for TabPFN models} \usage{ num_estimators(range = c(1, 25), trans = NULL) @@ -34,7 +32,6 @@ transformation, \code{NULL}.} \item{values}{A vector of possible values (TRUE or FALSE).} } \description{ -Parameters for TabPFN models These parameters are used for constructing Prior data fitted network (TabPFN) models. }