Visible to Intel only — GUID: GUID-6AF8B19E-5E3E-433E-BD04-93E311DECF27
Visible to Intel only — GUID: GUID-6AF8B19E-5E3E-433E-BD04-93E311DECF27
Linear Regression
Linear regression is a method to model the connection between a dependent variable, which can be a vector, and one or more explanatory variables. This is done by fitting the linear equations to the observed data.
Operation |
Computational methods |
Programming Interface |
||
Mathematical Formulation
Refer to Developer Guide: Linear Regression.
Programming Interface
All types and functions from this section are declared in the oneapi::dal::linear_regression namespace and available by including the oneapi/dal/algo/linear_regression.hpp header file.
Descriptor
template<typenameFloat=float,typenameMethod=method::by_default,typenameTask=task::by_default>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::norm_eq.
Task – Tag-type that specifies type of the problem to solve. Can be task::regression.
Constructors
descriptor(boolcompute_intercept)
Creates a new instance of the class with the given compute_intercept.
descriptor()
Creates a new instance of the class with default parameters.
Properties
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)
boolcompute_intercept
Defines should intercept be taken into consideration.
- Getter & Setter
-
bool get_compute_intercept() const
auto & set_compute_intercept(bool compute_intercept) const
Method Tags
structnorm_eq
Tag-type that denotes normal eqution computational method.
usingby_default=norm_eq
Task Tags
structregression
Tag-type that parameterizes entities used for solving regression problem.
usingby_default=regression
Alias tag-type for regression task.
Training
Input
template<typenameTask=task::by_default>classtrain_input
- Template Parameters
-
Task – Tag-type that specifies type of the problem to solve. Can be task::regression.
Constructors
train_input()
train_input(consttable&data, consttable&responses)
Creates a new instance of the class with the given data and responses property values.
train_input(consttable&data)
Properties
consttable&data
The training set X. Default value: table{}.
- Getter & Setter
-
const table & get_data() const
auto & set_data(const table &data)
consttable&responses
Vector of responses y for the training set X. Default value: table{}.
- Getter & Setter
-
const table & get_responses() const
auto & set_responses(const table &responses)
Result and Finalize Result
template<typenameTask=task::by_default>classtrain_result
- Template Parameters
-
Task – Tag-type that specifies type of the problem to solve. Can be task::classification or task::search.
Constructors
train_result()
Creates a new instance of the class with the default property values.
Properties
constresult_option_id&result_options
Result options that indicates availability of the properties.
- Getter & Setter
-
const result_option_id & get_result_options() const
auto & set_result_options(const result_option_id &value)
consttable&coefficients
Table of Linear regression coefficients.
- Getter & Setter
-
const table & get_coefficients() const
auto & set_coefficients(const table &value)
consttable&intercept
Table of Linear regression intercept.
- Getter & Setter
-
const table & get_intercept() const
auto & set_intercept(const table &value)
consttable&packed_coefficients
Table of Linear regression coefficients with intercept.
- Getter & Setter
-
const table & get_packed_coefficients() const
auto & set_packed_coefficients(const table &value)
constmodel<Task>&model
The trained Linear Regression model. Default value: model<Task>{}.
- Getter & Setter
-
const model< Task > & get_model() const
auto & set_model(const model< Task > &value)
Partial Training
Partial Input
template<typenameTask=task::by_default>classpartial_train_input
Constructors
partial_train_input()
partial_train_input(consttable&data)
partial_train_input(consttable&data, consttable&responses)
partial_train_input(constpartial_train_result<Task>&prev, consttable&data)
partial_train_input(constpartial_train_result<Task>&prev, consttable&data, consttable&responses)
partial_train_input(constpartial_train_result<Task>&prev, constpartial_train_input<Task>&input)
Properties
consttable&data
- Getter & Setter
-
const table & get_data() const
auto & set_data(const table &value)
constpartial_train_result<Task>&prev
- Getter & Setter
-
const partial_train_result< Task > & get_prev() const
auto & set_prev(const partial_train_result< Task > &value)
consttable&responses
Vector of responses y for the training set X. Default value: table{}.
- Getter & Setter
-
const table & get_responses() const
auto & set_responses(const table &responses)
Partial Result and Finalize Input
template<typenameTask=task::by_default>classpartial_train_result
Constructors
partial_train_result()
Properties
consttable&partial_xtx
The partial_xtx matrix. Default value: table{}.
- Getter & Setter
-
const table & get_partial_xtx() const
auto & set_partial_xtx(const table &value)
consttable&partial_xty
The partial_xty matrix. Default value: table{}.
- Getter & Setter
-
const table & get_partial_xty() const
auto & set_partial_xty(const table &value)
Finalize Training
Inference
Input
template<typenameTask=task::by_default>classinfer_input
- Template Parameters
-
Task – Tag-type that specifies type of the problem to solve. Can be task::classification or task::search.
Constructors
infer_input(consttable&data, constmodel<Task>&model)
Creates a new instance of the class with the given model and data property values.
Properties
consttable&data
The dataset for inference . Default value: table{}.
- Getter & Setter
-
const table & get_data() const
auto & set_data(const table &data)
constmodel<Task>&model
The trained k-NN model. Default value: model<Task>{}.
- Getter & Setter
-
const model< Task > & get_model() const
auto & set_model(const model< Task > &m)
Result
template<typenameTask=task::by_default>classinfer_result
- Template Parameters
-
Task – Tag-type that specifies type of the problem to solve. Can be task::regression.
Constructors
infer_result()
Creates a new instance of the class with the default property values.
Properties
consttable&responses
The predicted responses. Default value: table{}.
- Getter & Setter
-
const table & get_responses() const
auto & set_responses(const table &value)