Revised modeling
This commit is contained in:
@@ -86,8 +86,11 @@ public class FoodNetBuilder {
|
|||||||
DataPoint normPoint = new DataPoint(point);
|
DataPoint normPoint = new DataPoint(point);
|
||||||
for (String key : point.keySet()) {
|
for (String key : point.keySet()) {
|
||||||
if (onto.getInheritance().containsKey(key)) {
|
if (onto.getInheritance().containsKey(key)) {
|
||||||
normPoint
|
if(point.get(key).getValue().equals(TRUE_VALUE)){
|
||||||
.add(build(onto.getInheritance().get(key), TRUE_VALUE));
|
normPoint.add(build(onto.getInheritance().get(key), TRUE_VALUE));
|
||||||
|
} else {
|
||||||
|
normPoint.add(build(onto.getInheritance().get(key), FALSE_VALUE));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,17 +128,32 @@ public class FoodNetBuilder {
|
|||||||
Ingredients ingredients = recipe.getIngredients();
|
Ingredients ingredients = recipe.getIngredients();
|
||||||
|
|
||||||
if (ingredients.contains(TYPE.BEEF)) {
|
if (ingredients.contains(TYPE.BEEF)) {
|
||||||
|
if(weight > 5) {
|
||||||
point.add(build(CONTAINS_BEEF, TRUE_VALUE));
|
point.add(build(CONTAINS_BEEF, TRUE_VALUE));
|
||||||
|
} else {
|
||||||
|
point.add(build(CONTAINS_BEEF, FALSE_VALUE));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ingredients.contains(TYPE.PORK)) {
|
if (ingredients.contains(TYPE.PORK)) {
|
||||||
|
if(weight > 5) {
|
||||||
point.add(build(CONTAINS_PORK, TRUE_VALUE));
|
point.add(build(CONTAINS_PORK, TRUE_VALUE));
|
||||||
|
} else {
|
||||||
|
point.add(build(CONTAINS_PORK, FALSE_VALUE));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ingredients.contains(TYPE.POTATO)) {
|
if (ingredients.contains(TYPE.POTATO)) {
|
||||||
|
if(weight > 5) {
|
||||||
point.add(build(CONTAINS_POTATOS, TRUE_VALUE));
|
point.add(build(CONTAINS_POTATOS, TRUE_VALUE));
|
||||||
|
} else {
|
||||||
|
point.add(build(CONTAINS_POTATOS, FALSE_VALUE));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ingredients.contains(TYPE.TOMATO)) {
|
if (ingredients.contains(TYPE.TOMATO)) {
|
||||||
|
if(weight > 5) {
|
||||||
point.add(build(CONTAINS_TOMATOS, TRUE_VALUE));
|
point.add(build(CONTAINS_TOMATOS, TRUE_VALUE));
|
||||||
}
|
} else {
|
||||||
|
point.add(build(CONTAINS_TOMATOS, FALSE_VALUE));
|
||||||
|
} }
|
||||||
/*
|
/*
|
||||||
* if (ingredients.contains(TYPE.GENERIC_NUTS)) {
|
* if (ingredients.contains(TYPE.GENERIC_NUTS)) {
|
||||||
* point.add(build(CONTAINS_GENERIC_NUTS, TRUE_VALUE)); }
|
* point.add(build(CONTAINS_GENERIC_NUTS, TRUE_VALUE)); }
|
||||||
|
|||||||
@@ -99,9 +99,6 @@ public class EnumerateAll {
|
|||||||
temp.addAll(assignments);
|
temp.addAll(assignments);
|
||||||
temp.add(new Assignment(variable, value));
|
temp.add(new Assignment(variable, value));
|
||||||
|
|
||||||
if(net.getNodes().get(variable.getName()).eval(temp) == null) {
|
|
||||||
System.out.println(variable.getName());
|
|
||||||
}
|
|
||||||
// then evaluate this variable
|
// then evaluate this variable
|
||||||
double val = net.getNodes().get(variable.getName()).eval(temp)
|
double val = net.getNodes().get(variable.getName()).eval(temp)
|
||||||
.getProbability();
|
.getProbability();
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class BayesChef {
|
|||||||
int comparisonIndexEnd = numSurveyDishes;
|
int comparisonIndexEnd = numSurveyDishes;
|
||||||
|
|
||||||
//TODO change this to include min/max recipe indices for building the net
|
//TODO change this to include min/max recipe indices for building the net
|
||||||
BayesNet net = FoodNetBuilder.createDishNet(survey, recipeBook, bayesNetIndexStart, bayesNetIndexEnd);
|
BayesNet net = FoodNetBuilder.createDishNet(survey, recipeBook, bayesNetIndexStart, bayesNetIndexEnd);// FoodNetBuilder.createDishNet(survey, recipeBook, bayesNetIndexStart, bayesNetIndexEnd);
|
||||||
|
|
||||||
System.out.println("Querying Bayes net for predicted flavor preferences: ");
|
System.out.println("Querying Bayes net for predicted flavor preferences: ");
|
||||||
//TODO change this to query actual flavor combos from latter half of survey
|
//TODO change this to query actual flavor combos from latter half of survey
|
||||||
|
|||||||
Reference in New Issue
Block a user