public class Prediction extends Object
Modifier and Type | Field and Description |
---|---|
static double |
G
All rates (apprehension rates, attempt rates) are entered and
printed on the scale [0:G], rather than [0:1], while the
internal representation of the rates, and all math involved,
are on the [0:1] scale.
|
Constructor and Description |
---|
Prediction(int K,
String[] line)
Constructs a Prediction object from an array of strings (which could be obtained e.g by splitting a line of text from a CSV input file).
|
Prediction(int K,
String _expertName,
String[] line)
Constructs a Prediction object using an array of strings (which could be obtained e.g by splitting a line of text from a CSV input file).
|
Prediction(String _expertName,
double _apprehensionRate,
double[] _attemptRates) |
Modifier and Type | Method and Description |
---|---|
void |
computeD(double[] trueProb)
Computes the normalized JS-divergence between this prediction's
vector of observables and the "true" one.
|
double[] |
computeObservableProbs()
Computes a vector of observables probabilities: probabilities
of the person been seen (apprehended) in each of the K periods,
and (the last element) the probability of the person never been
seen.
|
static String |
getApprehensionRate(String[] csv) |
static String |
getAttemptRate(String[] csv,
int i) |
static double |
njsDiv(double[] p,
double[] q)
Normalized Jensen-Shannon divergence (JSD(p,q)/log(2)) between two probability distributions.
|
String |
toString() |
String |
toString(boolean ext,
boolean html) |
String |
toString1()
Prints out the content as a String in CSV format.
|
static Prediction |
weightedAvg(Vector<Prediction> predictions)
Computes the weighted average of all predictions.
|
public static final double G
public Prediction(String _expertName, double _apprehensionRate, double[] _attemptRates)
_expertName
- the name of the expert who has supplied the prediction_apprehensionRate
- The expert's estimate of the apprehension rate during the K observation periods_attemptRates
- An array whose length is K+2, containing the expert's estimates of border crossing attempt rates for the K periods, the open-ended "even later" period, and the "never attempt" rate. The numbers should sum to 1public Prediction(int K, String[] line)
K
- the number of observation periodsline
- An array of K+4 strings that contain the expert's name and the human-readabale decimal representation of numbers (on the 0 to G
scale), viz.
{name, apprehensionRate, attemptRate[0], ..., attemptRate[K-1], attemptRate[evenLater], noAttemptRate}
For example, the line
"Expert Joe",33.3,10,10,10,20,50had the apprehensionRate of 33.3%, the attempt rates of 10% in each of the K=3 periods, the "even later" attempt rate of 20%, and deterrance rate of 50%.
public Prediction(int K, String _expertName, String[] line)
K
- the number of observation periods_expertName
- the name of the expert who has supplied the predictionline
- An array of K+3 strings that contain human-readabale decimal representation of numbers, viz.
{apprehensionRate, attemptRate[0], ..., attemptRate[K-1], attemptRate[evenLater], noAttemptRate}public static String getApprehensionRate(String[] csv)
public static String getAttemptRate(String[] csv, int i)
public String toString1()
public String toString(boolean ext, boolean html)
ext
- If true, print d and weight toohtml
- If true, print as a series of TD boxespublic static double njsDiv(double[] p, double[] q)
public double[] computeObservableProbs()
public void computeD(double[] trueProb)
trueProb
- An array of K+1 non-negative real numbers in the range [0;1], summing to 1.0public static Prediction weightedAvg(Vector<Prediction> predictions)
predictions
- The predictions to average. Each element must already have its weight computed set.