Skip to content

Commit 82bee1b

Browse files
committed
cleaned up
1 parent ccada3b commit 82bee1b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

boqa-core/src/main/java/org/p2gx/boqa/core/algorithm/AlgorithmParameters.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* Alpha and beta are fixed (across all diseases and patients) for a single run.
66
*
77
* {@code ALPHA} represents the probability of a false positive, {@code BETA} that of a false negative.
8+
* {@code TEMPERATURE} (or T) can be used to temper the posterior distribution. The posterior is effectively raised
9+
* to the 1/T-th power, or, equivalently, this can be seen as taking the T-th root.
810
*/
911
public final class AlgorithmParameters {
1012
private static final double DEFAULT_ALPHA = 1.0 / 19077;
@@ -43,8 +45,9 @@ public static AlgorithmParameters create() {
4345
*
4446
* @param alpha the alpha parameter (false positive probability), or null for default
4547
* @param beta the beta parameter (false negative probability), or null for default
48+
* @param temperature the inverse of the exponent for the posterior, or null for default
4649
* @return AlgorithmParameters instance
47-
* @throws IllegalArgumentException if alpha or beta is not in the range (0, 1)
50+
* @throws IllegalArgumentException if alpha or beta is not in the range (0, 1) and temperature is less than 1
4851
*/
4952
public static AlgorithmParameters create(Double alpha, Double beta, Double temperature) {
5053
double a = (alpha != null) ? alpha : DEFAULT_ALPHA;

boqa-core/src/main/java/org/p2gx/boqa/core/analysis/BoqaPatientAnalyzer.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public static BoqaAnalysisResult computeBoqaResults(
9999
.mapToDouble(r -> Math.exp(r.boqaScore() - maxLogP))
100100
.sum();
101101
} else {
102+
// Alternative to Standard BOQA
102103
// Non-unit temperature normalizes trivially by largest score, which is already present below
103104
normalizationFactor = 1.0;
104105
}
@@ -118,11 +119,7 @@ public static BoqaAnalysisResult computeBoqaResults(
118119
* <p>
119120
* log(P) = [fp × log(α) + fn × log(β) + tn × log(1-α) + tp × log(1-β)] / T
120121
* </p>
121-
* <p>
122-
* P = α<sup>fpBoqaCount</sup> × β<sup>fpBoqaCount</sup> ×
123-
* (1-α)<sup>fnBoqaCount</sup> × (1-β)<sup>tpBoqaCount</sup>
124-
* </pre>
125-
* @param params alpha, beta, log(alpha), log(beta) etc.
122+
* @param params alpha, beta, log(alpha), log(beta), termperature T etc.
126123
* @param counts The {@link BoqaCounts} for a query and a disease.
127124
* @return The un-normalized BOQA log probability score.
128125
*/

0 commit comments

Comments
 (0)