MCPcopy Create free account
hub / github.com/bab2min/tomotopy / getRegressionCoef

Method getRegressionCoef

src/python/handler/py_SLDA.cpp:171–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171py::UniqueObj SLDAModelObject::getRegressionCoef(PyObject* varId) const
172{
173 auto* inst = getInst<tomoto::ISLDAModel>();
174 if (!varId || varId == Py_None)
175 {
176 float* ptr;
177 py::UniqueObj ret = py::newEmptyArray(ptr, inst->getF(), inst->getK());
178 for (size_t i = 0; i < inst->getF(); ++i)
179 {
180 auto l = inst->getRegressionCoef(i);
181 memcpy(ptr + i * inst->getK(), l.data(), sizeof(float) * inst->getK());
182 }
183 return ret;
184 }
185
186 size_t varIdVal;
187 if (!py::toCpp(varId, varIdVal)) throw py::ValueError{ "`var_id` must be an integer or None." };
188 if (varIdVal >= inst->getF()) throw py::ValueError{ "`var_id` must be < `f`" };
189 return py::buildPyValue(inst->getRegressionCoef(varIdVal));
190}
191
192std::string SLDAModelObject::getTypeOfVar(size_t varId) const
193{

Callers

nothing calls this directly

Calls 5

newEmptyArrayFunction · 0.85
toCppFunction · 0.85
buildPyValueFunction · 0.70
getKMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected