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:
authorMatthias Held <ilovemilk@wusa.io>2019-05-19 20:25:32 +0300
committerMatthias Held <ilovemilk@wusa.io>2019-05-19 20:25:32 +0300
commit1999852dd4c45e92982613d5946352a0a4b6a796 (patch)
treeaa406ab97266f687e4654d4e538fd8b0fbf8d0e0 /lib/Entropy
parent16bfb4fd5d8d50863d4ec5cc156c4f1ad725e338 (diff)
improve documentation and naming
Diffstat (limited to 'lib/Entropy')
-rw-r--r--lib/Entropy/Entropy.php28
1 files changed, 25 insertions, 3 deletions
diff --git a/lib/Entropy/Entropy.php b/lib/Entropy/Entropy.php
index 9f4f038..96b152e 100644
--- a/lib/Entropy/Entropy.php
+++ b/lib/Entropy/Entropy.php
@@ -57,11 +57,33 @@ class Entropy
return $entropy;
}
- public function streamStandardDeviation($n, $sum, $mean) {
- return sqrt((1 / $n) * $sum - pow($mean, 2));
+ /**
+ * Calculates the standard deviation of a continoues series by passing
+ * the current number of values used to calculate the standard deviation
+ * the sum of all these values and the mean of all these values.
+ *
+ * @param float $step current value
+ * @param float $sum sum of all values
+ * @param float $mean mean of all values
+ *
+ * @return float
+ */
+ public function calculateStandardDeviationOfSeries($step, $sum, $mean) {
+ return sqrt((1 / $step) * $sum - pow($mean, 2));
}
- public function streamMean($oldMean, $value, $step) {
+ /**
+ * Calculates the mean of a continoues series by passing the old mean
+ * the new value and the number of values used to calculate the mean
+ * including the new one.
+ *
+ * @param float $oldMean
+ * @param float $value
+ * @param float $step
+ *
+ * @param float
+ */
+ public function calculateMeanOfSeries($oldMean, $value, $step) {
$mean = 0;
if ($step === 1) {
$mean = (($step - 1) / $step) + ($value / $step);