forked from pthimon/clustering
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpectralClustering.h
48 lines (40 loc) · 1.02 KB
/
SpectralClustering.h
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* SpectralClustering.h
*
* Takes an affinity matrix and calculates the eigenvectors
* Then different clustering algorithms can be applied
*
* Created on: 04-Mar-2009
* Author: sbutler
*/
#ifndef SPECTRALCLUSTERING_H_
#define SPECTRALCLUSTERING_H_
#include <vector>
#include <Eigen/Core>
class SpectralClustering {
public:
/**
* Performs eigenvector decomposition of an affinity matrix
*
* @param data the affinity matrix
* @param numDims the number of dimensions to consider when clustering
*/
SpectralClustering(Eigen::MatrixXd& data, int numDims);
virtual ~SpectralClustering();
/**
* Cluster by rotating the eigenvectors and evaluating the quality
*/
std::vector<std::vector<int> > clusterRotate();
/**
* Cluster by kmeans
*
* @param numClusters the number of clusters to assign
*/
std::vector<std::vector<int> > clusterKmeans(int numClusters);
int getNumClusters();
protected:
int mNumDims;
Eigen::MatrixXd mEigenVectors;
int mNumClusters;
};
#endif /* SPECTRALCLUSTERING_H_ */