K-Means initialization
Operation | Computational methods | Programming Interface |
Mathematical formulation
Programming Interface
- 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 befloatordouble.
- Method– Tag-type that specifies an implementation of K-Means Initialization algorithm.
- Task– Tag-type that specifies the type of the problem to solve. Can betask::init.
Constructors- descriptor(std::int64_tcluster_count= 2)
- Creates a new instance of the class with the givencluster_count.
Properties- std::int64_tcluster_count
- The number of clusters k.Default value: 2.
- Getter & Setter
std::int64_t get_cluster_count() const
auto & set_cluster_count(int64_t value)
- Invariants
cluster_count > 0
- structdense
- Tag-type that denotes dense computational method.
- structparallel_plus_dense
- structplus_plus_dense
- structrandom_dense
- structinit
- Tag-type that parameterizes entities used for obtaining the initial K-Means centroids.
- Alias tag-type for the initialization task.
- Template Parameters
- Task– Tag-type that specifies type of the problem to solve. Can betask::init.
Constructors- Creates a new instance of the class with the givendata.
Properties- An
table with the data to be clustered, where each row stores one feature vector.
Default value: table{}.- Getter & Setter
const table & get_data() const
auto & set_data(const table &data)
- Template Parameters
- Task– Tag-type that specifies type of the problem to solve. Can beoneapi::dal::kmeans::task::clustering.
Constructors- compute_result()
- Creates a new instance of the class with the default property values.
Properties- A
table with the initial centroids. Each row of the table stores one centroid.
Default value: table{}.- Getter & Setter
const table & get_centroids() const
auto & set_centroids(const table &value)
- template<typenameDescriptor> kmeans_init::compute_resultcompute(constDescriptor &desc,constkmeans_init::compute_input &input)
- Parameters
- desc– K-Means algorithm descriptorkmeans_init::descriptor
- input– Input data for the computing operation
- Preconditions
input.data.has_data == true
input.data.row_count == desc.cluster_count
- Postconditions
result.centroids.has_data == true
result.centroids.row_count == desc.cluster_count
result.centroids.column_count == input.data.column_count