Suppose you are the manager of a small cloud computing service providing company. The cloud system has a set of m resources (computing, networking, storage, memory etc.) to be shared by a set of n applications. At any given point of time, each application requests a set of resources. Each resource might be requested by multiple applications at the same time; but it can only be used by a single application at a time. Your job is to allocate resources to applications that request them. An application becomes active when it is allocated all the resources it requests, and it gets blocked otherwise. As an example, there are 3 resources and 2 applications. Application 1 needs resource 1 and 2, and application 2 needs resource 2 and 3. So application 1 and application 2 cannot be active at the same time since both needs resource 2. If application 1 gets all resources it requested then it becomes active. But application 2 will get blocked if it sends in its request immediately after application 2. A Resource Allocation Problem aims at allocating resources so that as many as possible applications are active. But here we rephrase it into a decision problem that can be used to answer the original problem. For an integer k, can we bring k or more applications active through a good way of resource allocation? Prove that this problem is NP complete. Note that you should follow the template of writing proof for the NP Complete problem: (1) (2 points) Prove that the Resource Allocation problem is an NP problem (you should also analyse the computing complexity of the certifier); (2) (4 points) Identify a well-known NP-Complete problem and show the construction of a Resource Allocation problem out of the well-known NP-Complete problem. (3) (4 points) Show the correctness of the reduction
Suppose you are the manager of a small cloud computing service providing company. The cloud system has a set of m resources (computing, networking, storage, memory etc.) to be shared by a set of n applications. At any given point of time, each application requests a set of resources. Each resource might be requested by multiple applications at the same time; but it can only be used by a single application at a time. Your job is to allocate resources to applications that request them. An application becomes active when it is allocated all the resources it requests, and it gets blocked otherwise. As an example, there are 3 resources and 2 applications. Application 1 needs resource 1 and 2, and application 2 needs resource 2 and 3. So application 1 and application 2 cannot be active at the same time since both needs resource 2. If application 1 gets all resources it requested then it becomes active. But application 2 will get blocked if it sends in its request immediately after application 2. A Resource Allocation Problem aims at allocating resources so that as many as possible applications are active. But here we rephrase it into a decision problem that can be used to answer the original problem. For an integer k, can we bring k or more applications active through a good way of resource allocation? Prove that this problem is NP complete. Note that you should follow the template of writing proof for the NP Complete problem: (1) (2 points) Prove that the Resource Allocation problem is an NP problem (you should also analyse the computing complexity of the certifier); (2) (4 points) Identify a well-known NP-Complete problem and show the construction of a Resource Allocation problem out of the well-known NP-Complete problem. (3) (4 points) Show the correctness of the reduction.
Questions
1. Suppose you need to find a function to classify cases into k > 2 multiple classes. Use the following notation. Denote X the space of the input variable X, and Y = {1, 2,14 the space of the output variable Y. Define lly(x) = P (Y = y IX = x). In words, ny(x) is the probability that Y belongs to the classy when X = x. Note: For this question, your effort will be considered. So, even if you don’t get to the final solution, make sure to show your steps. (a) (10 points) Show that if we select a 0— 1 loss function, the risk is equivalent to the unconditional probability that y f (x). (b) (20 points) Find the best a classifier (called Bayes Classifier) f*: X -> 9. Consider best the classifier that minimizes the risk using the 0 —1 loss function. • Hint 1: You will see that the classifier must give f* = argminR(f) = argmaxiy(x) I yeY
(c) (20 points) Show that
vi. : x -> y,R(f) -R(f*) = E [max {P(Y =y I X)} — P(Y = f (X) I X)] ycY
Interpret the quantity R(f) —R(f*). What does it measure?
COM2528: Assignment 2 Due date: 16 May 2020 For the assignment 2: 1. Go through the student guide in detail 2. Go through Chapters 13 and 14 (pages 462-536) of the eBook by Stuart Russel and Peter Norvig provided on Black Board. 3. Go through all the ppt slides posted on Black Board. Total: 100 marks Question 1 Imagine that 99% of the time RE Disease (RED) causes red eyes in those with the disease, at any point in time 2% of all people have red eyes, and at any point in time 1% of the population has RED. Ben has red eyes. What is the probability that he has RED? [02] Question 2 Answer the following end of chapter exercises on Pages 489 and 490 Exercise 13.1 [2] Exercise 13.2 [4] Exercise 13.3 [10] Exercise 13.4 [10] Exercise 13.6 [08] Exercise 13.8 [10] Exercise 13.9 [10] Exercise 13.10 [05] Exercise 13.11 [10] Exercise 13.13 [12] Question 3 Answer the following end of chapter exercises on Pages 533 and 534 Exercise 14.1(a-d only)
1. What sequence of numbers would be printed by the following recursive procedure if we started it with N assigned the value 1?
Question 2 - Conditional Probabilities & Entropy (30 Marks) Warning, no built in ‘motions to calculate probability or entropy from I should be used for this part. The only help you can get from R should be defame manipulation Answers using functions will not be marked men If the answer Is correct
Sports analytics I.e. the application of data science techniques to competitive sports). a rapidly growing area of data science. that question we will look at some very basic analytics applied to the outcomes of consecutive games of English Premier League (EPL). The file chelsea.csv contains a record of the outcomes of games of EPL played by Chelsea football club (CM) in the seasons from 1993 to 2018. The data Is sequential, In Me sense that each row recorded the result whether the home team wins (F), the away team wins RV, or there la a draw (0).
Please show all working including code and presentation for this question
Part it Analysing Home/Away performance (17 Marks)
Question 2.a (3 Marks) Find out the probable’s Pinchable Piche sea Loses), and Piche sea Draws). Th. Includes all the moults both home and away.
YOUR ANSWER HERE
Question 2.b (6 Marks) Find out the conditional probabilities: 1. P (Chelsea Wins! Playing St Home)
Consider the problem of determining whether a single-tape Turing machine ever writes
a blank symbol over a nonblank symbol during the course of its computation many
input string. Formulate this problem as a language and show that it is undecidable.
2. Show that A is decidable if A = m 0
*1
*
3. Let J = {w| either w = 0x for some x? A two. or w = 1y for some y? ATM} Show
that neither J nor J¯ is Turing-recognizable.
4. Give an example of an undecidable language B, where B =m B¯
Glove selection: There are 22 gloves in a drawer: 5 pairs of red gloves,4 pairs of yellow, and 2 pairs of green. You select the gloves in the dark and can check them only after a selection has been made. What is the smallest number of gloves you need to select to have at least one matching pair in the best-case? What is in the worst case?
The first phase of compilation is called scanning or lexical analysis. This phase interprets the input program as a sequence of characters and produces a sequence of tokens that will be used by the parser.
Write a C++ program that implements a scanner for a language whose tokens are defined below:
à if | then | else | begin | end | program
à |
à |
à (|) | [ |] | + | - | = |, |;
à 0|1|2|3|4|5|6|7|8|9
à albic|…|z|A|B|…|Z
The token classes that will be recognized are Keyword, Identifier, Integer, and Special. Tokens are separated by white spaces (blanks, newlines and tabs) and/or special characters. The language is NOT case sensitive (i.e., you could and probably should convert and store all the non-numeric tokens in lowercase).
You may assume that
· The input program is syntactically correct.
· There are fewer than 1000 distinct tokens.
· Each identifier has up to 15 characters.
· The long int data type of C++ is sufficient to represent any of the integers.
Your program should read the input from a file named “scan.in” and build a symbol table that contains an entry for each token that was found in the input. You may use any data structure for the symbol table (e.g., an array of struct) although compilers often use a hash table. After all the input have been read, your program should produce a summary report in a file named “scan. Out” that includes a list of the tokens that appeared in the input, the number of times each token appears in the input and the classification of each token. The last line of the output file should print the sum of all integers in the table. (This is just to ensure that the integers are read and stored as integers in your program.)