0% found this document useful (0 votes)
47 views9 pages

Experiment No. 02: PEAS Description For A Medical Diagnosis System: Performance Measure

The document describes an experiment involving a medical diagnosis system. The system aims to accurately diagnose patients based on available information and provide appropriate treatment recommendations. It receives patient data as input and provides diagnoses and recommendations as output, such as recommending additional tests or referring patients to specialists. The goal is to diagnose patients efficiently and effectively while minimizing risks.

Uploaded by

Janhavi S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views9 pages

Experiment No. 02: PEAS Description For A Medical Diagnosis System: Performance Measure

The document describes an experiment involving a medical diagnosis system. The system aims to accurately diagnose patients based on available information and provide appropriate treatment recommendations. It receives patient data as input and provides diagnoses and recommendations as output, such as recommending additional tests or referring patients to specialists. The goal is to diagnose patients efficiently and effectively while minimizing risks.

Uploaded by

Janhavi S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Experiment No.

02

PEAS description for a medical diagnosis system :

Performance Measure:
The primary performance measure for the medical diagnosis system is the accuracy of its
diagnoses. This can be measured by the number of correct diagnoses made out of the
total number of cases. The system should also be evaluated based on the speed of its
diagnoses and the efficiency of its recommendations, such as the number of tests
recommended and the number of referrals to other healthcare professionals.

Environment:
The medical diagnosis system operates within a clinical environment. The system may be
integrated into a larger hospital or clinic, or it may be a standalone system. Patients come
to the clinical environment with symptoms or medical complaints, and healthcare providers
evaluate them. The system receives patient data from healthcare providers, including the
patient's medical history, current symptoms, vital signs, and laboratory test results.

Actuators:
The medical diagnosis system provides recommendations or diagnoses based on the
input received. The system may recommend additional tests, such as blood tests, imaging
studies, or biopsies. It may also refer patients to specialists or other healthcare
professionals, such as cardiologists or oncologists. The system may provide treatment
recommendations, such as medication regimens, surgery, or physical therapy.

Sensors:
The medical diagnosis system receives patient data from healthcare providers. This may
include electronic medical records, vital signs monitors, laboratory test results, and
imaging studies. The system may also receive input from patients, such as self-reported
symptoms or responses to questionnaires.

Goal:
The goal of the medical diagnosis system is to accurately diagnose patients based on the
information available and provide appropriate treatment recommendations. The system
aims to provide a high-quality service, reduce the time taken to reach a diagnosis, and
minimize the risk of misdiagnosis or incorrect treatment. The system should also aim to
improve the patient's overall health and well-being by providing effective treatment
recommendations. Additionally, the system should aim to reduce healthcare costs by
minimizing unnecessary tests and referrals.
Experiment No. 03

Program :
from collections import defaultdict
class Graph:
def __init__(self):
self.graph = defaultdict(list)
def addEdge(self,u,v):
self.graph[u].append(v)
def BFS(self, s):
visited = [False] * (len(self.graph))
queue = []
queue.append(s)
visited[s] = True
while queue:
s = queue.pop(0)
print (s, end = " ")
for i in self.graph[s]:
if visited[i] == False:
queue.append(i)
visited[i] = True
g = Graph()
g.addEdge(0, 1)
g.addEdge(0, 2)
g.addEdge(1, 2)
g.addEdge(2, 0)
g.addEdge(2, 3)
g.addEdge(3, 3)
print ("Following is Breadth First Traversal"
" (starting from vertex 2)")
g.BFS(2)

Output :
Experiment No. 04
Program :
from heapq import heappush, heappop
graph = {
'A': {'B': 5, 'C': 10},
'B': {'D': 6},
'C': {'D': 8},
'D': {'E': 12},
'E': {}
}
def heuristic(node, goal):
heuristic_values = {'A': 16, 'B': 11, 'C': 8, 'D': 4, 'E': 0}
return heuristic_values[node]
start = 'A'
goal = 'E'
if start not in graph:
raise ValueError("start is not in the graph")
if goal not in graph:
raise ValueError("goal is not in the graph")
g_score = {start: 0}
f_score = {start: heuristic(start, goal)}
open_set = [(f_score[start], start)]
came_from = {}
while open_set:
current = heappop(open_set)[1]
if current == goal:
path = [current]
while current in came_from:
current = came_from[current]
path.append(current)
print("Shortest path:", path[::-1])
break
for neighbor in graph[current]:
tentative_g_score = g_score[current] + graph[current][neighbor]
if neighbor not in g_score or tentative_g_score < g_score[neighbor]:
came_from[neighbor] = current
g_score[neighbor] = tentative_g_score
f_score[neighbor] = tentative_g_score + heuristic(neighbor, goal)
heappush(open_set, (f_score[neighbor], neighbor))
else:
raise ValueError("no path found")

Output :
Experiment No. 05
Program :

Output :
Experiment No. 06
Experiment No. 07
Program :
Main.py
from BlockWorldAgent import BlockWorldAgent def test():
# This will test your BlockWorldAgent # with eight initial test cases. test_agent =
BlockWorldAgent()

initial_arrangement_1 = [["A", "B", "C"], ["D", "E"]]


goal_arrangement_1 = [["A", "C"], ["D", "E", "B"]]
goal_arrangement_2 = [["A", "B", "C", "D", "E"]]
goal_arrangement_3 = [["D", "E", "A", "B", "C"]]
goal_arrangement_4 = [["C", "D"], ["E", "A", "B"]]

print(test_agent.solve(initial_arrangement_1, goal_arrangement_1))
print(test_agent.solve(initial_arrangement_1, goal_arrangement_2))
print(test_agent.solve(initial_arrangement_1, goal_arrangement_3))
print(test_agent.solve(initial_arrangement_1, goal_arrangement_4))

initial_arrangement_2 = [["A", "B", "C"], ["D", "E", "F"], ["G", "H", "I"]]
goal_arrangement_5 = [["A", "B", "C", "D", "E", "F", "G", "H", "I"]]
goal_arrangement_6 = [["I", "H", "G", "F", "E", "D", "C", "B", "A"]]
goal_arrangement_7 = [["H", "E", "F", "A", "C"], ["B", "D"], ["G", "I"]]
goal_arrangement_8 = [["F", "D", "C", "I", "G", "A"], ["B", "E", "H"]]

print(test_agent.solve(initial_arrangement_2, goal_arrangement_5))
print(test_agent.solve(initial_arrangement_2, goal_arrangement_6))
print(test_agent.solve(initial_arrangement_2, goal_arrangement_7))
print(test_agent.solve(initial_arrangement_2, goal_arrangement_8))

if name == " main ": test()

BlockWorldAgent.py

import copy import time


class BlockWorldAgent: def init (self):
pass
def solve(self, initial_arrangement, goal_arrangement): start = time.time()

class State:
def init (self, first_stack, second_stack, total_num, moves=None): if moves is None:
moves = [] self.first_stack = first_stack
self.second_stack = second_stack self.total_num = total_num self.moves = moves

def eq (self, other):


return (self.first_stack == other.first_stack and self.second_stack == other.second_stack
and self.total_num == other.total_num and self.moves == other.moves)
def goal_state_move(self):
while self.difference() != 0: self = self.select_move()
return self.moves
def select_move(self): # will select and return the best move for index, stack in
enumerate(self.first_stack):
for index2, stack2 in enumerate(self.first_stack):
if index != index2: # don't move to itself stack
curr_table, move = self.valid_state_move(self.first_stack, index, index2)
new_state = State(curr_table, self.second_stack, self.total_num, copy.copy(self.moves))
new_state.moves.append(move)
if new_state.difference() < self.difference():
return new_state

# move the top block to the temp_table, skip if it is already on the table (itself alone on a
table) for index, stack in enumerate(self.first_stack):
if len(stack) > 1: # not it self alone
curr_table, move = self.valid_state_move(self.first_stack, index, -1) # -1 means table
new_state = State(curr_table, self.second_stack, self.total_num, copy.copy(self.moves))
new_state.moves.append(move)
if new_state.difference() <= self.difference(): return new_state

def valid_state_move(self, table, start_index, end_index): temp_table =


copy.deepcopy(table)
left = temp_table[start_index] top_block = left.pop()
right = []

if end_index < 0: # move to table (-1) temp_table.append(right)


move = (top_block, 'Table') else: # move to stack
right = temp_table[end_index] move = (top_block, right[-1])

Output :
Experiment No. 08
Program :
import numpy
as np import
pandas as pd
import csv
from pgmpy.estimators import
MaximumLikelihoodEstimator from
pgmpy.models import BayesianModel
from pgmpy.inference import VariableElimination

heartDisease =
pd.read_csv('heart.csv') heartDisease
= heartDisease.replace('?',np.nan)

print('Sample instances from the dataset are given below')


print(heartDisease.head())

print('\n Attributes and


datatypes')
print(heartDisease.dtypes)

model=
BayesianModel([('age','heartdisease'),('sex','heartdisease'),('exang','heartdisease'),('cp','
heartdisease'),(' heartdisease','restecg'),('heartdisease','chol')])
print('\nLearning CPD using Maximum likelihood estimators')
model.fit(heartDisease,estimator=MaximumLikelihoodEstimator)

print('\n Inferencing with Bayesian Network:')


HeartDiseasetest_infer =
VariableElimination(model)

print('\n 1. Probability of HeartDisease given evidence= restecg')


q1=HeartDiseasetest_infer.query(variables=['heartdisease'],evidenc
e={'restecg':1}) print(q1)

print('\n 2. Probability of HeartDisease given evidence= cp ')


q2=HeartDiseasetest_infer.query(variables=['heartdisease'],
evidence={'cp':2}) print(q2)
Output :

You might also like