Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/undo-ransomware/ransomware_detection.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Entropy/Entropy.php')
-rw-r--r--lib/Entropy/Entropy.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Entropy/Entropy.php b/lib/Entropy/Entropy.php
index 36fde3c..798db8b 100644
--- a/lib/Entropy/Entropy.php
+++ b/lib/Entropy/Entropy.php
@@ -57,6 +57,10 @@ class Entropy
return $entropy;
}
+ public function streamStandardDeviation($n, $sum, $mean) {
+ return sqrt((1 / $n) * $sum - pow($mean, 2));
+ }
+
/**
* Calculates the standard deviation.
*
@@ -83,4 +87,14 @@ class Entropy
return 0.0;
}
+
+ public function streamMean($oldMean, $value, $step) {
+ $mean = 0;
+ if ($step === 1) {
+ $mean = (($step - 1) / $step) + ($value / $step);
+ } else {
+ $mean = $oldMean * (($step - 1) / $step) + ($value / $step);
+ }
+ return $mean;
+ }
}