Search in sources :

Example 1 with ExpressionBasedModelToFeatureBasedModelTranslation

use of com.sri.ai.praise.core.representation.classbased.featurebased.ExpressionBasedModelToFeatureBasedModelTranslation in project aic-praise by aic-sri-international.

the class UtilTest method main.

/**
 * Test if conversion between String model and ExpressionBasedModel is working.
 */
public static void main(String[] args) {
    String modelString = "random earthquake: Boolean;\n" + "random burglary: Boolean;\n" + "random alarm: Boolean;\n" + "earthquake 0.01;\n" + "burglary 0.1;\n" + "if earthquake\n" + "then if burglary\n" + "then alarm 0.95\n" + "else alarm 0.6\n" + "else if burglary\n" + "then alarm 0.9\n" + "else alarm 0.01;\n";
    List<HOGMProblemError> modelErrors = new ArrayList<>();
    HOGModel hogModel = parseModelStringToHOGMModel(modelString, modelErrors);
    ExpressionBasedModel expressionBasedModel = parseHOGModelToExpressionBasedModel(hogModel);
    System.out.println(expressionBasedModel.toString() + "\n");
    ExpressionBasedModelToFeatureBasedModelTranslation translation = new ExpressionBasedModelToFeatureBasedModelTranslation(expressionBasedModel, new LinkedList<>());
    System.out.println("translation : " + translation.featureBasedModel.toString());
}
Also used : HOGMProblemError(com.sri.ai.praise.core.inference.byinputrepresentation.classbased.hogm.parsing.HOGMProblemError) HOGModel(com.sri.ai.praise.core.representation.classbased.hogm.HOGModel) ExpressionBasedModel(com.sri.ai.praise.core.representation.classbased.expressionbased.api.ExpressionBasedModel) UsefulOperationsParameterEstimation.parseHOGModelToExpressionBasedModel(com.sri.ai.praise.learning.symbolicparameterestimation.util.UsefulOperationsParameterEstimation.parseHOGModelToExpressionBasedModel) ArrayList(java.util.ArrayList) ExpressionBasedModelToFeatureBasedModelTranslation(com.sri.ai.praise.core.representation.classbased.featurebased.ExpressionBasedModelToFeatureBasedModelTranslation)

Aggregations

HOGMProblemError (com.sri.ai.praise.core.inference.byinputrepresentation.classbased.hogm.parsing.HOGMProblemError)1 ExpressionBasedModel (com.sri.ai.praise.core.representation.classbased.expressionbased.api.ExpressionBasedModel)1 ExpressionBasedModelToFeatureBasedModelTranslation (com.sri.ai.praise.core.representation.classbased.featurebased.ExpressionBasedModelToFeatureBasedModelTranslation)1 HOGModel (com.sri.ai.praise.core.representation.classbased.hogm.HOGModel)1 UsefulOperationsParameterEstimation.parseHOGModelToExpressionBasedModel (com.sri.ai.praise.learning.symbolicparameterestimation.util.UsefulOperationsParameterEstimation.parseHOGModelToExpressionBasedModel)1 ArrayList (java.util.ArrayList)1