kmeans upgrade
This commit is contained in:
parent
09d33644c9
commit
2ff209a38b
|
@ -8,9 +8,9 @@ gboolean kmeans(struct data_frame *df,unsigned long long int *count_A,unsigned l
|
||||||
unsigned long long int *count_C,long double *A,long double *B,long double *C)
|
unsigned long long int *count_C,long double *A,long double *B,long double *C)
|
||||||
{
|
{
|
||||||
float CURR_FREQ = to_intconvertor(df->dpmu[0]->freq);
|
float CURR_FREQ = to_intconvertor(df->dpmu[0]->freq);
|
||||||
long double diff_A = abs(*A-CURR_FREQ);
|
long double diff_A = fabs(*A-CURR_FREQ);
|
||||||
long double diff_B = abs(*B-CURR_FREQ);
|
long double diff_B = fabs(*B-CURR_FREQ);
|
||||||
long double diff_C = abs(*C-CURR_FREQ);
|
long double diff_C = fabs(*C-CURR_FREQ);
|
||||||
printf("A: %Lf, B: %Lf, C: %Lf\n",*A,*B,*C);
|
printf("A: %Lf, B: %Lf, C: %Lf\n",*A,*B,*C);
|
||||||
if(diff_A <= diff_B && diff_A <= diff_C){
|
if(diff_A <= diff_B && diff_A <= diff_C){
|
||||||
*A = ((*count_A*(*A))+CURR_FREQ)/(++*count_A);
|
*A = ((*count_A*(*A))+CURR_FREQ)/(++*count_A);
|
||||||
|
|
Loading…
Reference in New Issue