Artificial intelligence


Artificial Intelligence

1.    A 4-input Neuron has weights (1,-1,  0,  0.5.Calculate the network output when the following input vectors are applied.

1397_eqation_1.jpg

For calculation assume:

a. f(net) = unipolar binary
b. f(net) = bipolar binary

2.  The network shown in figure 2 uses neurons with:
(a) Unipolar Binary;
(b) Bipolar Binary.

702_bionomial.jpg

Calculate a table of responses to all four possible Boolean inputs.

Ex 3 (Portfolio).  You are to complete the subsequent coronary disease production system :-
The Rules:

Rule 1:
IF X has a risk of heart attack
AND X has had a previous heart attack
THEN give X the drug Digitalis

Rule 2:
IF X has left quadratic pain
AND X has high blood pressure
THEN X has a risk of a heart attack

Rule 3:
IF X has raised intraocular pressure
THEN X has high blood pressure

Rule 4:
IF X has high blood pressure AND X is a heavy smoker
THEN X has a risk of a heart attack

Rule 5:
IF X is an asthmatic AND X has a risk of heart attack
AND X has had a previous heart attack THEN
Give X the drug Preminol-V (this is a fictional drug name!!)

The Facts:

A: Smith has raised intraocular pressure
B: Smith has had a previous heart attack
C: Smith has left quadratic pain
D: Smith is a heavy smoker
E: Jones is an asthmatic
F: Jones has raised intraocular pressure
G: Jones is a heavy smoker
 ________________________________________

%forward chaining Production system
:-op(800,fx,if).        %set operators for if
:-op(700,xfx,then).     %then rules
:-op(300,xfy,or).
:-op(200,xfy,and).
 %dynamic(....) allows predicate inside brackets fact to be asserted and retracted,
% here were are making fact (/1 means fact has 1 argument) dynamic so we can add and
% take facts from working memory.
:-dynamic(fact/1).
fact(has(smith,raisedIntraocularPressure)).        %list of facts
...
forward:-
  new_fact(P),
  !,
  write('New fact '), write(P),nl,
  asserta(fact(P)),                        %adds a fact to working memory
  forward
;
write('no more facts').
new_fact(Action):-
  if Condition then Action,
  not(fact(Action)),
  composedFact(Condition).
composedFact(Cond):-
  fact(Cond).
composedFact(C1 and C2):-
  composedFact(C1),
  composedFact(C2).
composedFact(C1 or C2):-
  composedFact(C1)
;
  composedFact(C2).
if has(Person,riskOfHeartAttack) and has(Person,previousHeartAttack)        %list of rules
then need(Person,digitalis).
...
not(X):-
 X,!,fail;true.
________________________________________

Once you have added all the relevant facts and rules to the code (ensuring you have capital letters in the correct places!!) - start the ball rolling by the query  '?- forward.'  - its also worth tracing the execution of the code using 'trace' to follow the firing of the rules.
Ensure you understand how the if .. then .. definitions work and the action of the assert command.
How does your production system decide which rule to fire next?
Does this differ from those covered in the lecture and the associated texts?
Can you think of any better methods for determining the order?

Ex 4 (Portfolio).
Improve your code so that the list of facts in the database can be printed to the screen.  Similarly add a command to list all the rules in the database.

Request for Solution File

Ask an Expert for Answer!!
MATLAB Programming: Artificial intelligence
Reference No:- TGS01099

Expected delivery within 24 Hours