24 #ifndef __IPSDKMATH_KERNELKMEANSCENTROID_H__ 25 #define __IPSDKMATH_KERNELKMEANSCENTROID_H__ 29 #pragma warning (push) 30 #pragma warning (disable : 4251) 36 #include <IPSDKMath/Clustering/KernelKMeansClusteringConfig.h> 40 namespace clustering {
45 template <
typename KernelType>
51 KernelKMeansCentroid(
const KernelType& kernel);
52 ~KernelKMeansCentroid();
63 const KernelType& getKernel()
const;
75 void setAccuracyThreshold(
const ipReal64 accuracyThreshold);
79 ipReal64 getAccuracyThreshold()
const;
90 void setMaxDictionarySize(
const ipUInt32 maxDictionarySize);
93 ipUInt32 getMaxDictionarySize()
const;
104 void addSample(
const Vector& sample);
111 const ipReal64 sampleTerm = _kernel.value(sample);
115 typename VectorColl::const_iterator iterDict = _dictionary.begin();
116 typename Real64Vector::const_iterator iterWeight = _weights.begin();
117 while (iterDict != _dictionary.end()) {
120 const Vector& curPoint = *iterDict;
121 const ipReal64 curWeight = *iterWeight;
124 mixedTerm += curWeight * _kernel.value(curPoint, sample);
134 return sampleTerm + _clusterTermInfo.first - 2*mixedTerm;
145 if (comparableDistance > 0)
166 void updateClusterTerm()
const;
170 void updateMinStrength();
223 #pragma warning (pop) 225 #endif // __IPSDKMATH_KERNELKMEANSCENTROID_H__ Definition of import/export macro for library.
boost::numeric::ublas::matrix< ipReal64 > Matrix
matrix type associated to library
Definition: LinearAlgebraTypes.h:48
KernelType _kernel
kernel associated to cluster dictionary
Definition: KernelKMeansCentroid.h:175
Defines the IPSDK_FORCEINLINE.
static ipReal64 getDefaultAccuracyThreshold()
function allowing to retrieve default accuracy threshold value for approximate linear dependence cond...
Definition: KernelKMeansClusteringConfig.h:100
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
ipUInt32 _maxDictionarySize
maximum dictionary size for processing
Definition: KernelKMeansCentroid.h:181
Real64Vector _weights
weight factors for each elements of dictionary
Definition: KernelKMeansCentroid.h:188
std::vector< ipReal64 > Real64Vector
stl vector collections
Definition: BaseCollections.h:37
uint64_t ipUInt64
Base types definition.
Definition: BaseTypes.h:55
Matrix _matK
K Matrix used to store approximate linear dependance system condition.
Definition: KernelKMeansCentroid.h:198
IPSDK_FORCEINLINE PackT sqrt(const PackT &in)
returns the square root of a pack
Definition: sqrt.h:40
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
Predefined constants for ipsdk math library.
boost::numeric::ublas::vector< ipReal64 > Vector
vector type associated to library
Definition: LinearAlgebraTypes.h:36
Vector _wkVec
working array
Definition: KernelKMeansCentroid.h:210
std::vector< Vector > VectorColl
collection of vectors
Definition: ClusteringTypes.h:31
Matrix _wkMat
working array
Definition: KernelKMeansCentroid.h:209
#define IPSDKMATH_API
Import/Export macro for library IPSDKMath.
Definition: IPSDKMathExports.h:27
static ipUInt32 getDefaultMaxDictionarySize()
retrieve default maximum dictionary size for processing
Definition: KernelKMeansCentroid.h:82
IPSDK_FORCEINLINE ipReal64 distance(const T x1, const T y1, const T x2, const T y2)
Euclidian distance between 2d points.
Definition: Point2d.h:30
ipUInt64 _nbSamples
number of added samples
Definition: KernelKMeansCentroid.h:191
Matrix _invMatK
Inverse of K Matrix.
Definition: KernelKMeansCentroid.h:201
static ipUInt32 getDefaultMaxDictionarySize()
function allowinf to retrieve default maximum dictionary size for processing
Definition: KernelKMeansClusteringConfig.h:116
Vector _wkVecMixedTerms
working array
Definition: KernelKMeansCentroid.h:212
VectorColl _dictionary
Definition: KernelKMeansCentroid.h:185
static ipReal64 getDefaultAccuracyThreshold()
retrieve default accuracy threshold value
Definition: KernelKMeansCentroid.h:66
std::pair< ipReal64, ipUInt32 > _minStrengthInfo
Definition: KernelKMeansCentroid.h:205
Predefined types for clustering algorithm.
ipReal64 _accuracyThreshold
accuracy threshold value for approximate linear dependence condition
Definition: KernelKMeansCentroid.h:178
IPSDK_FORCEINLINE ipReal64 comparable_distance(const ipsdk::math::Vector &v0, const ipsdk::math::Vector &v1)
function allowing to compute comparable distance between two vectors
Definition: LinearAlgebraUtils.h:33
std::pair< ipReal64, bool > _clusterTermInfo
Definition: KernelKMeansCentroid.h:195
Vector _wkVecA
working array
Definition: KernelKMeansCentroid.h:211
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53