mirror of
https://github.com/BlackLight/Snort_AIPreproc.git
synced 2024-11-14 12:47:16 +01:00
Fixed a logical error in the neural correlation
This commit is contained in:
parent
cddaa2b3a7
commit
50f287fbb5
1 changed files with 5 additions and 3 deletions
8
neural.c
8
neural.c
|
@ -272,8 +272,10 @@ __AI_som_alert_distance ( const AI_som_alert_tuple alert1, const AI_som_alert_tu
|
|||
|
||||
/* Return the normalized euclidean distance in [0,1] (the normalization is made considering that the maximum distance
|
||||
* between two points on the output neurons matrix is the distance between the upper-left and bottom-right points) */
|
||||
return sqrt ((double) ( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) )) /
|
||||
sqrt ((double) ( 2 * (config->outputNeuronsPerSide-1) * (config->outputNeuronsPerSide-1) ));
|
||||
/* return sqrt ((double) ( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) )) / */
|
||||
/* sqrt ((double) ( 2 * (config->outputNeuronsPerSide-1) * (config->outputNeuronsPerSide-1) )); */
|
||||
|
||||
return sqrt ((double) ( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) ));
|
||||
} /* ----- end of function __AI_som_alert_distance ----- */
|
||||
|
||||
/**
|
||||
|
@ -308,7 +310,7 @@ AI_alert_neural_som_correlation ( const AI_snort_alert *a, const AI_snort_alert
|
|||
t2.timestamp = b->timestamp;
|
||||
t2.desc = b->desc;
|
||||
|
||||
return __AI_som_alert_distance ( t1, t2 );
|
||||
return 1.0 / ( 1.0 + __AI_som_alert_distance ( t1, t2 ));
|
||||
} /* ----- end of function AI_alert_neural_som_correlation ----- */
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue