0% found this document useful (0 votes)
6 views35 pages

AI File

This document is a practical file on Artificial Intelligence submitted by Simar Kumar for a school project. It includes acknowledgments, a certificate of authenticity, an index of topics covered, various Python programs, applications of AI, and explanations of machine learning types and computer vision tasks. The document serves as a comprehensive guide to understanding AI concepts and their practical implementations.

Uploaded by

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

AI File

This document is a practical file on Artificial Intelligence submitted by Simar Kumar for a school project. It includes acknowledgments, a certificate of authenticity, an index of topics covered, various Python programs, applications of AI, and explanations of machine learning types and computer vision tasks. The document serves as a comprehensive guide to understanding AI concepts and their practical implementations.

Uploaded by

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

Artificial Intelligence

PRACTICAL FILE
SUBMITTED TO: KANCHAN CHOWDHARY
SUBMITTED BY: simar kumar

CLASS : 10

ROLL NO : 4
Artificial
Intelligence

ACKNOWLEDGEMENT

I am overwhelmed in all humbleness and


gratefulness to acknowledge my depth to all those
who have helped me to put these ideas, as well
above the level or simplicity and into something
concrete.

I would like to express my special thanks of


gratitude to my teacher Mrs. Kanchan Chowdhary
who gave me the golden opportunity to perform
this wonderful project on python” which also
helped me in doing a lot of new things to learn. I
am thankful to all.

CERTIFICATE

THIS IS TO CERTIFY THAT THE PROJECT through


PYTHON” SUBMITTED BY “Simar Kumar ” IN PARTIAL
FULFILLMENT OF THE REQUIREMENT FOR CBSE AT
“MADE EASY SCHOOL” IS AN AUTHENTIC WORK
CARRIED OUT BY HER UNDER MY SUPERVISION AND
GUIDANCE. TO THE BEST OF MY KNOWLEDGE , THE
MATTER EMBODIED IN THE PROJECT HAS NOT BEEN
SUBMITTED TO ANY OTHER INSTITUTION

Index
1. Python Programs

2. Applications of AI

3. Auto Draw

4. Word tune
5. AI Project cycle

6. Machine learning

7. Teachable Machine

8. Rock , Paper and Scissors

9. Visualising Data using Matplotlib

10. Computer vision tasks

11. Pixels

12. Applications of NLP

13. Evaluation
1. To print the following patterns using multiple print
commands

Input
print(‘*’)
print(‘**’)
print(‘***’)
print(‘****’)
print(‘*****’)
print(‘*****’)
print(‘****’)
print(‘***’)
print(‘**’)
print(‘*’)

Output
*
**
***
****
*****
*****
****
***
**
*

2. To find the sum of two numbers 15 and 20.


Input
a =15
b=20
print(a+b)

Output
35
3. To calculate Area of a triangle with Base and Height.

Input
a=input(‘Enter the base:’)
b=input(‘Enter the height:’)
c=½*a*b
print(‘Area of the triangle is’,c)

Output
Enter the base: 2
Enter the height: 2
Area of the triangle is 2

4. To calculate average marks of 3 subjects

Input
a=input(‘Enter the marks scored in english:’)
b=input(‘Enter the marks scored in hindi:’)
c=input(‘Enter the marks scored in maths:’)
d=a+b+c/3
print(‘Average marks scored are’,d)

Output
Enter the marks scored in english: 47
Enter the marks scored in hindi: 47
Enter the marks scored in maths: 47
Average marks scored are 47

5. Create a list in Python of children selected for science


quiz with following names Arjun, Sonakshi, Vikram,
Sandhya, Sonal, Isha, Kartik

Perform the following tasks on the list in sequence-


○ Print the whole list
○ Delete the name “Vikram” from the list
○ Add the name “Jay” at the end
○ Remove the item which is in the second position.

Input
list=[ ‘Arjun’, ‘Sonakshi’, ‘Vikram’, ‘Sandhya’, ‘Sonal’, ‘Isha’, ‘Kartik’]
print(list)
list.del[Vikram]
list.append[Jay]
list.remove[3]
print(list)

Output
[ ‘Arjun’, ‘Sonakshi’, ‘Vikram’, ‘Sandhya’, ‘Sonal’, ‘Isha’, ‘Kartik’]
[ ‘Arjun’, ‘Sonakshi’,‘Sonal’, ‘Isha’, ‘Kartik’, ‘Jay’]

6.Create a list num=[23,12,5,9,65,44]


○ print the length of the list
○ print the elements from second to fourth
position using positive indexing
○ print the elements from position third to fifth
using negative indexing

Input
list num=[23,12,5,9,65,44]

print(len[list num])
print(list num[1,2,3])
print(list num[-2,-3,-4)]
Output
6
12,5,9

7. Write a program to add the elements of the two lists.

Input
list1=[ ‘Arjun’, ‘Sonakshi’, ‘Vikram’, ‘Sandhya’, ‘Sonal’, ‘Isha’, ‘Kartik’]
list2=[23,12,5,9,65,44]
list1.extend(list2)
print(list1)

Output
[ ‘Arjun’, ‘Sonakshi’, ‘Vikram’, ‘Sandhya’, ‘Sonal’, ‘Isha’, ‘Kartik’,23,12,5,9,65,44]
8.Write a program to calculate mean, median and mode using
Numpy

Input:
import numpy as np
import statistics
data = [1, 2, 2, 3, 4]
mean = np.mean(data)
median = np.median(data)
mode = statistics.mode(data)
print("Mean:", mean)
print("Median:", median)
print("Mode:", mode))

Output:
Mean: 2.4
Median: 2.0
Mode: 2
9.Write a program to display line chart from (2,5) to (9,10).
Input
import matplotlib.pyplot as plt
x = [2,9]
y = [5,10]
plt.plot(x, y,marker='o')
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.title('Line Chart')
plt.show()

Output
10. Write a program to display a scatter chart for the following
points (2,5), (9,10),(8,3),(5,7),(6,18).

Input
import matplotlib.pyplot as plt
x = [2, 9, 8, 5, 6]
y = [5, 10, 3, 7, 18]

plt.scatter(x, y)
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.title('Scatter Chart')
plt.show()
Output

11. Read the csv file saved in your system and display 10
rows.
Input
CSV File(data.csv)
Name,Age,Grade
Alice,14,D
Bella,15,B
Charlie,13,A
David,14,C
Eva,17,,B
Frank,14,A
Grace,13,B
Hannah,15,A
Ivan,14,C
John,13,B

Python File
import pandas as pd

df = pd.read_csv('data.csv')
print(df.head(10))

Output
Name Age Grade
0 Alice 14 D
1 Bella 15 B
2 Charlie 13 A
3 David 14 C
4 Eva 17 B
5 Frank 14 A
6 Grace 13 B
7 Hannah 15 A
8 Ivan 14 C
9 John 13 B

12.Read csv file saved in your system and display its


information

Input
print(df.info())

Output
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 10 entries, 0 to 9
Data columns (total 3 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Name 10 non-null object
1 Age 10 non-null int64
2 Grade 10 non-null object
dtypes: int64(1), object(2)
memory usage: 378.0+ bytes
13. Write a program to read an image and display using
Python

Input
Image(image.jpg)

import cv2
img = cv2.imread('image.jpg')
cv2.imshow('image', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
Output

14. Write a program to read an image and


identify its shape using Python .
Input
Image:(image12.jpg)

import cv2
img = cv2.imread('image12.jpg')
print("Image shape:", img.shape)

Output
(1980,1450,9)
15. To print first 10 natural numbers.

Input
list=[1,2,3,4,5,6,7,8,9,10,11,1,2,13,14,15]
print(list)

Output
[1,2,3,4,5,6,7,8,9,10,11,1,2,13,14,15]
Application

The present area is considered as a golden period for artificial intelligence tools and a
wide range of applications in our daily life are based on AI.

Auto Draw
It is a web based tool developed by Google that uses machine
learning algorithms to help users create professional looking
drawings and sketches quickly and easily. It uses CV to recognize
what the user is drawing and suggests a more polished version of
it. The suggestions are displayed on the screen and the user can
choose one that matches their intended drawing.
Wordtune

It is an AI-powered writing tool that uses NLP to help users improve


their writing by rephrasing and rewriting sentences. Itg also
provides personalised tips for clarity and flow in writing. It can
provide suggestions for various types of writing such as emails,
essays or social media posts.

The tool can learn from previous interactions and improve the
accuracy and relevance of suggestions overtime. It has six buttons
to enhance texts: Rewrite, Casual, Formal, Shorten, Expand and
Spices.
AI Project Cycle

Let us assume that a girl is a makeup artist and she has client who has
to get her makeup done for her birthday . But there are certain
problems and steps that are to be considered while doing the makeup.
To accomplish this task the makeup artist can follow the above 5 steps
mentioned to accomplish the task in a systematic manner.
Similarly, if we have to develop an AI project,we have to follow an
appropriate framework which can lead us towards the goal. This is
called the AI Project Cycle. The AI Project Cycle mainly has 5
stages:

Problem scooping :
Problem scoping involves identifying the underlying problem (Diving deep into the root
cause of the problem ).

In the example taken, The client has a dry and a sensitive skin , she needs glittery yet
simplistic look . Thus achieving this look is the main task .

Data Acquisition:
This stage is about acquiring data for the project.
In the example data acquisition involves:
Looking for some referral pics that the client might want to refer or the makeup artist
would look for the previously done makeup looks similar to the needs of the client .

Data exploration :

Organizing the data is called data exploration.


In the above example data exploration involves:
1. Finalizing the foundation , primer , colour corrector , concealer
which would suit her dry and sensitive skin .

2. Making a list of blushes , lip tints , highlighters , eyeliners ,


eyeshadows , lipsticks which would give her a glittery and simplistic
look .
3. Checking wether the products are available or not . Also checking for
the final listing of the final look .

Modelling :
It involves making the model.
Doing makeup on the clients face is included in modelling

Evaluation
Testing the model is called evaluation.
If the client is satisfied the makeup look

Types of Machine learning


There are 3 types of machine learning based on characteristics of data and how the
algorithms learn from data.. These are:

Supervised Learning
In a supervised learning model, the dataset which is fed to the machine is labelled or
the dataset is known to the person who is training the machine.

There are two types of Supervised Learning models:


Classification: The output is a unique label. The model learns to classify input data into
one system of predefined categories. Example: Identifying if an email is spam or not
spam.
Regression: Such models work on continuous data. For example, if you wish to predict
your next salary, then you would put in the data of your previous salary, any
increments, etc., and would train the model.

Classification Regression

Unsupervised learning:
An unsupervised learning model works on an unlabelled dataset. This means that the
data which is fed to the machine is random.The unsupervised learning models are
used to identify relationships, patterns and trends out of the data which is fed into it.
For example: From random data of 1000 dog images and you wish to understand
some pattern out of it, you would feed this data into the unsupervised learning model
and would train the machine
on it.
Clustering: Refers to the unsupervised learning algorithm which can cluster the
unknown data according to the patterns or trends identified out of it.

Reinforcement learning: These models learn from experiences and feedback.

Teachable Machine
It is developed by google that allows individuals to create machine learning models
without coding experience. It is mainly used for supervised learning. Users can train
their model using their own labelled dataset.

Rock, Paper, Scissors


This is a paper scissors rock game created using artificial intelligence. This game can
read the players' patterns to determine the next steps for 'AI'.

Visualizing Data using Matplotlib


You can install it by following the command in your command prompt: pip install
matplotlib
Importing: In your Jupyter notebook, import the Matplotlib library by adding the
following line at the beginning of your code:
import matplotlib.pyplot as plt

Creating a Line Plot


A line plot displays data points connected by straight line segments. Here are the steps
involved in plotting a line graph using Matplotlib:
1. Import Matplotlib: Import the matplotlib.pyplot module.

2. Prepare Data: Define the data points for the x-axis and y-axis.

3. Create Plot: Use plt.plot() to create the line graph.

4. Customize Plot: Add customization like line style, markers, colors, etc.
5. Add Titles and Labels: Include a title for the graph and labels for x and y

axes.

6. Add Legend: If necessary, add a legend to the graph.

Creating a Bar Chart


Bar chart is commonly used to represent categorical data. It helps to compare the
value of different categories. Example code:
import matplotlib.pyplot as plt
categories = ['Category A', 'Category B', 'Category C']
values = [15, 24, 30]
plt.bar(categories, values, color='skyblue')
plt.xlabel('Categories')
plt.ylabel('Values')
plt.title('Basic Vertical Bar Graph')
plt.show()
Box Plots
It is a graphical representation of the distribution of a dataset. It displays summary
statistics such as median and potential outliers. Uses of box plot are:
● Visualising the Distribution
● Identifying Outliers
● Comparing Groups
Use plt.boxplot() function to create box and whisker plots. Example code:
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(10)
data = np.random.normal(100, 20, 200)
fig = plt.figure(figsize =(10, 7))
Creating plot
plt.boxplot(data)
plt.show()

Output:
Scatter plot
It is used to visualize the relationship between 2 numerical variables. It displays data
points as individual dots on a 2D graph, with one variable represented on the x axis
and the other on y axis.
We use the plt.scatter() function to create a scatter plot.
Example code

import matplotlib.pyplot as plt

x =[5, 7, 8, 7, 2, 17, 2, 9, 4, 11, 12, 9, 6]

y =[99, 86, 87, 88, 100, 86, 103, 87, 94, 78, 77, 85, 86]

plt.scatter(x, y, c ="blue"

plt.show()

Outcome:
Computer Vision Tasks
The various applications of Computer Vision are based on a certain number of tasks
which are performed to get certain information from the input image which can be
directly used for prediction. Tasks can be categorized on the basis of number of
objects as single object tasks and multiple object tasks.

Single object tasks


Classification: It is the task of assigning an input image one label from a fixed set of
categories.
Classification + Localisation: This is the task which involves both processes of
identifying what object is present in the image and at the same time identifying at what
location that object is present in that image.
For Multiple Objects
Object Detection: Object detection is the process of finding instances of real-world
objects such as faces, bicycles, and buildings in images or videos. Object detection
algorithms typically use extracted features and learning algorithms to recognize
instances of an object category.
Instance Segmentation: Instance Segmentation is the process of detecting instances
of the objects, giving them a category and then giving each pixel a label on the basis of
that.

Pixels
When a camera captures an image, it becomes a digital file made up of tiny dots
called pixels. All digitally generated images consist of pixels. It is the smallest unit of
information in a digital image.
Pixel art project

PiskelApp is an easy to use platform that allows you to unleash your creativity and
make cool pixel art designs.
Applications of NLP( Natural Language Processing)
Since Artificial Intelligence nowadays is becoming an integral part of our lives, its
applications are very commonly used by the majority of people in their daily lives. Here
are some of the applications of Natural Language Processing which are used in the
real-life scenario:

Automatic Summarization: Information overload is a real problem when we need to


access a specific, important piece of information from a huge knowledge base.
Automatic summarization is especially relevant when used to provide an overview of a
news item or blog post.

Sentiment Analysis: The goal of sentiment analysis is to identify sentiment among


several posts or even in the same post where emotion is not always explicitly
expressed.

Text classification: Text classification makes it possible to assign predefined categories


to a document and organize it to help you find the information you need or simplify
some activities. For example, an application of text categorization is spam filtering in
email.
Virtual Assistants: Nowadays Google Assistant, Cortana,Siri, Alexa, etc have become
an integral part of our lives. Not only can we talk to them but they also have the ability
to make our lives easier. By accessing our data, they can help us in keeping notes of
our tasks, make calls for us, send messages and a lot more. With the help of speech
recognition, these assistants can not only detect our speech but can also make sense
out of it. According to recent research, a lot more advancements are expected in this
field in the near future.

Evaluation
In machine learning, there are different evaluation techniques to assess the
performance of models. This helps understand how well a model is likely to perform on
new data. Idf a model is not properly evaluated during raining process, it may lead to 2
problems:

Underfitting : When a mode is underfitting, it is too simplistic to capture the


underlying patterns in the data. It performs poorly on both training data and the
validation of test data.

Overfitting : Overfitting occurs when the model becomes too complex and adopts
closely to the training data. The model essentially memorizes the training examples
but it struggles to generalize new data.
Perfect Fit : A perfect fit occurs when the model performs exceptionally well on both
the training and testing data. It means the model has learned the underlying patterns
accurately and generalizes well to new.

You might also like