sits_tuning_hparams: Tuning machine learning models hyper-parameters

View source: R/sits_tuning.R

sits_tuning_hparamsR Documentation

Tuning machine learning models hyper-parameters

Description

This function allow user building the hyper-parameters space used by sits_tuning() function search randomly the best parameter combination.

Users should pass the possible values for hyper-parameters as constants or by calling the following random functions:

  • uniform(min = 0, max = 1, n = 1): returns random numbers from a uniform distribution with parameters min and max.

  • choice(..., replace = TRUE, n = 1): returns random objects passed to ... with replacement or not (parameter replace).

  • randint(min, max, n = 1): returns random integers from a uniform distribution with parameters min and max.

  • normal(mean = 0, sd = 1, n = 1): returns random numbers from a normal distribution with parameters min and max.

  • lognormal(meanlog = 0, sdlog = 1, n = 1): returns random numbers from a lognormal distribution with parameters min and max.

  • loguniform(minlog = 0, maxlog = 1, n = 1): returns random numbers from a loguniform distribution with parameters min and max.

  • beta(shape1, shape2, n = 1): returns random numbers from a beta distribution with parameters min and max.

These functions accepts n parameter to indicate how many values should be returned.

Usage

sits_tuning_hparams(...)

Arguments

...

Used to prepare hyper-parameter space

Value

A list containing the hyper-parameter space to be passed to sits_tuning()'s params parameter.

Examples

if (sits_run_examples()) {
    # find best learning rate parameters for TempCNN
    tuned <- sits_tuning(
        samples_modis_ndvi,
        ml_method = sits_tempcnn(),
        params = sits_tuning_hparams(
            optimizer = choice(
                torchopt::optim_adamw,
                torchopt::optim_yogi
            ),
            opt_hparams = list(
                lr = beta(0.3, 5)
            )
        ),
        trials = 4,
        multicores = 2,
        progress = FALSE
    )
}


e-sensing/sits documentation built on Jan. 28, 2024, 6:05 a.m.