Measure: Measure Class

Description Usage Arguments Value Active bindings Methods

Description

A class defines metrics specification.

Usage

1
new_measure(task_type = NULL, metrics = NULL)

Arguments

task_type

A character scalar of task type. See supported_tasks for tasks supported by a model/engine.

metrics

A character vector of model metrics. Metrics must be metrics of supported_metrics. If the vector is named, the names will be used insted of metrics' name itself. If NULL, default metrics will be set based on a task_type.

Value

A new Measure class object

Active bindings

task_type

A task type.

metrics

A character vector of metrics.

metric_names

A character vector of metric names.

Methods

Public methods


Method new()

Construct a new Measure class object.

Usage
Measure$new(task_type = NULL, metrics = NULL)
Arguments
task_type

A character scalar of task type. See supported_tasks for tasks supported by a model/engine.

metrics

A character vector of model metrics. Metrics must be metrics of supported_metrics. If the vector is named, the names will be used insted of metrics' name itself. If NULL, default metrics will be set based on a task_type.

Returns

A new Measure class object


Method print()

Print object.

Usage
Measure$print()

Method do()

Measure metrics of predictions.

Usage
Measure$do(pred = NULL, label_var = NULL)
Arguments
pred

A data.frame of predictions.

label_var

A character scalar of label variable name.

Returns

A list of metrics.


Method assert_metric_name()

Assert a metric name.

Usage
Measure$assert_metric_name(metric_name = NULL, conversion = TRUE)
Arguments
metric_name

A character scalar of metric name.

conversion

A logical scalar wheather to convert metric name.

Returns

A character scalar of metric name.


Method is_minimize_metric()

Wheather the metric is minimize function.

Usage
Measure$is_minimize_metric(metric_name = NULL)
Arguments
metric_name

A character scalar of metric name. If NULL, the first metric_name in options$measure$metric_names is used.

Returns

A logical scalar.


Method clone()

The objects of this class are cloneable with this method.

Usage
Measure$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


five-dots/ml4e documentation built on June 19, 2020, 4:26 p.m.