/
main.cpp
61 lines (45 loc) · 1.46 KB
/
main.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
#include <flame.h>
#include <stdio.h>
#include <random>
void printArray( int* arr, int n )
{
printf( "[ " );
for( int i = 0; i < n; i++)
printf( "%i, ", arr[i] );
printf( "]" );
}
int main()
{
float **data = nullptr;
int i, j, N = 1000, M = 2;
FILE *fin;
// fin = fopen( "C:\\Users\\Lazar\\Desktop\\flame-clustering-master\\matrix.txt", "r" );
// fscanf( fin, "%i %i\n", & N, & M );
// printf( "Reading dataset with %i rows and %i columns\n", N, M );
printf( "Creating dataset with %i rows and %i columns\n", N, M );
data = new float*[ N ];
for( i=0; i<N; i++ ){
data[i] = new float[ M ];
for( j=0; j<M; j++ )
data[i][j] = (rand() % 100000) / 100.0;
// fscanf( fin, "%f ", & data[i][j] );
// printf("data: %f, %f \n", data[i][0], data[i][1] );
}
printf( "Putting data into Flame class.\n" );
Flame flame = Flame( data, N, M );
printf( "Detecting Cluster Supporting Objects ..." );
fflush(stdout);
flame.defineSupports( 10, .5 );
printf( "done, found %i\n", flame.getCsoCount() );
printf( "Propagating fuzzy memberships ... " );
fflush( stdout );
flame.localApproximation( 500, 1e-6 );
printf( "done\n" );
printf( "Defining clusters from fuzzy memberships ... " );
fflush( stdout );
flame.makeClusters( -1.0 );
printf( "done\n" );
printArray( flame.getClusters(), flame.getN() );
printf( "All done.\n" );
return 0;
}