Visible to Intel only — GUID: GUID-3A93E52C-7B6F-4577-8062-1A765B89F50C
Visible to Intel only — GUID: GUID-3A93E52C-7B6F-4577-8062-1A765B89F50C
Covariance
In statistics, covariance and correlation are two of the most fundamental measures of linear dependence between two random variables. The covariance and the correlation represent the joint variability of any two features. The correlation is dimensionless, while the covariance is measured in units obtained by multiplying the units of the two features. Another important distinction is that covariance can be affected by the higher variance of one feature, while correalation removes the effect of the variances by normalizing the covariance of two features by their square-root of variances. Their usage is application-dependent. The covariance algorithm computes the following:
Means
Covariance
Correlation
Operation |
Computational methods |
Programming Interface |
||
Mathematical formulation
Refer to Developer Guide: Covariance.
Programming Interface
All types and functions in this section are declared in the oneapi::dal::covariance namespace and are available via inclusion of the oneapi/dal/algo/covariance.hpp header file.
Descriptor
template<typenameFloat=float,typenameMethod=method::by_default,typenameTask=task::by_default>classdescriptor
- Template Parameters
Constructors
descriptor()=default
Creates a new instance of the class with the default property values.
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)
Method tags
structdense
Tag-type that denotes dense computational method.
usingby_default=dense
Alias tag-type for the dense computational method.
Task tags
structcompute
Tag-type that parameterizes entities that are used to compute statistics.
usingby_default=compute
Alias tag-type for the compute task.
Training 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()
compute_input(consttable&data)
Creates a new instance of the class with the given data property value.
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)
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&cor_matrix
The correlation matrix. Default value: table{}.
- Getter & Setter
-
const table & get_cor_matrix() const
auto & set_cor_matrix(const table &value)
consttable&cov_matrix
The covariance matrix. Default value: table{}.
- Getter & Setter
-
const table & get_cov_matrix() const
auto & set_cov_matrix(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&means
Means. Default value: table{}.
- Getter & Setter
-
const table & get_means() const
auto & set_means(const table &value)
Operation
template<typenameDescriptor>covariance::compute_resultcompute(constDescriptor&desc, constcovariance::compute_input&input)
- Parameters
-
desc – Covariance algorithm descriptor covariance::descriptor
input – Input data for the computing operation
- Preconditions
-
input.data.is_empty == false