MCPcopy Index your code
hub / github.com/WinVector/Logistic / observe

Method observe

src/com/winvector/variables/BObserver.java:87–107  ·  view source on GitHub ↗

@param outcome training outcome @param level level of variable @param pred current model predictions @param correct category @paream weight>0.0

(final String outcome, final String level, final double[] pred, final int category, final double weight)

Source from the content-addressed store, hash-verified

85 * @paream weight>0.0
86 */
87 public void observe(final String outcome, final String level, final double[] pred, final int category, final double weight) {
88 sumTotal += weight;
89 totalByCategory[category] += weight;
90 BLevelRow blevelRow = levelStats.get(level);
91 if(null==blevelRow) {
92 blevelRow = new BLevelRow();
93 levelStats.put(level,blevelRow);
94 }
95 blevelRow.totalForLevel += weight;
96 blevelRow.totalByCorrectCategory[category] += weight;
97 for(int i=0;i<noutcomes;++i) {
98 blevelRow.sumPFixedCategory[i] += weight*pred[i];
99 if(category==i) {
100 blevelRow.sumRunFixedCategory[i] += weight*1.0/Math.max(pred[i],smallValue);
101 } else {
102 blevelRow.sumRunFixedCategory[i] += weight*-1.0/Math.max(1.0-pred[i],smallValue);
103 }
104 }
105 blevelRow.sumRunCorrectCategory[category] += weight*1.0/Math.max(pred[category],smallValue);
106 blevelRow.sumPCorrectCategory[category] += weight*pred[category];
107 }
108
109 public void observe(final BStat o) {
110 sumTotal += o.sumTotal;

Callers 1

observeMethod · 0.95

Calls 3

observeMethod · 0.95
sumLeftMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected