Visible to Intel only — GUID: GUID-D54610B3-B37C-4129-90C4-78F44309908B
Visible to Intel only — GUID: GUID-D54610B3-B37C-4129-90C4-78F44309908B
Basic Statistics
Basic statistics algorithm computes the following set of quantitative dataset characteristics:
minimums/maximums
sums
means
sums of squares
sums of squared differences from the means
second order raw moments
variances
standard deviations
variations
Operation |
Computational methods |
Programming Interface |
||
Mathematical formulation
Refer to Developer Guide: Basic statistics.
Programming Interface
All types and functions in this section are declared in the oneapi::dal::basic_statistics namespace and are available via inclusion of the oneapi/dal/algo/basic_statistics.hpp header file.
Descriptor
template<typenameFloat=detail::descriptor_base<>::float_t,typenameMethod=detail::descriptor_base<>::method_t,typenameTask=detail::descriptor_base<>::task_t>classdescriptor
- Template 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)
Method tags
structdense
Tag-type that denotes dense computational method.
usingby_default=dense
Alias tag-type for 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.
compute_input(consttable&data, consttable&weights)
Properties
consttable&weights
- Getter & Setter
-
const table & get_weights() const
auto & set_weights(const table &weights)
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 &data)
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&min
A table, where element is the minimum result for feature . Default value: table{}.
- Getter & Setter
-
const table & get_min() const
auto & set_min(const table &value)
consttable&sum_squares
A table, where element is the sum_squares result for feature . Default value: table{}.
- Getter & Setter
-
const table & get_sum_squares() const
auto & set_sum_squares(const table &value)
consttable&variance
A table, where element is the variance result for feature . Default value: table{}.
- Getter & Setter
-
const table & get_variance() const
auto & set_variance(const table &value)
constresult_option_id&result_options
Result options that indicates availability of the properties. Default value: full set of.
- Getter & Setter
-
const result_option_id & get_result_options() const
auto & set_result_options(const result_option_id &value)
consttable&variation
A table, where element is the variation result for feature . Default value: table{}.
- Getter & Setter
-
const table & get_variation() const
auto & set_variation(const table &value)
consttable&max
A table, where element is the maximum result for feature . Default value: table{}.
- Getter & Setter
-
const table & get_max() const
auto & set_max(const table &value)
consttable&sum_squares_centered
A table, where element is the sum_squares_centered result for feature . Default value: table{}.
- Getter & Setter
-
const table & get_sum_squares_centered() const
auto & set_sum_squares_centered(const table &value)
consttable&sum
A table, where element is the sum result for feature . Default value: table{}.
- Getter & Setter
-
const table & get_sum() const
auto & set_sum(const table &value)
consttable&mean
A table, where element is the mean result for feature . Default value: table{}.
- Getter & Setter
-
const table & get_mean() const
auto & set_mean(const table &value)
consttable&standard_deviation
A table, where element is the standard_deviation result for feature . Default value: table{}.
- Getter & Setter
-
const table & get_standard_deviation() const
auto & set_standard_deviation(const table &value)
consttable&second_order_raw_moment
A table, where element is the second_order_raw_moment result for feature . Default value: table{}.
- Getter & Setter
-
const table & get_second_order_raw_moment() const
auto & set_second_order_raw_moment(const table &value)
Operation
template<typenameDescriptor>basic_statistics::compute_resultcompute(constDescriptor&desc, constbasic_statistics::compute_input&input)
- Parameters
-
desc – Basic statistics algorithm descriptor basic_statistics::descriptor
input – Input data for the computing operation
- Preconditions
-
input.data.is_empty == false
Usage Example
Computing
void run_computing(const table& data) { const auto bs_desc = dal::basic_statistics::descriptor{}; const auto result = dal::compute(bs_desc, data); std::cout << "Minimum:\n" << result.get_min() << std::endl; std::cout << "Maximum:\n" << result.get_max() << std::endl; std::cout << "Sum:\n" << result.get_sum() << std::endl; std::cout << "Sum of squares:\n" << result.get_sum_squares() << std::endl; std::cout << "Sum of squared difference from the means:\n" << result.get_sum_squares_centered() << std::endl; std::cout << "Mean:\n" << result.get_mean() << std::endl; std::cout << "Second order raw moment:\n" << result.get_second_order_raw_moment() << std::endl; std::cout << "Variance:\n" << result.get_variance() << std::endl; std::cout << "Standard deviation:\n" << result.get_standard_deviation() << std::endl; std::cout << "Variation:\n" << result.get_variation() << std::endl; }
Examples
oneAPI DPC++
Batch Processing:
oneAPI C++
Batch Processing: