Search in sources :

Example 6 with TableFactorNetwork

use of com.sri.ai.praise.core.representation.interfacebased.factor.core.table.TableFactorNetwork in project aic-praise by aic-sri-international.

the class BenchmarkingIsingModel method testAEBPP.

private static void testAEBPP(AEBPTestingDataFrame df, int runNumber, int timeLimit, List<TableFactor> network, TableVariable query, String netName) {
    TableFactorNetwork factorNet = new TableFactorNetwork(network);
    println("solveWithExactBP : " + netName + "; iteration: " + runNumber);
    AEBPTestingDataFrame dfToAdd = solveWithGabriels(query, factorNet, timeLimit, netName, runNumber);
    addRowsFromSecondDfToFirstDf(df, dfToAdd);
    toCsv(df);
}
Also used : TableFactorNetwork(com.sri.ai.praise.core.representation.interfacebased.factor.core.table.TableFactorNetwork) AEBPTestingDataFrame(com.sri.ai.util.rplot.dataframe.AEBPTestingDataFrame)

Example 7 with TableFactorNetwork

use of com.sri.ai.praise.core.representation.interfacebased.factor.core.table.TableFactorNetwork in project aic-praise by aic-sri-international.

the class BenchmarkingIsingModel method testEBPP.

private static void testEBPP(AEBPTestingDataFrame df, int nRepetitions, List<TableFactor> network, TableVariable query, String netName) {
    TableFactorNetwork factorNetwork = new TableFactorNetwork(network);
    ExactBPNode<Variable, Factor> exactBP = new ExactBP(query, factorNetwork);
    for (int i = 0; i < nRepetitions; i++) {
        println("solveWithExactBP : " + netName);
        Pair<Double, Factor> p = solveAndPrint(exactBP);
        df.addRow(// run number
        i, // iteration
        -1, // minPTrue
        ((TableFactor) p.second).getEntries().get(0), // MaxPTrue
        ((TableFactor) p.second).getEntries().get(0), // iteration time
        p.first, // total time
        p.first, // InferenceMethodUsed
        "ExactBP", // GraphicalModelName
        netName + "; query: " + query.toString());
    }
}
Also used : Variable(com.sri.ai.praise.core.representation.interfacebased.factor.api.Variable) TableVariable(com.sri.ai.praise.core.representation.interfacebased.factor.core.table.TableVariable) TableFactor(com.sri.ai.praise.core.representation.interfacebased.factor.core.table.TableFactor) ExactBP(com.sri.ai.praise.core.inference.byinputrepresentation.interfacebased.core.exactbp.fulltime.core.ExactBP) TableFactor(com.sri.ai.praise.core.representation.interfacebased.factor.core.table.TableFactor) Factor(com.sri.ai.praise.core.representation.interfacebased.factor.api.Factor) TableFactorNetwork(com.sri.ai.praise.core.representation.interfacebased.factor.core.table.TableFactorNetwork)

Example 8 with TableFactorNetwork

use of com.sri.ai.praise.core.representation.interfacebased.factor.core.table.TableFactorNetwork in project aic-praise by aic-sri-international.

the class TestCases method uaiModelToListOfTableFactors.

public static ArrayList<TableFactor> uaiModelToListOfTableFactors(UAIModel model) {
    TableFactorNetwork net = new TableFactorNetwork(model);
    ArrayList<TableFactor> result = mapIntoArrayList(net.getAs(), (fwrapper) -> (TableFactor) fwrapper.getObject());
    return result;
}
Also used : TableFactor(com.sri.ai.praise.core.representation.interfacebased.factor.core.table.TableFactor) TableFactorNetwork(com.sri.ai.praise.core.representation.interfacebased.factor.core.table.TableFactorNetwork)

Aggregations

TableFactorNetwork (com.sri.ai.praise.core.representation.interfacebased.factor.core.table.TableFactorNetwork)8 TableVariable (com.sri.ai.praise.core.representation.interfacebased.factor.core.table.TableVariable)5 AEBPTestingDataFrame (com.sri.ai.util.rplot.dataframe.AEBPTestingDataFrame)4 TableFactor (com.sri.ai.praise.core.representation.interfacebased.factor.core.table.TableFactor)3 Variable (com.sri.ai.praise.core.representation.interfacebased.factor.api.Variable)2 ExactBP (com.sri.ai.praise.core.inference.byinputrepresentation.interfacebased.core.exactbp.fulltime.core.ExactBP)1 UAIModel (com.sri.ai.praise.core.representation.classbased.table.core.uai.UAIModel)1 Factor (com.sri.ai.praise.core.representation.interfacebased.factor.api.Factor)1 Util.mapIntoArrayList (com.sri.ai.util.Util.mapIntoArrayList)1 Pair (com.sri.ai.util.base.Pair)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 FileReader (java.io.FileReader)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1