-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathpycluster_soft.cpp
More file actions
29 lines (28 loc) · 1.09 KB
/
pycluster_soft.cpp
File metadata and controls
29 lines (28 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "pycluster_soft.h"
void init_clustering_soft(py::module &m) {
m.def("scluster", [](const SparseMatrixWrapper &smw, py::object centers,
py::object measure, double beta, double temp,
uint64_t kmeansmaxiter, py::ssize_t mbsize, py::ssize_t mbn,
py::object savepref, py::object weights) -> py::object
{
void *wptr = nullptr;
std::string wfmt = "f";
if(!weights.is_none()) {
auto inf = py::cast<py::array>(weights).request();
wfmt = standardize_dtype(inf.format);
wptr = inf.ptr;
}
return py_scluster(smw, centers, assure_dm(measure), beta, temp, kmeansmaxiter, mbsize, mbn, static_cast<std::string>(savepref.cast<py::str>()), wptr);
},
py::arg("smw"),
py::arg("centers"),
py::arg("msr") = 2,
py::arg("prior") = 0.,
py::arg("temp") = 1.,
py::arg("maxiter") = 1000,
py::arg("mbsize") = py::ssize_t(-1),
py::arg("mbn") = py::ssize_t(-1),
py::arg("savepref") = "",
py::arg("weights") = py::none()
);
} // init_clustering_csr