Class TransformersHpSearchSpace
java.lang.Object
de.uni_mannheim.informatik.dws.melt.matching_ml.python.nlptransformers.TransformersHpSearchSpace
This class represents the search space for hyper parameters.
Each method represents the type of sampling and it need a parameter which appears as a training argument.
NLPTransformersHpSearchSpace psace = new NLPTransformersHpSearchSpace()
.
System.out.println(s);
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionSample a categorical value.static TransformersHpSearchSpace
Initializes a default search space for hyper parameter search.static TransformersHpSearchSpace
gridSearch
(String parameter, List<Object> values) Grid search over a value.lograndint
(String parameter, int lower, int upper) Sample an integer value log-uniformly between lower and upper, with base 10.lograndint
(String parameter, int lower, int upper, float base) Sample an integer value log-uniformly between lower and upper, with base being the base of logarithm.loguniform
(String parameter, float lower, float upper) Sugar for sampling in different orders of magnitude.loguniform
(String parameter, float lower, float upper, float base) Sugar for sampling in different orders of magnitude.qlograndint
(String parameter, int lower, int upper, int q) Sample an integer value log-uniformly between lower and upper, with base 10.qlograndint
(String parameter, int lower, int upper, int q, float base) Sample an integer value log-uniformly between lower and upper, with base being the base of logarithm.qloguniform
(String parameter, float lower, float upper, float q) Sugar for sampling in different orders of magnitude.qloguniform
(String parameter, float lower, float upper, float q, float base) Sugar for sampling in different orders of magnitude.Sample an integer value uniformly between lower and upper.Sample an integer value uniformly between lower and upper.Sample a float value normally with mean and sd.Sample a quantized float value uniformly between lower and upper.Sample an integer value uniformly between lower and upper.Sample a float value normally with mean 0 and sd 1.Sample a float value normally with mean and sd.Sample a float value uniformly between lower and upper.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
JSON_MAPPER
private static final com.fasterxml.jackson.databind.ObjectMapper JSON_MAPPER -
config
-
-
Constructor Details
-
TransformersHpSearchSpace
public TransformersHpSearchSpace()
-
-
Method Details
-
uniform
Sample a float value uniformly between lower and upper.- Parameters:
parameter
- parameter name (which should appear in the training arguments like learning_rate.lower
- the lower value of the distributionupper
- the upper value of the distribution- Returns:
- the search space (this) itself for next call
-
quniform
Sample a quantized float value uniformly between lower and upper. The value will be quantized, i.e. rounded to an integer increment of q. Quantization makes the upper bound inclusive.- Parameters:
parameter
- parameter name (which should appear in the training arguments like learning_rate.lower
- the lower value of the distributionupper
- the upper value of the distributionq
- quantization number. The result will be rounded to an integer increment of this value.- Returns:
- the search space (this) itself for next call
-
loguniform
Sugar for sampling in different orders of magnitude. Base is 10.- Parameters:
parameter
- parameter name (which should appear in the training arguments like learning_rate.lower
- lower boundary of the output interval (e.g. 1e-4)upper
- upper boundary of the output interval (e.g. 1e-2)- Returns:
- the search space (this) itself for next call
-
loguniform
Sugar for sampling in different orders of magnitude.- Parameters:
parameter
- parameter name (which should appear in the training arguments like learning_rate.lower
- lower boundary of the output interval (e.g. 1e-4)upper
- upper boundary of the output interval (e.g. 1e-2)base
- Base of the log- Returns:
- the search space (this) itself for next call
-
qloguniform
Sugar for sampling in different orders of magnitude. Quantization makes the upper bound inclusive. The base will default to 10.- Parameters:
parameter
- parameter name (which should appear in the training arguments like learning_rate.lower
- lower boundary of the output interval (e.g. 1e-4)upper
- upper boundary of the output interval (e.g. 1e-2)q
- quantization number. The result will be rounded to an integer increment of this value.- Returns:
- the search space (this) itself for next call
-
qloguniform
public TransformersHpSearchSpace qloguniform(String parameter, float lower, float upper, float q, float base) Sugar for sampling in different orders of magnitude.- Parameters:
parameter
- parameter name (which should appear in the training arguments like learning_rate.lower
- lower boundary of the output interval (e.g. 1e-4)upper
- upper boundary of the output interval (e.g. 1e-2)q
- quantization number. The result will be rounded to an integer increment of this value.base
- base of the log- Returns:
- the search space (this) itself for next call
-
randn
Sample a float value normally with mean 0 and sd 1. Quantization makes the upper bound inclusive. The base will default to 10.- Parameters:
parameter
- parameter name (which should appear in the training arguments like learning_rate.- Returns:
- the search space (this) itself for next call
-
randn
Sample a float value normally with mean and sd.- Parameters:
parameter
- parameter name (which should appear in the training arguments like learning_rate.mean
- mean of the normal distributionsd
- standard deviation of the normal distribution- Returns:
- the search space (this) itself for next call
-
qrandn
Sample a float value normally with mean and sd.- Parameters:
parameter
- parameter name (which should appear in the training arguments like learning_rate.mean
- mean of the normal distributionsd
- standard deviation of the normal distributionq
- quantization number. The result will be rounded to an integer increment of this value.- Returns:
- the search space (this) itself for next call
-
randint
Sample an integer value uniformly between lower and upper. lower is inclusive, upper is exclusive.- Parameters:
parameter
- parameter name (which should appear in the training arguments like learning_rate.lower
- lower boundary of the output interval (e.g. 5)upper
- upper boundary of the output interval (e.g. 10)- Returns:
- the search space (this) itself for next call
-
qrandint
Sample an integer value uniformly between lower and upper. lower is inclusive, upper is exclusive. Q set to 1.- Parameters:
parameter
- parameter name (which should appear in the training arguments like learning_rate.lower
- lower boundary of the output interval (e.g. 5)upper
- upper boundary of the output interval (e.g. 10)- Returns:
- the search space (this) itself for next call
-
qrandint
Sample an integer value uniformly between lower and upper. lower is inclusive, upper is exclusive.- Parameters:
parameter
- parameter name (which should appear in the training arguments like learning_rate.lower
- lower boundary of the output interval (e.g. 5)upper
- upper boundary of the output interval (e.g. 10)q
- quantization number. The result will be rounded to an integer increment of this value.- Returns:
- the search space (this) itself for next call
-
lograndint
Sample an integer value log-uniformly between lower and upper, with base 10.- Parameters:
parameter
- parameter name (which should appear in the training arguments like learning_rate.lower
- lower boundary of the output interval (e.g. 5)upper
- upper boundary of the output interval (e.g. 10)- Returns:
- the search space (this) itself for next call
-
lograndint
Sample an integer value log-uniformly between lower and upper, with base being the base of logarithm.- Parameters:
parameter
- parameter name (which should appear in the training arguments like learning_rate.lower
- lower boundary of the output interval (e.g. 5)upper
- upper boundary of the output interval (e.g. 10)base
- base of the log- Returns:
- the search space (this) itself for next call
-
qlograndint
Sample an integer value log-uniformly between lower and upper, with base 10. lower is inclusive, upper is also inclusive (!). The value will be quantized, i.e. rounded to an integer increment of q. Quantization makes the upper bound inclusive.- Parameters:
parameter
- parameter name (which should appear in the training arguments like learning_rate.lower
- lower boundary of the output interval (e.g. 5)upper
- upper boundary of the output interval (e.g. 10)q
- quantization number. The result will be rounded to an integer increment of this value.- Returns:
- the search space (this) itself for next call
-
qlograndint
public TransformersHpSearchSpace qlograndint(String parameter, int lower, int upper, int q, float base) Sample an integer value log-uniformly between lower and upper, with base being the base of logarithm. lower is inclusive, upper is also inclusive (!). The value will be quantized, i.e. rounded to an integer increment of q. Quantization makes the upper bound inclusive.- Parameters:
parameter
- parameter name (which should appear in the training arguments like learning_rate.lower
- lower boundary of the output interval (e.g. 5)upper
- upper boundary of the output interval (e.g. 10)q
- quantization number. The result will be rounded to an integer increment of this value.base
- base of the log- Returns:
- the search space (this) itself for next call
-
choice
Sample a categorical value.- Parameters:
parameter
- parameter name (which should appear in the training arguments like learning_rate.categories
- sample a categorical value.- Returns:
- the search space (this) itself for next call
-
gridSearch
Grid search over a value. The final number of trials is: the number of values per gridsearch multiplied with number of trials.- Parameters:
parameter
- parameter name (which should appear in the training arguments like learning_rate.values
- a list whose parameters will be gridded- Returns:
- the search space (this) itself for next call
-
toJsonString
-
getDefaultHpSpace
Initializes a default search space for hyper parameter search.- Returns:
- a default search space for hyper parameter search
-
getDefaultHpSpaceMutations
-