FIT5047 Bayesian Networks & Machine Learning
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
FIT5047 – Bayesian Networks & Machine Learning Assignment (26%)
Question 1: Bayesian Networks, Netica (30 + 10 + 5 + 5 = 50 marks)
Suppose you are working for a financial institution, and you are asked to implement a fraud detection system. You plan to use the following information:
When the card holder is travelling abroad, fraudulent transactions are more likely since tourists are prime targets for thieves. More precisely, 1% of transactions are fraudulent when the card holder is travelling, whereas only 0.4% of the transactions are fraudulent when they are not travelling. On average, 5% of all transactions happen while the card holder is travelling. If a transaction is fraudulent, then the likelihood of a foreign purchase increases, unless the card holder happens to be travelling. More precisely, when the card holder is not travelling, 10% of the fraudulent transactions are foreign purchases, whereas only 1% of the legitimate transactions are foreign purchases. On the other hand, when the card holder is travelling, then 90% of the transactions are foreign purchases regardless of the legitimacy of the transactions.
Purchases made over the Internet are more likely to be fraudulent. This is especially true for card holders who don’t own any computer. Currently, 70% of the population owns a computer or smart phone, and for those card holders, 1% of their legitimate transactions are done over the Internet, but this percentage increases to 2% for fraudulent transactions. For those who don’t own any computer or smart phone, a mere 0.1% of their legitimate transactions is done over the Internet, but that number increases to 1.1% for fraudulent transactions. Unfortunately, the credit card company doesn’t know whether a card holder owns a computer or smart phone, but it can usually guess by verifying whether any of the recent transactions involve the purchase of computer related accessories. In any given week, 10% of those who own a computer or smart phone purchase (with their credit card) at least one computer related item, as opposed to just 0.1% of those who don’t own any computer or smart phone.
(a) Construct a Bayesian Network (BN) to identify fraudulent transactions. This network should encode the information stated above. Your network should contain exactly six nodes, corresponding to the following binary random variables: (30 marks)
• OC — card holder owns a computer or smart phone.
• Fraud — current transaction is fraudulent.
• Trav — card holder is currently travelling.
• FP — current transaction is a foreign purchase.
• IP — current purchase is an Internet purchase.
• CRP — a computer related purchase was made in the past week.
The arcs defining your Bayes Network should accurately capture the probabilistic depen- dencies between these variables.
What to hand in:
• The graph defining the network and the Conditional Probability Tables (CPTs) asso-ciated with each node in the graph.
• A Netica file of the BN, and a screenshot of your BN and the CPTs for the nodes.
(b) Consider the following questions.
i. What is the prior probability (before we search for previous computer related purchases and before we verify whether it is a foreign and/or an Internet purchase) that the current transaction is a fraud? (1 mark)
ii. What is the probability that the current transaction is a fraud once we have verified that it is a foreign transaction, but not an Internet purchase, and that the card holder purchased computer related accessories in the past week? Enter each piece of evi- dence in sequence and update the probability of interest in turn. Use the structure of the BN and the CPTs to explain the impact of each new piece of evidence. (9 marks)
What to hand in:
• Explanations of how these pieces of evidence affect the probabilities of interest in the BN.
• Screenshots of the changes to the BN after each piece of evidence is added (one screenshot per piece of evidence).
(c) After computing the probabilities in item (b)ii, the fraud detection system raises a flag and recommends that the card holder be called to confirm the transaction. An agent calls at the domicile of the card holder, but they are not home. Their spouse confirms that they are currently out of town on a business trip. How does the probability of a fraud obtained in item (b)ii change based on this new piece of information? What happens if you remove the evidence about the foreign purchase? Why? (5 marks)
What to hand in:
• An explanation of how this information affects the probability of fraud, and any other relevant probabilities in the BN.
• A screenshot of the change to the BN after the new evidence is added.
(d) Suppose you are not a very honest employee, and you just stole a credit card. You know that the fraud detection system uses the BN designed earlier, but you still want to make an important purchase over the Internet. Keeping in mind what the credit card company only has access to the records of your purchases, what can you do to reduce the risk that the credit card company will deem the transaction to be a possible fraud and reject it? (5 marks)
What to hand in:
• A list of the actions taken, and an explanation of how each action affects the prob- ability of fraud (i.e., by how much the probability changes), and any other relevant probabilities in the BN.
• Screenshots of the changes to the BN after each piece of evidence is added (one screen- shot per piece of evidence).
Question 2: Bayesian Decision Networks, Netica (10 + 6 + 6 + 13 = 35 marks)
Extend your BN to become a Bayesian Decision Network (BDN) that will be used to decide when a transaction should be blocked. Use the following information: For each legitimate transaction processed, the credit card company earns a profit of roughly 0.5% of the transac-tion’s value through interest charges and merchant charges. For instance, on each transaction of $1000, the credit card company expects a profit of roughly $5. Assuming that the credit card company covers fraudulent transactions, it will suffer a loss equal to the value of each fraudulent transaction. However, if a fraudulent transaction is blocked, there is no loss. In the event where a legitimate transaction is blocked, customers get annoyed (and sometimes cancel their credit card), which is considered to be equivalent to an expected loss of $10.
(a) Extend your BN to a BDN. Assume transactions of $1000. This network should encode the information stated above. In addition to the six chance nodes defined in Question 1, your network should include a decision node and a utility node: (10 marks)
• B — decision to block (or not) a transaction.
• U — utility.
The arcs into the decision node should encode informational links, and the arcs into the utility node should encode utility dependencies.
What to hand in:
• A Netica file of the BDN, and a screenshot of your BDN and the utility table.
• An explanation of the informational link(s) and the utility dependencies.
• A recommendation of whether the credit card company should block a transaction in the absence of information? Why?
(b) Validate your BDN by calculating manually the utilities of the actions. (6 marks)
What to hand in:
• Your calculation of the utilities of the actions.
(c) Should a $1000 transaction be blocked when it is a foreign transaction that wasn’t done over the Internet and computer related accessories were purchased in the past week? Enter each piece of evidence in sequence and update the decision node in turn. Use the structure of the BN and the CPTs to explain the impact of each new piece of evidence. (6 marks)
What to hand in:
• Explanations of how each piece of evidence affects the decision to block the transaction, the actual decision, and any relevant probabilities in the BDN.
• Screenshots of the changes to the BDN after each piece of evidence is added (one screenshot per piece of evidence).
(d) What is the expected value of the information gained when calling a customer at home to verify whether they are travelling, for a foreign transaction that wasn’t done over the Internet and computer related accessories were purchased in the past week? (13 marks)
What to hand in:
• The manual calculations used to determine the expected value of the information gained.
• The decision whether it is worthwhile to call the customer.
Question 3: D-separation (9 + 6 = 15 marks)
Consider the following Bayesian Network called Q3ab-BN-rental2 . dne (available on moodle).
(a) List the conditions under which you will be able to propagate evidence from Interest rate to Rent charged. That is, which nodes need to be instantiated or uninstantiated so that evidence can be propagated from Interest rate to Rent charged. Explain why this is the case using the terms Common Cause, Common Effect and Causal Chain where applicable.
Answers without explanations will receive no marks.
What to hand in:
• An explanation that includes a list of nodes and values, as well as the names of the relevant BN D-separation condition(s).
(b) Repeat question (a) for propagating evidence from Desirable investment to Housing prices.
Explain why this is the case using the terms Common Cause, Common Effect and Causal Chain where applicable. Answers without explanations will receive no marks.
What to hand in:
• An explanation that includes a list of nodes and values, as well as the names of the relevant BN D-separation condition(s).
Question 4: Classification, Decision Trees, Na¨ıve Bayes, k-NN, WEKA (52 marks)
Consider the dataset tic-tac-toe . arff available on moodle. Each example in this dataset represents a different game of tic-tac-toe (http://en. wikipedia. org/wiki/Tic-tac-toe), where the player writing crosses (“x”) has the first move. Only those games that don’t end in a draw are included, with the positive class representing the case where the first player wins and the negative class the case where the first player loses. The features encode the status of the game at the end, so each square contains a cross “x”, a nought “o” or a blank “b”.
1. Before you run the classifiers, use the visualization tool to analyze the data. (2 + 2 = 4 marks)
(a) Which attributes seem to be the most predictive of winning or losing? (hint: if you were the “x” player, where would you put your first cross and why?)
(b) What can you infer about the advantage (or otherwise) of being the first player?
2. Run J48 (=C4.5, Decision Tree), Na…ıve Bayes and IBk (=k-NN) to learn a model that predicts whether the “x” player will win. Perform 10-fold cross validation, and analyze the results obtained by these algorithms as follows.
Note: When using J48, click on the “Choose” bar to try at least two values of minNumObj (default is 2); and when using IBk, try at least three values of KNN (default is 1).
(a) J48 (=C4.5) (2 + 3 + 14 + 3 = 22 marks)
i. Examine the Decision Tree and indicate the main variables.
ii. Trace the Decision Tree for the following game. What would it predict? Does this prediction make sense?
iii. What is the first split in the Decision Tree? Calculate (by hand) the Information Gain obtained from the first split in the tree. Show your calculations.
iv. What is the accuracy of the Decision Tree? Explain the results in the confusion matrix for the best option you tried.
(b) Na¨ıve Bayes (7 + 3 = 10 marks)
i. Calculate (by hand), from the probability distributions in ’s output, the predicted probability of a win and of a loss for the game in item 2(a)ii. Show your calculations.
ii. What is the accuracy of the Na¨ıve Bayes classifier? Explain the results in the con-fusion matrix. What is the prediction of ’s Na¨ıve Bayes classifier for the game in item 2(b)i, and the probability of this prediction?
(c) k-NN (6 + 2 = 8 marks)
i. Find three instances in the dataset that are similar to the game in item 2(a)ii, and use the Jaccard coefficient, combined with a distance metric, to calculate (by hand) the predicted outcome for this game. Show your calculations.
ii. What is the accuracy of the k-NN classifier? Explain the results in the confusion matrix.
3. (5 + 3 = 8 marks) Draw a table to compare the performance of J48, Na¨ıve Bayes and IBk using the accuracy, recall, precision and F-score measures produced by Weka. Which algorithm does better? Explain in terms of these summary measures. Can you speculate why?
Submission instructions:
1. On the due day, before 23:59, upload to moodle your answers, including a report and BDN, in a zip file named BN-MLlab-StudentID.zip, where StudentID is your Student ID number.
2. Multiple submissions are allowed until the deadline, and drafts will be deemed submitted at the deadline.
Important:
• The interview will be on campus under exam conditions. You must attend your assigned lab, and you are not allowed to communicate with your classmates during the lab.
• Only typed textual explanations will be accepted. Scanned or handwritten expla- nations will be automatically rejected, and will receive no marks.
• Your report should include screenshots of the Netica networks (BN and BDN) under the different conditions, and representations of the CPTs and utility table.
• You will be interviewed about your work in order to determine your mark for this assign-ment. The purpose of the interview is to ascertain that you are knowledgeable about the work you are submitting. Inability to properly explain your work will result in loss of marks.
• You cannot use OpenAI to answer assignment questions, and you will loss mark if you don't use our unit terms to answer the questions.
2025-10-10
Fundamentals of AI