ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
GenericDistribution.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #include <pybind11/pybind11.h>
9 #include <pybind11/stl.h>
10 #include <pybind11/stl_bind.h>
11 
12 #include <GenericCloud.h>
13 #include <GenericDistribution.h>
14 
15 namespace py = pybind11;
16 using namespace pybind11::literals;
17 
18 #include "cccorelib.h"
19 
20 void define_GenericDistribution(py::module &cccorelib)
21 {
22 
23  py::class_<cloudViewer::GenericDistribution> GenericDistribution(cccorelib, "GenericDistribution");
24  GenericDistribution
25  .def("getName", &cloudViewer::GenericDistribution::getName, py::return_value_policy::reference)
27  .def("computeParameters", &cloudViewer::GenericDistribution::computeParameters, "values"_a)
28  .def("computeP",
29  (double(cloudViewer::GenericDistribution::*)(ScalarType)
31  "x"_a)
32  .def("computeP",
33  (double(cloudViewer::GenericDistribution::*)(ScalarType, ScalarType)
35  "x1"_a,
36  "x2"_a)
37  .def("computePfromZero", &cloudViewer::GenericDistribution::computePfromZero, "x"_a)
38  .def("computeChi2Dist",
40  "GenericDistribution",
41  "Yk"_a,
42  "numberOfClasses"_a,
43  "histo"_a = nullptr);
44 }
void define_GenericDistribution(py::module &cccorelib)
A generic class to handle a probability distribution.
virtual double computeP(ScalarType x) const =0
Computes the probability of x.
virtual bool computeParameters(const ScalarContainer &values)=0
Computes the distribution parameters from a set of values.
virtual double computeChi2Dist(const GenericCloud *Yk, unsigned numberOfClasses, int *histo=nullptr)=0
Computes the Chi2 distance (related to the Chi2 Test)
virtual const char * getName() const =0
Returns distribution name.
virtual bool isValid() const
Indicates if the distribution parameters are valid.
virtual double computePfromZero(ScalarType x) const =0
Computes the cumulative probability between 0 and x.