0% found this document useful (0 votes)
18 views20 pages

Ai Da

The document outlines a digital assignment focused on artificial intelligence, specifically using Google Teachable Machine for image recognition and creating a chatbot with ChatterBot. It details the step-by-step process of training and testing an image recognition model, including challenges faced and solutions implemented. Additionally, it describes the design of various agents for an AIPlannerReminder application to assist students with class scheduling and attendance management.
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)
18 views20 pages

Ai Da

The document outlines a digital assignment focused on artificial intelligence, specifically using Google Teachable Machine for image recognition and creating a chatbot with ChatterBot. It details the step-by-step process of training and testing an image recognition model, including challenges faced and solutions implemented. Additionally, it describes the design of various agents for an AIPlannerReminder application to assist students with class scheduling and attendance management.
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/ 20

SCHOOL OF COMPUTER SCIENCE AND ENGINEERNG

Fall Semester 2024-25

BCSE306L – Artificial Intelligence

DIGITAL ASSIGNMENT-1

Ishika Agarwal 22BCE3179

Objective 1: Understanding the Training and Testing Phase in Artificial Intelligence

Question: Explore Google Teachable Machine for image recognition models. Explain the process of training
and testing the model. Create a simple image recognition model using Google Teachable Machine and
document each step. What challenges did you encounter, and how did you overcome them?

Answer:

Google Teachable Machine is a user-friendly web-based tool that makes creating machine learning models
fast, easy, and accessible to everyone, without any programming knowledge. It is useful for quick
prototyping, and it supports models for image, sound, and pose recognition.

In Teachable Machine, training starts after uploading images organized by class. The model processes
these images, learning features unique to each class by adjusting weights to minimize error. It uses feature
extraction and optimization to improve classification accuracy. A live progress bar displays accuracy and
loss metrics, helping users track training performance. Training typically takes seconds to a minute,
depending on the dataset size, making it quick and efficient for small, diverse datasets.

Testing in Teachable Machine allows users to preview model performance with new images via webcam
or upload. The model provides confidence scores for each class, showing the probability of the image
belonging to each label. This real-time feedback helps users quickly gauge model accuracy and identify
areas needing improvement. Adjustments can then be made by adding more images or refining classes to
enhance classification accuracy, ensuring the model performs well on real-world images.

https://teachablemachine.withgoogle.com/models/p6NYsaxTx/

Steps to create an image recognition model using Google Teachable Machine

1. Access Google Teachable Machine:

i. Go to Teachable Machine (https://teachablemachine.withgoogle.com) and select the Get


Started button.

ii. Select Image Project and choose the Standard Image Model option.

2. Set Up Classes for Image Recognition:

i. In the Image Project setup, define the classes needed for dog classification, using the five
popular breeds: Labrador Retriever, French Bulldog, Golden Retriever, German
Shepherd, and Poodle.

1
ii. Click on Add a class to create a label for each dog breed (category). Each class will be
trained to recognize images associated with that label.

3. Collect and Upload Images:

i. Capture images using the webcam or upload images from a computer. Aim for around 20–
30 images per breed to ensure the model’s accuracy.

ii. Balance the number of images across classes to prevent the model from becoming biased
toward any particular breed.

4. Train the Model:

i. After adding images to each class, click on the Train Model button. Teachable Machine
will process the images to build a model for classification.

ii. During training, metrics such as accuracy and loss can be monitored. The process usually
completes within seconds to a minute, depending on the dataset size.

5. Testing the Model:

i. After training, a preview screen will appear where the model can be tested. Upload an
image of a dog to verify if the model correctly classifies it.

ii. The model will display the probability of each class, showing how confident it is in its
prediction.

6. Export the Model:


i. To deploy the trained model, select the Export Model button. Google Teachable Machine
offers multiple export formats, such as TensorFlow, TensorFlow.js, or TensorFlow Lite. The
appropriate format can be chosen based on the deployment needs (e.g., TensorFlow.js for
web or TensorFlow Lite for mobile applications).

Challenges Encountered and Solutions

1. Image Quality and Variety: Low-quality images or images that are too similar might result in the
model failing to generalize to new images. I used a variety of images for each class, with different
backgrounds, lighting, and angles, to ensure the model learns from diverse examples.

2. Class Imbalance: When one class has more images than another, the model might develop a bias
toward the more frequent class. I made sure to balance the number of images for each class by
either collecting more data or reducing the count of the over-represented class.

3. Overfitting with Small Datasets: With too few images, the model can memorize specific examples
instead of learning general features. I used as many images as feasible and added a variety to avoid
overfitting.

2
3
4
Google Teachable Machine provides a user-friendly approach for building an image recognition model with
minimal technical complexity. While it has some limitations regarding advanced control over parameters,
it serves as an excellent tool for prototyping and educational use. After training the model on five dog
breeds with 23–30 images per class, it successfully identified each breed, demonstrating its effectiveness
for basic image classification tasks.

5
Objective 2: Understanding How to Use Pre-trained Models

Question: Create your own chatbot using a pre-trained library like ChatterBot or OpenAI. Describe the
steps involved in setting up the chatbot, integrating the pre-trained model, and testing its functionality.
Provide examples of interactions with your chatbot. What are the limitations of using pre-trained models
in your chatbot?

Answer:

ChatterBot is a Python library that facilitates the generation of automated responses to user inputs. By
employing various machine learning algorithms, ChatterBot can produce a range of response types,
allowing developers to easily create chatbots and streamline interactions with users.

1. Install Required Libraries:


i. Open a terminal or command prompt.
ii. Install ChatterBot and ChatterBot corpus by typing:

pip install chatterbot chatterbot_corpus

2. Write the Chatbot Script:


i. Open a code editor – VS Code.
ii. Create a new Python file – chatbot.py
iii. Import the ChatterBot library and set up the chatbot.
iv. Set up a loop to take input from the user and output the model’s response.

3. Run the Chatbot:


i. Save the Python script. In the terminal, run the script by typing:

python chatbot.py

4. Testing the Chatbot


i. In the command prompt, type a message such as "Hello" or "What is the capital of
France?" and press Enter.
ii. The chatbot will provide a response based on the pre-trained model.

Limitations of Using Pre-Trained Models


1. Lack of Contextual Memory: The model cannot remember prior conversation history or maintain
context over multiple interactions.

2. General Responses: Without fine-tuning, the model might provide generic answers that lack
depth on specific topics.

3. Training Data Bias: Responses may reflect biases or limited perspectives based on the data used
to train the model.

6
7
Objective 3: Understanding the Working Principles of Agents for AIPlannerReminder

Question: Design and implement the following agents using Python for an AIPlannerReminder application.
Use a .csv file with event schedules to provide perception input. The application should help students plan
and be reminded of their classes effectively. Implement and explain each agent with its respective
algorithm.

Answer:

In designing the AIPlannerReminder application for students, each agent serves a specific purpose in
ensuring timely reminders and effective class attendance management.

Set up a schedule_file.csv to store the student’s course schedule with columns – Course, Day, Time,
Holiday, Attendance % and Crucial.

1. Simple Reflex Agent

The Simple Reflex Agent monitors the schedule and notifies the student if they have a class based on the
current day and time.

Algorithm:

 The agent reads from a schedule_file CSV file to determine if there is a class today and within the
current time range.

8
 By checking each row in the schedule, it matches the current day and compares the current time
to see if it falls within the specified class hours.

 If the time matches, the agent notifies the user of the class.

Challenges:

 This agent lacks contextual awareness, such as understanding holidays or prioritizing classes.

 Ensuring the correct time format in the .csv file.

 Scheduling the function to run periodically to check for class notifications.

9
Correctly notifies student about Calculus class from 14:00 – 14:50.

2. Model-Based Reflex Agent

This agent improves upon the Simple Reflex Agent by incorporating knowledge of holidays to avoid
notifying the user on days when classes are canceled.

Algorithm:

 Inherits from the Simple Reflex Agent but adds a holiday check before notifying.

 If the holiday column for the current day indicates “No,” the agent proceeds with the notification.

Challenges:

 Adding more contextual checks, like different holiday rules, could complicate the decision logic.
 Accounting for varying holiday schedules, especially in semesters with irregular breaks.

10
When the Calculus Class (14:00-14:50) is marked No under Holiday, student is notified about attending the
class.

11
When the Calculus Class (14:00-14:50) is marked Yes under Holiday, student is notified the current time,
but there is no reminder about attending the class, because it is a holiday.

3. Goal-Based Agent

This agent monitors the student’s attendance to ensure they meet a minimum 75% requirement for each
course.

Algorithm:

 It checks the schedule and compares attendance data stored in the CSV file.

 If the student’s attendance for a course falls below 75%, the agent notifies them that it’s essential
to attend that class.

 If attendance is already above 75%, a general reminder is provided.

Challenges:

 Managing the attendance percentage dynamically as it changes over time.

12
Reminds the user to attend Calculus class in the current time slot as attendance is below 75%. (i.e. 50%)

13
4. Utility-Based Agent

The agent prioritizes classes based on their importance by highlighting “crucial” classes.

Algorithm:

 The CSV includes a “Crucial” column to indicate important classes. If a class is marked crucial, the
agent emphasizes the need to attend.

 For non-crucial classes, the agent provides a standard notification.

Challenges:

 Defining the criteria for what qualifies as a “crucial” class.


 Determining and maintaining an up-to-date list of priority topics.

14
When the Calculus class in 14:00-14:50 slot is marked as crucial, critical reminder is sent to student to
attend the class.

15
When the Calculus class in 14:00-14:50 slot is not marked as crucial, general reminder is sent to student
about the same.

16
5. Learning Agent

The Learning Agent aims to understand the student’s behavior and adapt notifications accordingly. This
approach allows it to learn the student's attendance habits and improve notification accuracy over time.

Algorithm:

 Data Collection: The agent records when the student attends or misses classes. Each interaction
with the student is logged, including the day, time, course, and whether the student attended.

 Pattern Recognition: Using this historical attendance data, the agent identifies patterns. For
instance, if the student tends to miss classes on Mondays, it will prioritize Monday notifications.
Similarly, it can learn that the student attends important classes even without reminders and
adjust notifications accordingly.
 Feedback Loop: After sending a notification, the agent records whether the student attended the
class. This feedback allows the agent to adjust its model, improving its notification accuracy.

Over time, the agent can use machine learning techniques like logistic regression or decision trees to
model the likelihood of the student needing a reminder based on factors like day of the week, class
importance, and previous attendance.

Challenges:

 Limited data availability, making it difficult to detect meaningful attendance patterns early on.
 Selecting a suitable model that balances simplicity with predictive accuracy is also key, as complex
models may overfit with sparse data.
 Ensuring timely, relevant notifications without overwhelming the user requires fine-tuning
notification timing based on past responses.

17
18
19
Each agent in the AIPlannerReminder project is built to handle different levels of complexity. The Simple
Reflex Agent provides a basic notification system, while the Model-Based Reflex Agent adds holiday
awareness. The Goal-Based Agent ensures minimum attendance is maintained, and the Utility-Based
Agent emphasizes the importance of specific classes. Together, they represent a structured approach to
building intelligent reminders for students based on varying degrees of situational awareness. The
Learning Agent observes and adapts based on the student’s behavior, making it increasingly effective in
delivering notifications only when necessary. This creates a personalized and dynamic scheduling assistant
that gets "smarter" with each interaction.

20

You might also like