Class StatsUtil
java.lang.Object
be.kuleuven.cs.distrinet.sparta.core.analysis.StatsUtil
This class provides a number of simple statistical helper functions.
-
Method Summary
Modifier and TypeMethodDescriptionstatic double[]calcSeqVulnerability(double[] tcap, double[]... diffs) Calculate the vulnerability of set of attack attempts.static double[]calcVulnerability(double[] tcap, double[] diffs) Calculate the vulnerability of set of attack attempts.static double[]ebeMult(double[] value1, double[] value2) Provide the element-by-element multiplication of double[]static doublemax(double[] values) Calculate the maximum value in a double[].static doublemedian(double[] valuation) Get the median element of a double[]static doublemin(double[] values) Calculate the minimum value in a double[].static doublemode(double[] values) Calculate the mode of a double[].static doublemode(double[] values, int numbins) Calculate the mode of a double[].static double[]scalProd(double[] vect, double mult) Do a scalar multiplication of a double[] vector.
-
Method Details
-
max
public static double max(double[] values) Calculate the maximum value in a double[].- Parameters:
values- - the double[] to use- Returns:
- the maximum
-
min
public static double min(double[] values) Calculate the minimum value in a double[].- Parameters:
values- - the double[] to use- Returns:
- the minimum
-
mode
public static double mode(double[] values) Calculate the mode of a double[].- Parameters:
values- - the double[] to use- Returns:
- the mode
-
mode
public static double mode(double[] values, int numbins) Calculate the mode of a double[].- Parameters:
values- - the double[] to usenumbins- - the number of bins to use for counting- Returns:
- the mode
-
calcVulnerability
public static double[] calcVulnerability(double[] tcap, double[] diffs) Calculate the vulnerability of set of attack attempts.- Parameters:
tcap- - the threat capabilitiesdiffs- - the difficulties of the countermeasure- Returns:
- a double[] with 0/1 indicating whether the attack attempt was successful or not
-
calcSeqVulnerability
public static double[] calcSeqVulnerability(double[] tcap, double[]... diffs) Calculate the vulnerability of set of attack attempts.- Parameters:
tcap- - the threat capabilitiesdiffs- - the difficulties of multiple countermeasures- Returns:
- a double[] with 0/1 indicating whether the attack attempt was successful or not
-
ebeMult
public static double[] ebeMult(double[] value1, double[] value2) Provide the element-by-element multiplication of double[]- Parameters:
value1- - first arrayvalue2- - second array- Returns:
- The element-wise product of the two arrays.
-
median
public static double median(double[] valuation) Get the median element of a double[]- Parameters:
valuation- the double[] from which to retrieve the median- Returns:
- the median of the double[]
-
scalProd
public static double[] scalProd(double[] vect, double mult) Do a scalar multiplication of a double[] vector.- Parameters:
vect- - the vectormult- - the scalar- Returns:
- the scalar product
-