Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 4 : Custom Model, By Hand ( 1 5 pts ) Your fourth task is to create and work through a model by hand.Step
Question : Custom Model, By Hand ptsYour fourth task is to create and work through a model by hand.Step : Create your own Bayesian Network BNDraw out the graph for a Bayesian Network, digital or on paper is fineThe network should have atleast variablesYou can name them most anything you like, but I recommend keeping it simpleOne variable must have atleast parentsAtleast variables including above must have or more parentsSave or scanphotograph your graph please stick to pdf png or jpeg formats Name the file studentbnpng studentbnjpg or studentbnpdfHighly recommended to read all the steps before starting here, so you don't end up with a network that can't satisfy later requirements. In particular, play close attention to the requirements for query, hidden and evidencevisible variables.Step : Finish your own Bayesian NetworkRemember, a BN is not complete until conditional distributions are specified for all variables. In this case, that means we need conditional probability tables for each variable.We will combine this step with creating the model file needed for your code to analyze your BNThe model file format is very simple, it is a csv comma separated value file containing subtables for each variableIt's possible to create these using a simple text editor, but you may find it easier to use Excel or another spreadsheet program or an online CSV editorSubtables are separated by blank linesLines starting with # are treated as comments and ignored theyare not treated as blank linesThe first row specifies the conditions and variableConditions are listed first leftThe variable for the table is last rightmostThe remaining rows are probabilities. Make one row for every possible combination of condition values, and in the rightmost column list the probability for that row.Please name the file studentbncsvRun the following command to check your model load it in and print it back out: python probinf.py model studentbncsv mode printFeel free to open up burglaryalarm.csv as an example how to construct the file.You may assign most any probabilities you like with one restriction: Every probability must be unique.For example, if you assign in one place then you may not use anywhere elsebut also you may not use anywhere else. And thus you may not use anywhere.The point of the above is that both you and we can see exactly where a probability came from just by seeing the number.Step : QueryNow make a probabilistic query for your BNDecide on a query variable and value.Your query variable must have atleast one parentand atleast one child.Choose hidden variables.Each hidden variable must be: Either a parent or child of the query variable Or a parent or child of another hidden variablebut also a grandparent or grandchild of the query variableIn other words, every hidden variable must have a directed path either to the query variable or from the query variable, and only other hidden variables may be on that path.You may choose more than hidden variables, but it's not recommended, as it will cause you significantly more work.Which means the remaining variables are evidencevisible variables. Choose values for them.Atleast one evidence variable must be a child of the query variable.Run your code from above either Q or Q is fine to get a result for this query.The point of the above restrictions is to try to ensure you end up with a nontrivial problem to solve, that showslets you practice all the components of probabilistic inference. If you still end up with something you feel is too simple,please let me know so I can refine these instructions for future semesters.Step : Inference by handNow calculate the same query by handTry to stick to the format shown on Slides as much as possible.If when you have to spread the calculation across pages, please be as clear as possible which parts of the tree link up where.Save your work in either studentbninference.pdf or if you are scanningphotographing paper work studentbninferencepng studentbninferencepng etc or jpeg format is fine as well
Question : Custom Model, By Hand ptsYour fourth task is to create and work through a model by hand.Step : Create your own Bayesian Network BNDraw out the graph for a Bayesian Network, digital or on paper is fineThe network should have atleast variablesYou can name them most anything you like, but I recommend keeping it simpleOne variable must have atleast parentsAtleast variables including above must have or more parentsSave or scanphotograph your graph please stick to pdf png or jpeg formats Name the file studentbnpng studentbnjpg or studentbnpdfHighly recommended to read all the steps before starting here, so you don't end up with a network that can't satisfy later requirements. In particular, play close attention to the requirements for query, hidden and evidencevisible variables.Step : Finish your own Bayesian NetworkRemember, a BN is not complete until conditional distributions are specified for all variables. In this case, that means we need conditional probability tables for each variable.We will combine this step with creating the model file needed for your code to analyze your BNThe model file format is very simple, it is a csv comma separated value file containing subtables for each variableIt's possible to create these using a simple text editor, but you may find it easier to use Excel or another spreadsheet program or an online CSV editorSubtables are separated by blank linesLines starting with # are treated as comments and ignored theyare not treated as blank linesThe first row specifies the conditions and variableConditions are listed first leftThe variable for the table is last rightmostThe remaining rows are probabilities. Make one row for every possible combination of condition values, and in the rightmost column list the probability for that row.Please name the file studentbncsvRun the following command to check your model load it in and print it back out: python probinf.py model studentbncsv mode printFeel free to open up burglaryalarm.csv as an example how to construct the file.You may assign most any probabilities you like with one restriction: Every probability must be unique.For example, if you assign in one place then you may not use anywhere elsebut also you may not use anywhere else. And thus you may not use anywhere.The point of the above is that both you and we can see exactly where a probability came from just by seeing the number.Step : QueryNow make a probabilistic query for your BNDecide on a query variable and value.Your query variable must have atleast one parentand atleast one child.Choose hidden variables.Each hidden variable must be: Either a parent or child of the query variable Or a parent or child of another hidden variablebut also a grandparent or grandchild of the query variableIn other words, every hidden variable must have a directed path either to the query variable or from the query variable, and only other hidden variables may be on that path.You may choose more than hidden variables, but it's not recommended, as it will cause you significantly more work.Which means the remaining variables are evidencevisible variables. Choose values for them.Atleast one evidence variable must be a child of the query variable.Run your code from above either Q or Q is fine to get a result for this query.The point of the above restrictions is to try to ensure you end up with a nontrivial problem to solve, that showslets you practice all the components of probabilistic inference. If you still end up with something you feel is too simple,please let me know so I can refine these instructions for future semesters.Step : Inference by handNow calculate the same query by handTry to stick to the format shown on Slides as much as possible.If when you have to spread the calculation across pages, please be as clear as possible which parts of the tree link up where.Save your work in either studentbninference.pdf or if you are scanningphotographing paper work studentbninferencepng studentbninferencepng etc or jpeg format is fine as well
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started