kmeans.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #pragma once
7 
9 
10 namespace raft {
11 class handle_t;
12 }
13 
14 namespace ML {
15 
16 namespace kmeans {
17 
39 void fit(const raft::handle_t& handle,
40  const KMeansParams& params,
41  const float* X,
42  int n_samples,
43  int n_features,
44  const float* sample_weight,
45  float* centroids,
46  float& inertia,
47  int& n_iter);
48 
49 void fit(const raft::handle_t& handle,
50  const KMeansParams& params,
51  const double* X,
52  int n_samples,
53  int n_features,
54  const double* sample_weight,
55  double* centroids,
56  double& inertia,
57  int& n_iter);
58 
59 void fit(const raft::handle_t& handle,
60  const KMeansParams& params,
61  const float* X,
62  int64_t n_samples,
63  int64_t n_features,
64  const float* sample_weight,
65  float* centroids,
66  float& inertia,
67  int64_t& n_iter);
68 
69 void fit(const raft::handle_t& handle,
70  const KMeansParams& params,
71  const double* X,
72  int64_t n_samples,
73  int64_t n_features,
74  const double* sample_weight,
75  double* centroids,
76  double& inertia,
77  int64_t& n_iter);
78 
101 void predict(const raft::handle_t& handle,
102  const KMeansParams& params,
103  const float* centroids,
104  const float* X,
105  int n_samples,
106  int n_features,
107  const float* sample_weight,
108  bool normalize_weights,
109  int* labels,
110  float& inertia);
111 
112 void predict(const raft::handle_t& handle,
113  const KMeansParams& params,
114  const double* centroids,
115  const double* X,
116  int n_samples,
117  int n_features,
118  const double* sample_weight,
119  bool normalize_weights,
120  int* labels,
121  double& inertia);
122 void predict(const raft::handle_t& handle,
123  const KMeansParams& params,
124  const float* centroids,
125  const float* X,
126  int64_t n_samples,
127  int64_t n_features,
128  const float* sample_weight,
129  bool normalize_weights,
130  int64_t* labels,
131  float& inertia);
132 
133 void predict(const raft::handle_t& handle,
134  const KMeansParams& params,
135  const double* centroids,
136  const double* X,
137  int64_t n_samples,
138  int64_t n_features,
139  const double* sample_weight,
140  bool normalize_weights,
141  int64_t* labels,
142  double& inertia);
160 void transform(const raft::handle_t& handle,
161  const KMeansParams& params,
162  const float* centroids,
163  const float* X,
164  int n_samples,
165  int n_features,
166  float* X_new);
167 
168 void transform(const raft::handle_t& handle,
169  const KMeansParams& params,
170  const double* centroids,
171  const double* X,
172  int n_samples,
173  int n_features,
174  double* X_new);
175 void transform(const raft::handle_t& handle,
176  const KMeansParams& params,
177  const float* centroids,
178  const float* X,
179  int64_t n_samples,
180  int64_t n_features,
181  float* X_new);
182 
183 void transform(const raft::handle_t& handle,
184  const KMeansParams& params,
185  const double* centroids,
186  const double* X,
187  int64_t n_samples,
188  int64_t n_features,
189  double* X_new);
190 }; // end namespace kmeans
191 }; // end namespace ML
Definition: params.hpp:23
void transform(const raft::handle_t &handle, const KMeansParams ¶ms, const float *centroids, const float *X, int n_samples, int n_features, float *X_new)
Transform X to a cluster-distance space.
void fit(const raft::handle_t &handle, const KMeansParams ¶ms, const float *X, int n_samples, int n_features, const float *sample_weight, float *centroids, float &inertia, int &n_iter)
Compute k-means clustering for each sample in the input.
void predict(const raft::handle_t &handle, const KMeansParams ¶ms, const float *centroids, const float *X, int n_samples, int n_features, const float *sample_weight, bool normalize_weights, int *labels, float &inertia)
Predict the closest cluster each sample in X belongs to.
Definition: dbscan.hpp:18
Definition: dbscan.hpp:14
Definition: kmeans_params.hpp:22