Work in progress - rough draft.

This commit is contained in:
Woody Folsom
2012-03-12 20:33:42 -04:00
parent 03201217a1
commit 53fddc965a
7 changed files with 236 additions and 176 deletions

View File

@@ -25,7 +25,7 @@ public class FoodNetBuilder {
public static final String TASTE = "Taste"; public static final String TASTE = "Taste";
public static final String SOMEONE_VEGETARIAN = "vegetarian"; public static final String SOMEONE_VEGETARIAN = "vegetarian";
public static final String SOMEONE_ALLERGIC_NUTS = "allergic-nuts"; //public static final String SOMEONE_ALLERGIC_NUTS = "allergic-nuts";
public static final String CONTAINS_MEAT = "Meat"; public static final String CONTAINS_MEAT = "Meat";
public static final String CONTAINS_VEGETABLE = "Vegetable"; public static final String CONTAINS_VEGETABLE = "Vegetable";
@@ -33,8 +33,8 @@ public class FoodNetBuilder {
public static final String CONTAINS_PORK = TYPE.PORK.toString(); public static final String CONTAINS_PORK = TYPE.PORK.toString();
public static final String CONTAINS_TOMATOS = TYPE.TOMATO.toString(); public static final String CONTAINS_TOMATOS = TYPE.TOMATO.toString();
public static final String CONTAINS_POTATOS = TYPE.POTATO.toString(); public static final String CONTAINS_POTATOS = TYPE.POTATO.toString();
public static final String CONTAINS_NUTS = "Nuts"; //public static final String CONTAINS_NUTS = "Nuts";
public static final String CONTAINS_GENERIC_NUTS = TYPE.GENERIC_NUTS.toString(); //public static final String CONTAINS_GENERIC_NUTS = TYPE.GENERIC_NUTS.toString();
public static final String TRUE_VALUE = "true"; public static final String TRUE_VALUE = "true";
public static final String FALSE_VALUE = "false"; public static final String FALSE_VALUE = "false";
@@ -44,18 +44,18 @@ public class FoodNetBuilder {
public static final String RATING_DOMAIN[] = { "1", "2", "3", "4", "5", public static final String RATING_DOMAIN[] = { "1", "2", "3", "4", "5",
"6", "7", "8", "9", "10" }; "6", "7", "8", "9", "10" };
private static final String[] VARIABLES = { SOMEONE_VEGETARIAN, SOMEONE_ALLERGIC_NUTS, private static final String[] VARIABLES = { SOMEONE_VEGETARIAN, /*SOMEONE_ALLERGIC_NUTS,*/
CONTAINS_BEEF, CONTAINS_MEAT, CONTAINS_PORK, CONTAINS_POTATOS, CONTAINS_BEEF, CONTAINS_MEAT, CONTAINS_PORK, CONTAINS_POTATOS,
CONTAINS_TOMATOS, CONTAINS_VEGETABLE, CONTAINS_NUTS, CONTAINS_GENERIC_NUTS, TASTE }; CONTAINS_TOMATOS, CONTAINS_VEGETABLE, /*CONTAINS_NUTS, CONTAINS_GENERIC_NUTS,*/ TASTE };
private static final String[] OBSERVED = { CONTAINS_BEEF, CONTAINS_PORK, private static final String[] OBSERVED = { CONTAINS_BEEF, CONTAINS_PORK,
CONTAINS_POTATOS, CONTAINS_TOMATOS, CONTAINS_GENERIC_NUTS}; CONTAINS_POTATOS, CONTAINS_TOMATOS/*, CONTAINS_GENERIC_NUTS*/};
public static Ontology createOntology() { public static Ontology createOntology() {
HashSet<String> classes = new HashSet<String>(); HashSet<String> classes = new HashSet<String>();
classes.add(CONTAINS_MEAT); classes.add(CONTAINS_MEAT);
classes.add(CONTAINS_NUTS); //classes.add(CONTAINS_NUTS);
classes.add(CONTAINS_VEGETABLE); classes.add(CONTAINS_VEGETABLE);
Ontology ontology = new Ontology(classes); Ontology ontology = new Ontology(classes);
@@ -63,7 +63,7 @@ public class FoodNetBuilder {
ontology.define(CONTAINS_PORK, CONTAINS_MEAT); ontology.define(CONTAINS_PORK, CONTAINS_MEAT);
ontology.define(CONTAINS_BEEF, CONTAINS_MEAT); ontology.define(CONTAINS_BEEF, CONTAINS_MEAT);
ontology.define(CONTAINS_GENERIC_NUTS, CONTAINS_NUTS); //ontology.define(CONTAINS_GENERIC_NUTS, CONTAINS_NUTS);
ontology.define(CONTAINS_TOMATOS, CONTAINS_VEGETABLE); ontology.define(CONTAINS_TOMATOS, CONTAINS_VEGETABLE);
ontology.define(CONTAINS_POTATOS, CONTAINS_VEGETABLE); ontology.define(CONTAINS_POTATOS, CONTAINS_VEGETABLE);
@@ -125,9 +125,10 @@ public class FoodNetBuilder {
if (ingredients.contains(TYPE.TOMATO)) { if (ingredients.contains(TYPE.TOMATO)) {
point.add(build(CONTAINS_TOMATOS, TRUE_VALUE)); point.add(build(CONTAINS_TOMATOS, TRUE_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));
} }*/
point.add(build(TASTE, "" + weight)); point.add(build(TASTE, "" + weight));
@@ -137,16 +138,17 @@ public class FoodNetBuilder {
public static ProbabilityDistribution vegi(Survey survey) { public static ProbabilityDistribution vegi(Survey survey) {
String names[] = { SOMEONE_VEGETARIAN }; String names[] = { SOMEONE_VEGETARIAN };
ProbabilityTable table = new ProbabilityTable(names); ProbabilityTable table = new ProbabilityTable(names);
if (survey.isDiner("vegetarian")) { //if (survey.isDiner("vegetarian")) {
table.setProbabilityForAssignment("true;", new Probability(1)); // table.setProbabilityForAssignment("true;", new Probability(1));
table.setProbabilityForAssignment("false;", new Probability(0)); // table.setProbabilityForAssignment("false;", new Probability(0));
} else { //} else {
table.setProbabilityForAssignment("true;", new Probability(0)); table.setProbabilityForAssignment("true;", new Probability(0));
table.setProbabilityForAssignment("false;", new Probability(1)); table.setProbabilityForAssignment("false;", new Probability(1));
} //}
return table; return table;
} }
/*
public static ProbabilityDistribution allergicNuts(Survey survey) { public static ProbabilityDistribution allergicNuts(Survey survey) {
String names[] = { SOMEONE_ALLERGIC_NUTS }; String names[] = { SOMEONE_ALLERGIC_NUTS };
ProbabilityTable table = new ProbabilityTable(names); ProbabilityTable table = new ProbabilityTable(names);
@@ -158,7 +160,7 @@ public class FoodNetBuilder {
table.setProbabilityForAssignment("false;", new Probability(1)); table.setProbabilityForAssignment("false;", new Probability(1));
} }
return table; return table;
} }*/
public static ProbabilityDistribution beef() { public static ProbabilityDistribution beef() {
String names[] = { CONTAINS_MEAT, CONTAINS_BEEF }; String names[] = { CONTAINS_MEAT, CONTAINS_BEEF };
@@ -178,6 +180,7 @@ public class FoodNetBuilder {
return table; return table;
} }
/*
public static ProbabilityDistribution genericNuts() { public static ProbabilityDistribution genericNuts() {
String names[] = { CONTAINS_NUTS, CONTAINS_GENERIC_NUTS }; String names[] = { CONTAINS_NUTS, CONTAINS_GENERIC_NUTS };
ProbabilityTable table = new ProbabilityTable(names); ProbabilityTable table = new ProbabilityTable(names);
@@ -188,7 +191,7 @@ public class FoodNetBuilder {
String names[] = { SOMEONE_ALLERGIC_NUTS, CONTAINS_NUTS }; String names[] = { SOMEONE_ALLERGIC_NUTS, CONTAINS_NUTS };
ProbabilityTable table = new ProbabilityTable(names); ProbabilityTable table = new ProbabilityTable(names);
return table; return table;
} }*/
public static ProbabilityDistribution tomatos() { public static ProbabilityDistribution tomatos() {
String names[] = { CONTAINS_VEGETABLE, CONTAINS_TOMATOS }; String names[] = { CONTAINS_VEGETABLE, CONTAINS_TOMATOS };
@@ -210,7 +213,7 @@ public class FoodNetBuilder {
public static ProbabilityDistribution taste() { public static ProbabilityDistribution taste() {
String names[] = { TASTE, CONTAINS_BEEF, CONTAINS_PORK, String names[] = { TASTE, CONTAINS_BEEF, CONTAINS_PORK,
CONTAINS_POTATOS, CONTAINS_TOMATOS, CONTAINS_GENERIC_NUTS }; CONTAINS_POTATOS, CONTAINS_TOMATOS/*, CONTAINS_GENERIC_NUTS*/ };
ContinousDistribution distribution = new ContinousDistribution(names, 0); ContinousDistribution distribution = new ContinousDistribution(names, 0);
return distribution; return distribution;
} }
@@ -219,10 +222,10 @@ public class FoodNetBuilder {
BayesNet net = new BayesNet(VARIABLES); BayesNet net = new BayesNet(VARIABLES);
net.setDistribution(new Variable(SOMEONE_VEGETARIAN, DOMAIN), vegi(survey)); net.setDistribution(new Variable(SOMEONE_VEGETARIAN, DOMAIN), vegi(survey));
net.setDistribution(new Variable(SOMEONE_ALLERGIC_NUTS, DOMAIN), allergicNuts(survey)); //net.setDistribution(new Variable(SOMEONE_ALLERGIC_NUTS, DOMAIN), allergicNuts(survey));
net.setDistribution(new Variable(CONTAINS_MEAT, DOMAIN), meat()); net.setDistribution(new Variable(CONTAINS_MEAT, DOMAIN), meat());
net.setDistribution(new Variable(CONTAINS_NUTS, DOMAIN), nuts()); //net.setDistribution(new Variable(CONTAINS_NUTS, DOMAIN), nuts());
net.setDistribution(new Variable(CONTAINS_VEGETABLE, DOMAIN), net.setDistribution(new Variable(CONTAINS_VEGETABLE, DOMAIN),
vegetables()); vegetables());
@@ -230,14 +233,14 @@ public class FoodNetBuilder {
net.setDistribution(new Variable(CONTAINS_PORK, DOMAIN), pork()); net.setDistribution(new Variable(CONTAINS_PORK, DOMAIN), pork());
net.setDistribution(new Variable(CONTAINS_POTATOS, DOMAIN), potatos()); net.setDistribution(new Variable(CONTAINS_POTATOS, DOMAIN), potatos());
net.setDistribution(new Variable(CONTAINS_TOMATOS, DOMAIN), tomatos()); net.setDistribution(new Variable(CONTAINS_TOMATOS, DOMAIN), tomatos());
net.setDistribution(new Variable(CONTAINS_GENERIC_NUTS, DOMAIN), genericNuts()); //net.setDistribution(new Variable(CONTAINS_GENERIC_NUTS, DOMAIN), genericNuts());
net.setDistribution(new Variable(TASTE, RATING_DOMAIN), taste()); net.setDistribution(new Variable(TASTE, RATING_DOMAIN), taste());
Ontology ontology = createOntology(); Ontology ontology = createOntology();
for (String category : ontology.getClasses()) { for (String category : ontology.getClasses()) {
net.connect(category, SOMEONE_VEGETARIAN); net.connect(category, SOMEONE_VEGETARIAN);
net.connect(category, SOMEONE_ALLERGIC_NUTS); /*net.connect(category, SOMEONE_ALLERGIC_NUTS);*/
} }
for (String thing : OBSERVED) { for (String thing : OBSERVED) {

BIN
writeup/BayesChefChart.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -8,8 +8,10 @@
\bibdata{p2refs} \bibdata{p2refs}
\bibcite{corney}{1} \bibcite{corney}{1}
\bibcite{janzenxiang}{2} \bibcite{janzenxiang}{2}
\bibcite{russelnorvig}{3}
\bibcite{truyen}{4}
\bibcite{vanboekel}{5}
\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Our Baysian net modeling user preferences}}{2}} \@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Our Baysian net modeling user preferences}}{2}}
\newlabel{img:bayes_net}{{1}{2}} \newlabel{img:bayes_net}{{1}{2}}
\newlabel{rms-table}{{}{2}}
\bibcite{murphy}{3}
\bibcite{truyen}{4}
\bibcite{vanboekel}{5}
\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces Estimated vs. surveyed dish ratings}}{3}}

View File

@@ -12,10 +12,11 @@ M.~Janzen and Y.~Xiang.
\newblock {\em 16th Conference of the Canadian Society for Computational \newblock {\em 16th Conference of the Canadian Society for Computational
Studies of Intelligence}, 2003. Studies of Intelligence}, 2003.
\bibitem{russelnorvig} \bibitem{murphy}
S.~Russel and P.~Norvig. Kevin Murphy.
\newblock {\em Artificial Intelligence; A Modern Approach}. \newblock A {Brief Introduction} to {Graphical Models} and {Bayesian Networks}.
\newblock Prentice Hall, third edition, 2010. \newblock http://www.cs.ubc.ca/~murphyk/Bayes/bnintro.html, 1998.
\newblock [Online; accessed 22-Feb-2012].
\bibitem{truyen} \bibitem{truyen}
Tran~The Truyen, Dinh~Q. Phung, and Svetha Venkatesh. Tran~The Truyen, Dinh~Q. Phung, and Svetha Venkatesh.

View File

@@ -1,23 +1,21 @@
This is pdfTeX, Version 3.1415926-1.40.11 (TeX Live 2010) (format=pdflatex 2011.7.20) 12 MAR 2012 13:01 This is pdfTeX, Version 3.1415926-2.3-1.40.12 (MiKTeX 2.9) (preloaded format=pdflatex 2012.1.11) 12 MAR 2012 20:32
entering extended mode entering extended mode
restricted \write18 enabled. **D:/workspace/cs6601p2/writeup/P2*Proposal.tex
%&-line parsing enabled. ("D:/workspace/cs6601p2/writeup/P2 Proposal.tex"
**"P2 Proposal.tex" LaTeX2e <2011/06/27>
(./P2 Proposal.tex Babel <v3.8m> and hyphenation patterns for english, afrikaans, ancientgreek, ar
LaTeX2e <2009/09/24> abic, armenian, assamese, basque, bengali, bokmal, bulgarian, catalan, coptic,
Babel <v3.8l> and hyphenation patterns for english, dumylang, nohyphenation, ge croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish, french, ga
rman-x-2009-06-19, ngerman-x-2009-06-19, ancientgreek, ibycus, arabic, armenian lician, german, german-x-2009-06-19, greek, gujarati, hindi, hungarian, iceland
, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danish, dutch, u ic, indonesian, interlingua, irish, italian, kannada, kurmanji, lao, latin, lat
kenglish, usenglishmax, esperanto, estonian, farsi, finnish, french, galician, vian, lithuanian, malayalam, marathi, mongolian, mongolianlmc, monogreek, ngerm
german, ngerman, swissgerman, monogreek, greek, hungarian, icelandic, assamese, an, ngerman-x-2009-06-19, nynorsk, oriya, panjabi, pinyin, polish, portuguese,
bengali, gujarati, hindi, kannada, malayalam, marathi, oriya, panjabi, tamil, romanian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish, swis
telugu, indonesian, interlingua, irish, italian, kurmanji, lao, latin, latvian, sgerman, tamil, telugu, turkish, turkmen, ukenglish, ukrainian, uppersorbian, u
lithuanian, mongolian, mongolianlmc, bokmal, nynorsk, polish, portuguese, roma senglishmax, welsh, loaded.
nian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish, turkish, ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\article.cls"
turkmen, ukrainian, uppersorbian, welsh, loaded.
(/usr/local/texlive/2010/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/local/texlive/2010/texmf-dist/tex/latex/base/size10.clo ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\size10.clo"
File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option) File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
) )
\c@part=\count79 \c@part=\count79
@@ -31,12 +29,13 @@ File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
\abovecaptionskip=\skip41 \abovecaptionskip=\skip41
\belowcaptionskip=\skip42 \belowcaptionskip=\skip42
\bibindent=\dimen102 \bibindent=\dimen102
) (./latex8.sty )
(D:\workspace\cs6601p2\writeup\latex8.sty
IEEE 8.5 x 11-Inch Proceedings Style `latex8.sty'. IEEE 8.5 x 11-Inch Proceedings Style `latex8.sty'.
\@ctmp=\skip43 \@ctmp=\skip43
\@figindent=\skip44 \@figindent=\skip44
) (/usr/local/texlive/2010/texmf-dist/tex/latex/titlesec/titlesec.sty ) ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\titlesec\titlesec.sty"
Package: titlesec 2007/08/12 v2.8 Sectioning titles Package: titlesec 2011/12/15 v2.10.0 Sectioning titles
\ttl@box=\box26 \ttl@box=\box26
\beforetitleunit=\skip45 \beforetitleunit=\skip45
\aftertitleunit=\skip46 \aftertitleunit=\skip46
@@ -47,49 +46,56 @@ Package: titlesec 2007/08/12 v2.8 Sectioning titles
\titlewidthlast=\dimen106 \titlewidthlast=\dimen106
\titlewidthfirst=\dimen107 \titlewidthfirst=\dimen107
) )
(/usr/local/texlive/2010/texmf-dist/tex/latex/graphics/graphicx.sty ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\graphicx.sty"
Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR) Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
(/usr/local/texlive/2010/texmf-dist/tex/latex/graphics/keyval.sty ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\keyval.sty"
Package: keyval 1999/03/16 v1.13 key=value parser (DPC) Package: keyval 1999/03/16 v1.13 key=value parser (DPC)
\KV@toks@=\toks15 \KV@toks@=\toks15
) )
(/usr/local/texlive/2010/texmf-dist/tex/latex/graphics/graphics.sty ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR) Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
(/usr/local/texlive/2010/texmf-dist/tex/latex/graphics/trig.sty ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\trig.sty"
Package: trig 1999/03/16 v1.09 sin cos tan (DPC) Package: trig 1999/03/16 v1.09 sin cos tan (DPC)
) )
(/usr/local/texlive/2010/texmf-dist/tex/latex/latexconfig/graphics.cfg ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\00miktex\graphics.cfg"
File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live File: graphics.cfg 2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
) )
Package graphics Info: Driver file: pdftex.def on input line 91. Package graphics Info: Driver file: pdftex.def on input line 91.
(/usr/local/texlive/2010/texmf-dist/tex/latex/pdftex-def/pdftex.def ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\pdftex-def\pdftex.def"
File: pdftex.def 2010/02/14 v0.04n Graphics/color for pdfTeX File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty"
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/message (HO)
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty"
Package: ltxcmds 2011/04/18 v1.20 LaTeX kernel commands for general use (HO)
)
\Gread@gobject=\count87 \Gread@gobject=\count87
)) ))
\Gin@req@height=\dimen108 \Gin@req@height=\dimen108
\Gin@req@width=\dimen109 \Gin@req@width=\dimen109
) )
(/usr/local/texlive/2010/texmf-dist/tex/latex/amsmath/amsmath.sty ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\ams\math\amsmath.sty"
Package: amsmath 2000/07/18 v2.13 AMS math features Package: amsmath 2000/07/18 v2.13 AMS math features
\@mathmargin=\skip47 \@mathmargin=\skip47
For additional information on amsmath, use the `?' option. For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2010/texmf-dist/tex/latex/amsmath/amstext.sty ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\ams\math\amstext.sty"
Package: amstext 2000/06/29 v2.01 Package: amstext 2000/06/29 v2.01
(/usr/local/texlive/2010/texmf-dist/tex/latex/amsmath/amsgen.sty ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\ams\math\amsgen.sty"
File: amsgen.sty 1999/11/30 v2.0 File: amsgen.sty 1999/11/30 v2.0
\@emptytoks=\toks16 \@emptytoks=\toks16
\ex@=\dimen110 \ex@=\dimen110
)) ))
(/usr/local/texlive/2010/texmf-dist/tex/latex/amsmath/amsbsy.sty ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\ams\math\amsbsy.sty"
Package: amsbsy 1999/11/29 v1.2d Package: amsbsy 1999/11/29 v1.2d
\pmbraise@=\dimen111 \pmbraise@=\dimen111
) )
(/usr/local/texlive/2010/texmf-dist/tex/latex/amsmath/amsopn.sty ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\ams\math\amsopn.sty"
Package: amsopn 1999/12/14 v2.01 operator names Package: amsopn 1999/12/14 v2.01 operator names
) )
\inf@bad=\count88 \inf@bad=\count88
@@ -134,9 +140,7 @@ LaTeX Info: Redefining \] on input line 2667.
LaTeX Warning: Unused global option(s): LaTeX Warning: Unused global option(s):
[times,08pt]. [times,08pt].
(./P2 Proposal.aux) ("D:\workspace\cs6601p2\writeup\P2 Proposal.aux")
\openout1 = `"P2 Proposal.aux"'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 11. LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 11.
LaTeX Font Info: ... okay on input line 11. LaTeX Font Info: ... okay on input line 11.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 11. LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 11.
@@ -150,7 +154,7 @@ LaTeX Font Info: ... okay on input line 11.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 11. LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 11.
LaTeX Font Info: ... okay on input line 11. LaTeX Font Info: ... okay on input line 11.
(/usr/local/texlive/2010/texmf-dist/tex/context/base/supp-pdf.mkii ("C:\Program Files (x86)\MiKTeX 2.9\tex\context\base\supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).] [Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count100 \scratchcounter=\count100
\scratchdimen=\dimen119 \scratchdimen=\dimen119
@@ -161,60 +165,20 @@ LaTeX Font Info: ... okay on input line 11.
\MPscratchCnt=\count103 \MPscratchCnt=\count103
\MPscratchDim=\dimen120 \MPscratchDim=\dimen120
\MPnumerator=\count104 \MPnumerator=\count104
\makeMPintoPDFobject=\count105
\everyMPtoPDFconversion=\toks22 \everyMPtoPDFconversion=\toks22
) (/usr/local/texlive/2010/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
Package: pdftexcmds 2010/04/01 v0.9 Utility functions of pdfTeX for LuaTeX (HO)
(/usr/local/texlive/2010/texmf-dist/tex/generic/oberdiek/infwarerr.sty
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/message (HO)
) )
(/usr/local/texlive/2010/texmf-dist/tex/generic/oberdiek/ifluatex.sty Underfull \hbox (badness 4254) in paragraph at lines 67--70
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) [] \OT1/cmr/bx/n/10 Data ac-cui-si-tion \OT1/cmr/m/n/10 We first ac-cu-mu-lated
Package ifluatex Info: LuaTeX not detected. a di-
) []
(/usr/local/texlive/2010/texmf-dist/tex/generic/oberdiek/ltxcmds.sty
Package: ltxcmds 2010/04/26 v1.7 LaTeX kernel commands for general use (HO)
)
Package pdftexcmds Info: LuaTeX not detected.
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
)
(/usr/local/texlive/2010/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf
(/usr/local/texlive/2010/texmf-dist/tex/latex/oberdiek/grfext.sty
Package: grfext 2007/09/30 v1.0 Managing graphics extensions (HO)
)
(/usr/local/texlive/2010/texmf-dist/tex/latex/oberdiek/kvoptions.sty
Package: kvoptions 2010/02/22 v3.7 Keyval support for LaTeX options (HO)
(/usr/local/texlive/2010/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
Package: kvsetkeys 2010/03/01 v1.9 Key value parser (HO)
(/usr/local/texlive/2010/texmf-dist/tex/generic/oberdiek/etexcmds.sty
Package: etexcmds 2010/01/28 v1.3 Prefix for e-TeX command names (HO)
Package etexcmds Info: Could not find \expanded.
(etexcmds) That can mean that you are not using pdfTeX 1.50 or
(etexcmds) that some package has redefined \expanded.
(etexcmds) In the latter case, load this package earlier.
)))
Package grfext Info: Graphics extension search list:
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE
G,.JBIG2,.JB2,.eps]
(grfext) \AppendGraphicsExtensions on input line 436.
(/usr/local/texlive/2010/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv
e
))
<bayes.png, id=1, 993.7125pt x 596.2275pt> <bayes.png, id=1, 993.7125pt x 596.2275pt>
File: bayes.png Graphic file (type png) File: bayes.png Graphic file (type png)
<use bayes.png> <use bayes.png>
Package pdftex.def Info: bayes.png used on input line 105.
LaTeX Warning: Citation `murphy' on page 1 undefined on input line 119. (pdftex.def) Requested size: 237.13594pt x 142.27873pt.
[1{C:/ProgramData/MiKTeX/2.9/pdftex/config/pdftex.map}
[1{/usr/local/texlive/2010/texmf-var/fonts/map/pdftex/updmap/pdftex.map}
] ]
@@ -223,34 +187,68 @@ Package amsmath Warning: Foreign command \over;
(amsmath) \frac or \genfrac should be used instead (amsmath) \frac or \genfrac should be used instead
(amsmath) on input line 139. (amsmath) on input line 139.
(./P2 Proposal.bbl) [2 <./bayes.png (PNG copy)>] (./P2 Proposal.aux)
LaTeX Warning: There were undefined references. Overfull \hbox (13.25346pt too wide) in paragraph at lines 174--202
[][]
[]
) <BayesChefChart.png, id=14, 440.24475pt x 249.93375pt>
File: BayesChefChart.png Graphic file (type png)
<use BayesChefChart.png>
Package pdftex.def Info: BayesChefChart.png used on input line 205.
(pdftex.def) Requested size: 248.42812pt x 141.0374pt.
Overfull \hbox (11.29218pt too wide) in paragraph at lines 205--206
[][]
[]
LaTeX Warning: `!h' float specifier changed to `!ht'.
("D:\workspace\cs6601p2\writeup\P2 Proposal.bbl" [2 <D:/workspace/cs6601p2/writ
eup/bayes.png>]
Underfull \hbox (badness 10000) in paragraph at lines 16--20
[]\OT1/cmr/m/n/10 Kevin Mur-phy. A Brief In-tro-duc-tion
[]
Underfull \hbox (badness 10000) in paragraph at lines 16--20
\OT1/cmr/m/n/10 to Graph-i-cal Mod-els and Bayesian Net-
[]
Underfull \hbox (badness 10000) in paragraph at lines 16--20
\OT1/cmr/m/n/10 works. http://www.cs.ubc.ca/ mur-
[]
) [3
<D:/workspace/cs6601p2/writeup/BayesChefChart.png>]
("D:\workspace\cs6601p2\writeup\P2 Proposal.aux") )
Here is how much of TeX's memory you used: Here is how much of TeX's memory you used:
2184 strings out of 493747 2023 strings out of 494045
28746 string characters out of 3143546 25481 string characters out of 3145969
94189 words of memory out of 3000000 90183 words of memory out of 3000000
5461 multiletter control sequences out of 15000+200000 5325 multiletter control sequences out of 15000+200000
11026 words of font info for 36 fonts, out of 3000000 for 9000 11026 words of font info for 36 fonts, out of 3000000 for 9000
714 hyphenation exceptions out of 8191 715 hyphenation exceptions out of 8191
38i,8n,28p,406b,212s stack positions out of 5000i,500n,10000p,200000b,50000s 27i,8n,28p,712b,219s stack positions out of 5000i,500n,10000p,200000b,50000s
{/usr/local/texlive/2010/texmf-dist/fonts/enc/dvips/base/8r.enc}</usr/local/t {C:/Program Files (x86)/MiKT
exlive/2010/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></usr/local/te eX 2.9/fonts/enc/dvips/fontname/8r.enc}<C:/Program Files (x86)/MiKTeX 2.9/fonts
xlive/2010/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></usr/local/tex /type1/public/amsfonts/cm/cmbx10.pfb><C:/Program Files (x86)/MiKTeX 2.9/fonts/t
live/2010/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb></usr/local/texl ype1/public/amsfonts/cm/cmbx12.pfb><C:/Program Files (x86)/MiKTeX 2.9/fonts/typ
ive/2010/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi7.pfb></usr/local/texliv e1/public/amsfonts/cm/cmmi10.pfb><C:/Program Files (x86)/MiKTeX 2.9/fonts/type1
e/2010/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/local/texlive/ /public/amsfonts/cm/cmmi7.pfb><C:/Program Files (x86)/MiKTeX 2.9/fonts/type1/pu
2010/texmf-dist/fonts/type1/public/amsfonts/cm/cmr12.pfb></usr/local/texlive/20 blic/amsfonts/cm/cmr10.pfb><C:/Program Files (x86)/MiKTeX 2.9/fonts/type1/publi
10/texmf-dist/fonts/type1/public/amsfonts/cm/cmr7.pfb></usr/local/texlive/2010/ c/amsfonts/cm/cmr12.pfb><C:/Program Files (x86)/MiKTeX 2.9/fonts/type1/public/a
texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb></usr/local/texlive/2010/t msfonts/cm/cmr7.pfb><C:/Program Files (x86)/MiKTeX 2.9/fonts/type1/public/amsfo
exmf-dist/fonts/type1/public/amsfonts/cm/cmti10.pfb></usr/local/texlive/2010/te nts/cm/cmsy10.pfb><C:/Program Files (x86)/MiKTeX 2.9/fonts/type1/public/amsfont
xmf-dist/fonts/type1/urw/helvetic/uhvb8a.pfb> s/cm/cmti10.pfb><C:/Program Files (x86)/MiKTeX 2.9/fonts/type1/urw/helvetic/uhv
Output written on "P2 Proposal.pdf" (2 pages, 194400 bytes). b8a.pfb>
Output written on "P2 Proposal.pdf" (3 pages, 199662 bytes).
PDF statistics: PDF statistics:
53 PDF objects out of 1000 (max. 8388607) 55 PDF objects out of 1000 (max. 8388607)
37 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000) 0 named destinations out of 1000 (max. 500000)
6 words of extra memory for PDF output out of 10000 (max. 10000000) 11 words of extra memory for PDF output out of 10000 (max. 10000000)

Binary file not shown.

View File

@@ -59,47 +59,41 @@ rating given our model.
In the following we will describe our approach in detail. In the following we will describe our approach in detail.
First we will discuss the data selection, then the First we will discuss the data selection, then the
modeling of the user preference and in the modeling of the user preference and in the
end how to train the modeled net from end how we trained the modeled net from
gathered data and howe to predict the gathered data and predicted the
value for a new recepice. value for different recipes.
\paragraph*{Data accuisition} \paragraph*{Data accuisition}
We accumulated a diverse collection of sample recipes using the open source AnyMeal application. We first accumulated a diverse collection of license-free sample recipes from web sites such as \emph{Darkstar's Meal-Master Recipes} (http://home.earthlink.net/~darkstar105/). Next, we converted these recipes from flat text files to well-formed XML using the Krecipes application for Debian Linux. Finally, we created a representative data set representing several diners' preference for
We converted to the freely available MealMaster format (flat file) 24 of these recipes, using a simple survey of the type 'rate on a
recipes to XML format for input into our application. scale of 1 to 10, 10 being favorite and 1 being least favorite'. Furthermore, users were allowed to specify a vegetarian or nut-free meal preference.
We will gathered data representing several diners' preference for
approximately 20 meals using a simple survey of the type 'rate on a
scale of 1 to 10, 10 being favorite and 1 being least favorite'.
Furthermore we collected data for vegetarians and allergies.
%daniel is here %daniel is here
\paragraph*{Knowledge Engineering} \paragraph*{Knowledge Engineering}
We model the diners' various taste preferences preferences using
a Bayes net. In the first layer in Figure \ref{img:bayes_net}
we capture control variables such as vegarian or allergy to nuts.
These were modeled as boolean variables, with 'true' indicating the presence of a constraint.
We model users' preferences using
a bayes net. In the first layer in Figure \ref{img:bayes_net}
we capture controll variables like vegan or allergies.
Those are modeled as boolean variables.
If the user is allergic or a vegetarian, it will set the variable allergic
to 0.
In order to model
Our model consists of 4 layers, Our model consists of 4 layers,
each modeling a different aspect of taste and needs. each modeling a different aspect of taste or dietary requirement.
In the first layer we capture general meal preferences, like \begin{description}
being vegetarian or not liking your food steamed. \item[Layer 1] General meal preferences such as
The second layer models a general preference towards being vegetarian or being allergic to nuts.
different food categories like vegetables or beef.
\item[Layer 2] The second layer models a general preference towards
different food categories like vegetables or meat.
As one can see, the food categories are dependent As one can see, the food categories are dependent
on the general meal preference. For example on the general meal preference. For example
being vegetarian will exclude beef and will being vegetarian will exclude meat and will
support vegetables. The third category models support vegetables.
different ingredients. Each ingredient is conditioned
by the food category it belongs to. \item[Layer 3] Specific flavors and ingredients. Each ingredient is conditioned
In the last layer we have hard constraints like allergies by the food category to which it belongs.
(that will exclude a particular ingredient) or
the overall calorie content of the meal given \end{description}
someone suffers from diabetes.
The overall net is shown in Figure \ref{img:bayes_net}. The overall net is shown in Figure \ref{img:bayes_net}.
Given a recipe with a list of ingredients $I = i_1,...,i_n$ Given a recipe with a list of ingredients $I = i_1,...,i_n$
and a Bayesian network capturing user preferences and a Bayesian network capturing user preferences
@@ -124,7 +118,10 @@ the probabilities for the ingredients using Maximum Likelihood Learning \cite{mu
%\subsection*{Meal Optimization} %\subsection*{Meal Optimization}
In order to model food preferences, we implemented In order to model food preferences, we implemented
a baysian net library in java. The library a custom Baysian net library in java with minimal use of third party libraries (e.g. for XML input).
We chose to implement our own Library, for maximum flexibility and to ensure that the learning algorithm functions precisely as follows:
The library
uses the sum-product algorithm for uses the sum-product algorithm for
inference and maximum likelihood learning inference and maximum likelihood learning
for parameter estimation. In our implementation for parameter estimation. In our implementation
@@ -141,14 +138,73 @@ P(X = x| Y_1 = y_1, ... Y_2 = y2) =\\
N(X = x| Y_1 = y_1, ... Y_2 = y2) \over N(Y_1 = y_1, ... Y_2 = y2) N(X = x| Y_1 = y_1, ... Y_2 = y2) \over N(Y_1 = y_1, ... Y_2 = y2)
\end{align} \end{align}
where $N(A)$ is the number of times event $A$occurs in the data set. where $N(A)$ is the number of times event $A$occurs in the data set.
We decided to implement our own Library,
so we understand what is going on and
we can debug and fix the models
and algorithms easily.
\section*{Evaluation} \section*{Evaluation}
The application model will be trained using a sparse subset (25-50\%) of the survey data and the optimization problem soled for the inferred constraints. The application model will be trained using a sparse subset (50\%) of the survey data and the optimization problem solved for the inferred constraints. As shown below, the calculated preferences for recipes which were not used to train the Bayes net are quite close to the actual survey data, which essentially reflects the following preferences (Sample ratings are on a 1-10 scale):
Next, we will calculate the correlation between the application's ranking of all dishes and the actual ranking as determined by the user surveys. We suggest that a high degree of correlation indicates that the system has the potential to accurately appraise constrained group food preferences for dishes which are not part of the survey, given sufficiently detailed recipe information.
\begin{description}
\item[Diner 1] No allergies, prefers all dishes equally (5)
\item[Diner 2] Vegetarian, meat dishes are (1), remainder are (9)
\item[Diner 3] Nut Alleregy, prefers meat (6) to vegetarian (4) to desert (3)
\item[Diner 4] No allergies, prefers Pork and Desserts (9), remainder are (3)
\end{description}
Next, we calculate the correlation between the application's ranking of all dishes and the actual ranking as determined by the user surveys. We suggest that a high degree of correlation indicates that the system has the potential to accurately appraise constrained group food preferences for dishes which are not part of the survey, given sufficiently detailed recipe information. As \ref{rms-table} shows, the estimated food preferences are quite close to the actual mean ratings over all diners for the dishes which were not used to train the Bayes net. The root mean-square-error for calculated vs. surveyed meal preferences is approximately 1.0.
%% actual data from non-constrained (Allergy etc) trial run
% TASTE for Southwest Smoothie [DAIRY] : 5 0.14272807979501637
% TASTE for Bayou Shrimp Creole [TOMATO] : 5 0.015864055945522846
% TASTE for Crab Burgers [EGGS] : 5 0.14272807979501637
% TASTE for Broiled Flounder [GENERIC_NUTS, EGGS] : 5 0.14272807979501637
% TASTE for Baked Steak And Lima Beans [TOMATO, SUGAR] : 5 0.015864055945522846
% TASTE for Eggplant Lasagna [GLUTEN] : 5 0.14272807979501637
% TASTE for Salisbury Steak with Mushroom Sauce [GLUTEN, DAIRY, BEEF] : 4 0.020337720115187766
% TASTE for Meatless Loaf [SPICE] : 5 0.14272807979501637
% TASTE for Lemon Pork Chops [PORK, SUGAR] : 5 0.006727267528344914
% TASTE for Fava Bean Burgers [EGGS, POTATO] : 3 0.005331713336331368
% TASTE for Angel Hair Pesto Primavera [GENERIC_NUTS, SPICE] : 5 0.14272807979501637
% TASTE for Kahlua Cake [] : 5 0.14272807979501637
%%
%\begin{center}
\begin{tabular}{ | l | l | l | }
\hline
Southwest Smoothie: & &\\
DAIRY & 1.2 & 5.5 \\ \hline
Bayou Shrimp Creole: & &\\
TOMATO & & 3.75 \\ \hline
Crab Burgers: & &\\
EGGS & & 3.75 \\ \hline
Broiled Flounder: & &\\
GENERIC NUTS, EGGS & & 3.75 \\ \hline
Baked Steak And Lima Beans: & &\\
TOMATO, SUGAR & & 3.75 \\ \hline
Eggplant Lasagna: & &\\
GLUTEN & & 5.25 \\ \hline
Salisbury Steak with Mushroom Sauce: & &\\
GLUTEN, DAIRY, BEEF & & 3.75 \\ \hline
Meatless Loaf: & &\\
SPICE & & 5.25 \\ \hline
Lemon Pork Chops: & &\\
PORK, SUGAR & & 5.25 \\ \hline
Fava Bean Burgers: & &\\
EGGS, POTATO & & 5.25 \\ \hline
Angel Hair Pesto Primavera: & &\\
GENERIC NUTS, SPICE & & 5.25 \\ \hline
Kahlua Cake & & 4.5 \\ \hline
\label{rms-table}
\end{tabular}
%\end{center}
\begin{figure}[h!]
\centering
\includegraphics[width=0.5 \textwidth]{BayesChefChart.png}
\caption{Estimated vs. surveyed dish ratings}
\end{figure}
\bibliographystyle{plain} \bibliographystyle{plain}
\bibliography{p2refs} \bibliography{p2refs}