ExpertMatrix: Expert Library Classes

ExpertMatrixR Documentation

Expert Library Classes

Description

This is the library of all the Expert Functions. In another word, it stored all the metadata of the Expert Functions. This object is a singleton, which means it should be only created when the package is loaded. It is also hidden in the global environment. Please do not clear the hidden objects And it you cleared the hidden objects. Please reload the package to fix that.

This is the matrix class of Expert Functions. Users are expected to perform all vector operations through ExpertMatrix to reduce index errors.

Public fields

continuous_experts

(NULL)
The names of continuous ExpertFunction

discrete_experts

(NULL)
The names of discrete ExpertFunction

distribution_names

(NULL)
The names of all expert functions Register a new Expert Function

Methods

Public methods


Method register()

Usage
ExpertLibrary$register(expert_name, continuous)
Arguments
expert_name

(character)
The name of the expert function

continuous

(logical)
Is this new expert function continuous? Is given Expert Function continuous?


Method is_continous()

Usage
ExpertLibrary$is_continous(expert_name)
Arguments
expert_name

(character)
The name of the expert function Is given Expert Function discrete?


Method is_discrete()

Usage
ExpertLibrary$is_discrete(expert_name)
Arguments
expert_name

(character)
The name of the expert function Is given Expert Function got a correct name?


Method is_valid_expert()

Usage
ExpertLibrary$is_valid_expert(expert_name)
Arguments
expert_name

(character)
The name of the expert function


Method clone()

The objects of this class are cloneable with this method.

Usage
ExpertLibrary$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Public fields

nrow

(numeric)
The number of rows of ExpertMatrix

ncol

(numeric)
The number of columns of ExpertMatrix

expert_matrix

(matrix)
The matrix object to store all the ExpertFunction R6 objects

penalty_params

(matrix)
The matrix object to store all the penalty parameters for the Expert Functions

expert_params

(matrix)
The matrix object to store all the parameters for the Expert Functions Initialze a Expert Matrix Class

Methods

Public methods


Method new()

Usage
ExpertMatrix$new(expert_matrix, expert_params_matrix)
Arguments
expert_matrix

(matrix)
The name of Expert Functions, stored as a matrix of characters.

expert_params_matrix

(matrix)
The parameters of Expert Functions, stored as a matrix of lists. select the expert function object inside expert matrix


Method select()

Usage
ExpertMatrix$select(row_index = 0, col_index = 0)
Arguments
row_index

Row index

col_index

Column index Exposurize all the expert functions inside the expert matrix


Method exposurize()

Usage
ExpertMatrix$exposurize(exposure)
Arguments
exposure

The exposurized value


Method get_mean()

Return the mean matrix of the ExpertMatrix

Usage
ExpertMatrix$get_mean()

Method get_variance()

Return the variance matrix of the ExpertMatrix set the penalty parameters for all the expert functions

Usage
ExpertMatrix$get_variance()

Method set_penalty_params()

Usage
ExpertMatrix$set_penalty_params(expert_penalty_params_matrix)
Arguments
expert_penalty_params_matrix

(matrix) To be more specific, it is a matrix of list like this

penalty_params = matrix( list( c(2,1,2), c(1,1,1), c(3,1,2), c(1,3,4)), nrow = 2) set the parameters for all the expert functions


Method set_params()

Usage
ExpertMatrix$set_params(expert_params_matrix)
Arguments
expert_params_matrix

(matrix) To be more specific, it is a matrix of list of named list like this

params = matrix(list( list(meanlog = 1, sdlog = 2), list(meanlog = 1, sdlog = 2), list(meanlog = 3, sdlog = 1), list(meanlog = 5, sdlog = 1)), nrow = 2) Get the sum of penalty value of all the expert functions. Users are required to set the penalty parameters before call this function.


Method get_penalty_value()

Usage
ExpertMatrix$get_penalty_value(penalty)
Arguments
penalty

TRUE/FALSE

Returns

value The total penalty value of Expert Matrix Count the total number of parameters (for the Expert Functions) that exist in the Expert Matrix.


Method count_params()

Usage
ExpertMatrix$count_params()
Returns

result (integer) Total number of parameters


Method clone()

The objects of this class are cloneable with this method.

Usage
ExpertMatrix$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

params = matrix(list( list(meanlog = 1, sdlog = 2),  list(meanlog = 1, sdlog  = 2),
                      list(meanlog = 3, sdlog = 1),  list(meanlog = 5, sdlog = 1)), nrow = 2)
penalty_params = matrix( list( c(2,1,2), c(1,1,1), c(3,1,2), c(1,3,4)), nrow = 2)
expert_names = matrix( c("lognormal", "lognormal", "lognormal", "lognormal"), nrow = 2)
# ExpertMatrixObj = ExpertMatrix$new(expert_matrix = expert_names, expert_params_matrix = params)
# ExpertMatrixObj$set_penalty_params(penalty_params)
# ExpertMatrixObj$set_params(params)

sparktseung/LRMoE documentation built on March 21, 2022, 3:22 a.m.