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#
Descriptor#
-
template<typename Float = float, typename Method = method::by_default, typename Task = task::by_default, typename Objective = logloss_objective::descriptor<Float>>
class descriptor# - 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(const objective_t &obj)#
Creates a new instance of the class with the given
obj
property value.
Properties
-
const objective_t &objective#
Choose objective function for calculations.
- Getter & Setter
const objective_t & get_objective()
auto & set_objective(const objective_t &obj)
-
result_option_id result_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)
Compute compute(...)#
Input#
-
template<typename Task = task::by_default>
class compute_input# - Template Parameters:
Task – Tag-type that specifies the type of the problem to solve. Can be task::compute.
Constructors
-
compute_input(const table &data, const table ¶meters, const table &responses)#
Creates a new instance of the class with the given
data
,parameters
andresponses
property valuea.
Properties
-
const table &responses#
An \(n \times 1\) table with the correct class labels. Default value: table{}.
- Getter & Setter
const table & get_responses() const
auto & set_responses(const table &value)
Result#
-
template<typename Task = task::by_default>
class compute_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
-
const table &value#
The matrix of size \(1 \times 1\) with the objective function value. Default value: table{}.
- Getter & Setter
const table & get_value() const
auto & set_value(const table &value)
-
const result_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)
Operation#
-
template<typename Descriptor>
objective_function::compute_result compute(const Descriptor &desc, const objective_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
- Postconditions