Dataset

The mkl::stats::dataset structure consolidates information of a multi-dimensional dataset.

Syntax

template<typename DataType, layout ObservationsLayout = layout::row_major>

struct dataset {};

Buffer API specialization

template<typename Type, layout ObservationsLayout>
struct dataset<sycl::buffer<Type, 1>, ObservationsLayout> {

    explicit dataset(std::int64_t n_dims_, std::int64_t n_observations_,
                    sycl::buffer<Type, 1> observations_, sycl::buffer<Type, 1> weights_ = {0},
                    sycl::buffer<std::int64_t, 1> indices_ = {0}) :
                    n_dims(n_dims_), n_observations(n_observations_),
                    observations(observations_),
                    weights(weights_), indices(indices_), layout(ObservationsLayout) {};

    std::int64_t n_dims;
    std::int64_t n_observations;
    layout layout = ObservationsLayout;
    sycl::buffer<Type, 1> observations;
    sycl::buffer<Type, 1> weights;
    sycl::buffer<std::int64_t, 1> indices;
};

USM API specialization

template<typename Type, layout ObservationsLayout>
struct dataset<Type*, ObservationsLayout> {
    explicit dataset(std::int64_t n_dims_, std::int64_t n_observations_, Type* observations_,
                    Type* weights_ = nullptr, std::int64_t* indices_ = nullptr) :
                    n_dims(n_dims_), n_observations(n_observations_),
                    observations(observations_),
                    weights(weights_), indices(indices_), layout(ObservationsLayout) {};

    std::int64_t n_dims;
    std::int64_t n_observations;
    layout layout = ObservationsLayout;
    Type* observations;
    Type* weights;
    std::int64_t* indices;
};

Include Files

Template Parameters

typename DataType

Type of dataset. May be sycl::buffer<float,1>, sycl::buffer<double,1> (for buffer-based dataset) or float*, double* (for USM-based dataset).

mkl::stats::layout ObservationsLayout

Layout of the observations matrix of the dataset. The specific values are as follows:

mkl::stats::layout::row_major

mkl::stats::layout::col_major

Struct Members

Name

Type

Description

n_dims

std::int64_t

The number of dimensions (variables)

n_observations

std::int64_t

The number of observations

layout

mkl::stats::layout

Characterize the matrix of observations layout (row or column major)

observations

sycl::buffer<Type, 1> / Type*

Matrix of observations.

weights

sycl::buffer<Type, 1> / Type*

Array of weights of size n_observations. Elements of the arrays are non-negative numbers.

If the parameter is not specified, each observation is assigned a weight equal to 1.

indices

sycl::buffer<std::int64_t, 1> / std::int64_t*

Array of vector components that will be processed. Size of array is n_dims. If the parameter is not specified, all components of the vector are processed.