Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add completion mode and stats for more prediction insight
- Loading branch information
1 parent
37597f4
commit f6c1154
Showing
3 changed files
with
126 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package slp.core.modeling.runners; | ||
|
||
import java.util.List; | ||
|
||
import slp.core.util.Pair; | ||
|
||
public class Completion { | ||
private final Integer realIx; | ||
private final List<Pair<Integer, Double>> completions; | ||
|
||
public Completion(Integer realIx, List<Pair<Integer, Double>> predictions) { | ||
this.realIx = realIx; | ||
this.completions = predictions; | ||
} | ||
|
||
public Completion(List<Pair<Integer, Double>> predictions) { | ||
this.realIx = null; | ||
this.completions = predictions; | ||
} | ||
|
||
public List<Pair<Integer, Double>> getPredictions() { | ||
return completions; | ||
} | ||
|
||
public Integer getRealIx() { | ||
return realIx; | ||
} | ||
|
||
public int getRank() { | ||
if (this.realIx == null) return -1; | ||
else { | ||
for (int i = 0; i < this.completions.size(); i++) { | ||
if (this.completions.get(i).left.equals(this.realIx)) { | ||
return i; | ||
} | ||
} | ||
return -1; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters