Learn R Programming

less (version 0.1.0)

BaseEstimator: BaseEstimator

Description

A dummy base R6 class that provides get_all_fields, get_attributes and set_random_state functionalities for estimators

Arguments

Value

R6 Class of BaseEstimator

Methods


Method get_all_fields()

Auxiliary function returning the name of all private and public fields of the self class

Usage

BaseEstimator$get_all_fields()

Examples

TestClass <- R6::R6Class(classname = "TestClass",
inherit = BaseEstimator,
private = list(random_state = NULL))
exampleClass <- TestClass$new()
exampleClass$get_all_fields()


Method get_attributes()

Auxiliary function returning the name and values of all private and public fields of the self class

Usage

BaseEstimator$get_attributes()

Examples

exampleClass$get_attributes()


Method set_random_state()

Auxiliary function that sets random state attribute of the self class

Usage

BaseEstimator$set_random_state(random_state)

Arguments

random_state

seed number to be set as random state

Returns

self

Examples

exampleClass$set_random_state(2022)


Method clone()

The objects of this class are cloneable with this method.

Usage

BaseEstimator$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

Run this code

## ------------------------------------------------
## Method `BaseEstimator$get_all_fields`
## ------------------------------------------------

TestClass <- R6::R6Class(classname = "TestClass",
inherit = BaseEstimator,
private = list(random_state = NULL))
exampleClass <- TestClass$new()
exampleClass$get_all_fields()

## ------------------------------------------------
## Method `BaseEstimator$get_attributes`
## ------------------------------------------------

exampleClass$get_attributes()

## ------------------------------------------------
## Method `BaseEstimator$set_random_state`
## ------------------------------------------------

exampleClass$set_random_state(2022)

Run the code above in your browser using DataLab