Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(a) Express the following Predicate Calculus statement in Prolog. cxy((Parent(x,c)BiologicalParent(y,c))x=yAdopted(c)) (5 marks) (b) Write a recursive Prolog predicate fib(N, F) to compute the Fibonacci series
(a) Express the following Predicate Calculus statement in Prolog. cxy((Parent(x,c)BiologicalParent(y,c))x=yAdopted(c)) (5 marks) (b) Write a recursive Prolog predicate fib(N, F) to compute the Fibonacci series 0,1,2,3,5,8,13,21 (5 marks) (c) Write a Python function myDotProd(a,b) which computes the dot-product of 2 vectors of equal size using a loop. You are not to use the numpy.dot() operation. (5 marks) (d) Write Python code for a simple perceptron decision function buyCocktail( x), which decides on whether to buy an expensive cocktail or not based on the following inputs where x=[x1,x2,x3]. x1=1 means you have plenty of cash, x1=0 means you do not. x2=1 means you want to impress a new girlfriend, 0 means you don't. x3=1 means it's a busy exciting night on the town, 0 means it is not. Choose the weights and threshold (or bias) so that if you want to impress someone, you will buy cocktails no matter what. However, if you are not out to impress but it's an exciting night and you have plenty of cash, you will buy a cocktail. Otherwise you will not buy a cocktail. (5 marks) (e) Suppose you were to train a perceptron to behave as described in part(d) instead of handcrafting the weights. Write down an appropriate list of input training vectors and the corresponding list of desired outputs which could be used to train such a perceptron
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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