CSE643 – AI – Assignment 3 Solved

$ 29.99
Category:

Description

Write a python program using durable-rules module with forwardchaining rules for course-and -extracurricular activities suggestion system for a non-graduating student of IIITD based on grades and interests.
Assumption:
• User is a student of MTech in IIITD Source Code:
from durable.lang import ruleset, when_all, m, post, _main_host
if _main_host is not None:
_main_host._ruleset_directory.clear()
from durable.lang import *
with ruleset(‘courses’):
@when_all((m.grade == ‘9.0’) & (m.department == ‘cse’) ) def aiml(c):
c.assert_fact(‘skill’, { ‘field’: ‘ai-ml’ })
c.assert_fact({ ‘subject’: ‘Join’, ‘predicate’: ‘a’, ‘object’:
‘coding club.’ })
c.assert_fact({ ‘subject’: ‘Build’, ‘predicate’: ‘a’, ‘object’:
‘predictive model.’ })
c.assert_fact({ ‘subject’: ‘Travel’, ‘predicate’: ‘to’, ‘object
‘: ‘different places.’ })

@when_all((m.grade == ‘8.0’) & (m.department == ‘cse’) ) def de(c):
c.assert_fact(‘skill’, { ‘field’: ‘Data Engineering’ })
c.assert_fact({ ‘subject’: ‘Play’, ‘predicate’: ‘coding’, ‘obje ct’: ‘games.’ })
c.assert_fact({ ‘subject’: ‘Contribute’, ‘predicate’: ‘to’, ‘ob ject’: ‘open source platforms.’ })
c.assert_fact({ ‘subject’: ‘Travel’, ‘predicate’: ‘to’, ‘object
‘: ‘different places.’ })

@when_all((m.grade == ‘7.5’) & (m.department == ‘cse’) ) def info(c):
c.assert_fact(‘skill’, { ‘field’: ‘Information Security’ })
c.assert_fact({ ‘subject’: ‘Join’, ‘predicate’: ‘ethical hackin g’, ‘object’: ‘club.’ })
c.assert_fact({ ‘Play’, ‘predicate’: ‘some’, ‘object
‘: ‘sport.’ })

@when_all((m.grade == ‘7.0’) & (m.department == ‘cse’) ) def mobile(c):
c.assert_fact(‘skill’, { ‘field’: ‘Mobile Computing’ })
c.assert_fact({ ‘subject’: ‘Build’, ‘predicate’: ‘a’, ‘object’:
‘website or an app.’ })

@when_all((m.grade == ‘8.0’) & (m.department == ‘ece’) ) def mobile(c):
c.assert_fact(‘skill’, { ‘field’: ‘VLSI & Embedded Systems’ })
c.assert_fact({ ‘subject’: ‘Play’, ‘predicate’: ‘some’, ‘object
‘: ‘sport.’ })
c.assert_fact({ ‘subject’: ‘Travel’, ‘predicate’: ‘to’, ‘object
‘: ‘different places.’ })

@when_all((m.grade == ‘9.0’) & (m.department == ‘ece’) ) def mobile(c):
c.assert_fact(‘skill’, { ‘field’: ‘Machine Learning’ })
c.assert_fact({ ‘subject’: ‘Build’, ‘predicate’: ‘a’, ‘object’:
‘predictive model.’ })
c.assert_fact({ ‘subject’: ‘Travel’, ‘predicate’: ‘to’, ‘object
‘: ‘different places.’ })

@when_all((m.grade == ‘7.0’) & (m.department == ‘ece’) ) def mobile(c):
c.assert_fact(‘skill’, { ‘field’: ‘Cyber-Physical Systems’ })
c.assert_fact({ ‘subject’: ‘Join’, ‘predicate’: ‘some’, ‘object
‘: ‘clubs.’ })

@when_all((m.grade == ‘7.0’) & (m.department == ‘cb’) ) def mobile(c):
c.assert_fact(‘skill’, { ‘field’: ‘cb’ })
c.assert_fact({ ‘subject’: ‘Build’, ‘predicate’: ‘a’, ‘object’:
‘disease prediction model.’ })
c.assert_fact({ ‘subject’: ‘Read’, ‘predicate’: ‘new developmen ts’, ‘object’: ‘in medical science.’ })

@when_all(+m.subject) def output(c):
print(‘Fact: {0} {1} {2}’.format(c.m.subject, c.m.predicate, c. m.object)) with ruleset(‘skill’):
@when_all((m.field == ‘ai-ml’)) def mathc(d):
d.assert_fact({ ‘Artificial Intelligence course’ })
d.assert_fact({ ‘subject’: ‘Machine Learning course’ })
d.assert_fact( {‘subject’: ‘Reinforcement Learning course’ })
d.assert_fact( {‘subject’: ‘Data Mining course’ })

@when_all((m.field == ‘Information Security’)) def mathc(d):
d.assert_fact({ ‘subject’: ‘Network Security course’ })
d.assert_fact({ ‘subject’: ‘Foundations of Computer Security co urse’ })
d.assert_fact( {‘subject’: ‘Applied Cryptography course’ })
d.assert_fact( {‘subject’: ‘Adaptive Security course’ })

@when_all((m.field == ‘Mobile Computing’)) def mathc(d):
d.assert_fact({ ‘subject’: ‘Mobile Computing course’ })
d.assert_fact({ ‘subject’: ‘Wireless Networks course’ })
d.assert_fact( {‘subject’: ‘Distributed Systems course’ })
d.assert_fact( {‘subject’: ‘Network Security course’ })

@when_all((m.field == ‘Data Engineering’)) def mathc(d):
d.assert_fact({ ‘subject’: ‘Data Mining course’ })
d.assert_fact({ ‘subject’: ‘Database System Implementation cour se’ })
d.assert_fact( {‘subject’: ‘Information Retrieval course’ })
d.assert_fact( {‘subject’: ‘Big Data Analytics course’ })

@when_all((m.field == ‘VLSI & Embedded Systems’)) def mathc(d):
d.assert_fact({ ‘subject’: ‘SOC Design & Test course’ })
d.assert_fact({ ‘subject’: ‘Mixed Signal Design course’ })
d.assert_fact( {‘subject’: ‘Computer Architecture course’ })
d.assert_fact( {‘subject’: ‘VLSI Design Flow course’ })

@when_all((m.field == ‘Machine Learning’)) def mathc(d):
d.assert_fact({ ‘subject’: ‘Statistical Signal Processing cours e’ })
d.assert_fact({ ‘subject’: ‘Theories of Deep Learning course’ }
)
d.assert_fact( {‘subject’: ‘CProbabilistic Graphical Models cou rse’ })
d.assert_fact( {‘subject’: ‘Data Sciences and Management in Pyt hon course’ })

@when_all((m.field == ‘Cyber-Physical Systems’)) def mathc(d):
d.assert_fact({ ‘Wireless Communications course’ })
d.assert_fact({ ‘subject’: ‘Wireless system implementation cour se’ })
d.assert_fact( {‘subject’: ‘3GPP Standards for Wireless Network s course’ })
d.assert_fact( {‘subject’: ‘Mobile Computing course’ })

@when_all((m.field == ‘cb’)) def mathc(d):
d.assert_fact({ ‘subject’: ‘Foundations of Modern Biology cours e’ })
d.assert_fact({ ‘subject’: ‘Algorithms in Computational Biology course’ })
d.assert_fact( {‘subject’: ‘Cell Biology and Biochemistry cours e’ })
d.assert_fact( {‘subject’: ‘Introduction to Mathematical Biolog y course’ })

@when_all(+m.subject) def output(c):
print(‘Fact: {0}’.format(c.m.subject))
Sample Outputs:

Reviews

There are no reviews yet.

Be the first to review “CSE643 – AI – Assignment 3 Solved”

Your email address will not be published. Required fields are marked *