-
Notifications
You must be signed in to change notification settings - Fork 1
/
FeatureStateAnalysis.cpp
61 lines (51 loc) · 2.07 KB
/
FeatureStateAnalysis.cpp
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
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// FeatureStateAnalysis.cpp
// FFT Chain
//
// Created by Thomas Rushmore on 10/03/2013.
// Copyright (c) 2013 Thomas Rushmore. All rights reserved.
//
#include "FeatureStateAnalysis.h"
FeatureStateAnalysis::FeatureStateAnalysis()
{
}
FeatureStateAnalysis::~FeatureStateAnalysis()
{
printf("\n*-------Clustering Phase Destructor------*\n");
}
void FeatureStateAnalysis::KdTreeCluster(const u_short_int num_clusters, const u_short_int num_iterations)
{
printf("\n*-----------------Clustering Phase-----------------*\n");
RetrieveDatabase();
kMClustering.SetClusterParameters(num_clusters,num_iterations,database.GetNumFrames(), database.GetNumMFCCCoefs(),MFCCGROUPING);
kMClustering.KdTreeCluster(database.GetMFCCMatrix());
state_mfccs.SetupWrite(kMClustering.GetNActiveClusters(), database.GetNumMFCCCoefs()*MFCCGROUPING, database.GetFFTLength(),database.GetNumTracks());
state_mfccs.SetMFCCFFTPairs(database.GetMFCCMatrix(), database.GetFFTMatrix(), kMClustering.GetBestFitIndices());
state_mfccs.WriteMFCCFFTPairs();
printf("*------------Clustering Phase Complete-------------*\n\n");
}
void FeatureStateAnalysis::Cluster(const u_short_int num_clusters,const u_short_int num_iterations)
{
RetrieveDatabase();
kMClustering.SetClusterParameters(num_clusters,num_iterations,database.GetNumFrames(), database.GetNumMFCCCoefs(),MFCCGROUPING);
kMClustering.Cluster(database.GetMFCCMatrix());
state_mfccs.SetupWrite(kMClustering.GetNActiveClusters(), database.GetNumMFCCCoefs(), database.GetFFTLength(),database.GetNumTracks());
state_mfccs.SetMFCCFFTPairs(database.GetMFCCMatrix(), database.GetFFTMatrix(), kMClustering.GetBestFitIndices());
state_mfccs.WriteMFCCFFTPairs();
}
void FeatureStateAnalysis::RetrieveDatabase()
{
database.ReadFileGroup(0,MFCCGROUPING,0);
}
double** FeatureStateAnalysis::GetGroupedMFCCMat()
{
return database.GetMFCCMatrix();
}
int FeatureStateAnalysis::GetGroupedMFCCDimen()
{
return kMClustering.GetNumCoefGrouped();
}
int FeatureStateAnalysis::GetGroupedMFCCSize()
{
return database.GetGroupedS();
}