Warning: session_start(): open(/var/lib/php/sessions/sess_tbong9hpn57lr2cjl9j8mpupke, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
sclass OneColorTheoryChecker {
replace Cell with URecognizer.Cell.
new ProbabilisticScheduler scheduler;
record OneColorTheory(S text, Cell cell, RGB color) {
}
OneColorTheory makeOneColorTheory(Cell cell) {
var color = cell.averageColor();
var theory = new OneColorTheory("Color of every pixel in $cell is $color.", cell, color);
testOneColorTheory(cell, theory);
ret theory;
}
void noteCellColor(Cell cell, OneColorTheory theory) {
var desc = "Pixel check at " + cell;
if (theory.hasExampleNamed(desc)) return;
var strength = doubleRatio(cell.area(), theory.cell.area()); // how much do we have to say about the cell in the theory?
var p = colorDistanceToProbability(cell.averageColor(), theory.color);
addExampleToTheory(theory, desc, p, strength);
}
double colorDistanceToProbability(RGB col1, RGB col2) {
ret sqr(colorSimilarity(col1, col2));
}
void testOneColorTheory(Cell cell, OneColorTheory theory) {
noteCellColor(cell, theory);
scheduler.at(shouldSplitCell(cell), r {
for (var split : usefulSplits(cell))
scheduler.at(split.probability(), r {
for (var cell : split!)
testOneColorTheory(cell, theory.branch(description := "recursion to " + cell));
});
});
}
L> usefulSplits(Cell cell) {
ret map withProbability1(llNonNulls(cell.split(0), cell.split(1)));
}
double shouldSplitCell(Cell cell) {
ret 1.0;
}
}