Visible to Intel only — GUID: GUID-D2A9D847-9821-4063-93BD-F178DF12E306
Visible to Intel only — GUID: GUID-D2A9D847-9821-4063-93BD-F178DF12E306
Objective function
Some classification algorithms are designed to minimize the selected objective function. On each iteration its’ gradient and sometimes hessian is calculated and model weights are updated using this information.
Operation |
Computational methods |
Programming Interface |
||
Mathematical formulation
Refer to Developer Guide: Objective function.
Programming Interface
All types and functions in this section are declared in the oneapi::dal::objective_function namespace and be available via inclusion of the oneapi/dal/algo/objective_function.hpp header file.
Result options
classresult_option_id
Public Methods
constexprresult_option_id()=default
constexprresult_option_id(constresult_option_id_base&base)
Descriptor
template<typenameFloat=float,typenameMethod=method::by_default,typenameTask=task::by_default,typenameObjective=logloss_objective::descriptor<Float>>classdescriptor
- Template Parameters
-
Float – The floating-point type that the algorithm uses for intermediate computations. Can be float or double.
Method – Tag-type that specifies an implementation of algorithm. Can be method::dense_batch.
Task – Tag-type that specifies the type of the problem to solve. Can be task::compute.
Objective – The descriptor of the objective function to computate. Can be logloss_objective::descriptor.
Constructors
descriptor()
Creates a new instance of the class with the default property values.
descriptor(constobjective_t&obj)
Creates a new instance of the class with the given obj property value.
Properties
constobjective_t&objective
Choose objective function for calculations.
- Getter & Setter
-
const objective_t & get_objective()
auto & set_objective(const objective_t &obj)
result_option_idresult_options
Choose which results should be computed and returned.
- Getter & Setter
-
result_option_id get_result_options() const
auto & set_result_options(const result_option_id &value)
Method tags
structdense_batch
Tag-type that denotes computational method.
usingby_default=dense_batch
Alias tag-type for the computational method.
Task tags
structcompute
Tag-type that parameterizes entities that are used to compute statistics.
usingby_default=compute
Alias tag-type for compute task.
Compute compute(...)
Input
template<typenameTask=task::by_default>classcompute_input
- Template Parameters
-
Task – Tag-type that specifies the type of the problem to solve. Can be task::compute.
Constructors
compute_input(consttable&data, consttable¶meters, consttable&responses)
Creates a new instance of the class with the given data, parameters and responses property valuea.
Properties
consttable&data
An table with the training data, where each row stores one feature vector. Default value: table{}.
- Getter & Setter
-
const table & get_data() const
auto & set_data(const table &value)
consttable¶meters
An table with the model weights. Default value: table{}.
- Getter & Setter
-
const table & get_parameters() const
auto & set_parameters(const table &value)
consttable&responses
An table with the correct class labels. Default value: table{}.
- Getter & Setter
-
const table & get_responses() const
auto & set_responses(const table &value)
Result
template<typenameTask=task::by_default>classcompute_result
- Template Parameters
-
Task – Tag-type that specifies the type of the problem to solve. Can be task::compute.
Constructors
compute_result()
Creates a new instance of the class with the default property values.
Properties
consttable&gradient
The matrix of size with the objective function gradient. Default value: table{}.
- Getter & Setter
-
const table & get_gradient() const
auto & set_gradient(const table &value)
constresult_option_id&result_options
Result options that indicates availability of the properties. Default value: default_result_options<Task>.
- Getter & Setter
-
const result_option_id & get_result_options() const
auto & set_result_options(const result_option_id &value)
consttable&value
The matrix of size with the objective function value. Default value: table{}.
- Getter & Setter
-
const table & get_value() const
auto & set_value(const table &value)
consttable&hessian
The matrix of size with the objective function hessian. Default value: table{}.
- Getter & Setter
-
const table & get_hessian() const
auto & set_hessian(const table &value)
Operation
template<typenameDescriptor>objective_function::compute_resultcompute(constDescriptor&desc, constobjective_function::compute_input&input)
- Parameters
-
desc – objective_function algorithm descriptor objective_function::descriptor
input – Input for objective_function computation. Contains data, parameters and responses
- Preconditions
-
input.data.has_data == true
input.parameters.has_data == true
input.responses.has_data == true
input.data.row_count == input.responses.row_count
input.data.column_count + 1 == input.parameters.row_count
input.responses.column_count == 1
input.parameters.column_count == 1
- Postconditions
-
result.value.row_count == 1
result.value.column_count == 1
result.gradient.row_count == input.data.column_count + 1
result.gradient.column_count == 1
result.hessian.row_count == input.data.column_count + 1
result.hessian.column_count == input.data.column_count + 1