0% found this document useful (0 votes)
13 views30 pages

AI Practical File for 12th Science

The document is an AI practical file submitted by Akshat Jain for the academic session 2025-26 at Delhi Public School, Firozabad. It includes acknowledgments, a certificate of completion, and an index of various practical tasks related to data analysis and visualization using Python and the Orange Data Mining Tool. The tasks cover creating data frames, performing classification, image analytics, and building a chatbot using the Google Gemini API.

Uploaded by

itsakshat0712
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)
13 views30 pages

AI Practical File for 12th Science

The document is an AI practical file submitted by Akshat Jain for the academic session 2025-26 at Delhi Public School, Firozabad. It includes acknowledgments, a certificate of completion, and an index of various practical tasks related to data analysis and visualization using Python and the Orange Data Mining Tool. The tasks cover creating data frames, performing classification, image analytics, and building a chatbot using the Google Gemini API.

Uploaded by

itsakshat0712
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

DELHI PUBLIC SCHOOL

FIROZABAD

SESSION - 2025-26

AI PRACTICAL FILE

Submitted to :- Submitted by:-


Mr. Harendra Singh Akshat Jain

12th Science
ACKNOWLEDGMENT

I want to express my gratitude to my teacher,


Mr. Harendra Singh for their encouragement,
insightful suggestions and mentorship. I would also
like to extend my thanks to my principal, Dr. Gaurav
Dubey for granting me this wonderful opportunity to
be part of this project.

Also, I would like to express my appreciation to all


those who have supported and contributed to the
completion of this project. Your assistance, guidance
and encouragement have been invaluable. Thank
you for being a part of this project.
CERTIFICATE

This is to certify that Akshat Jain of class 12th science


has successfully completed his project file as
prescribed by Mr. Harendra Singh during the academic
year 2025-26 as per the guidelines given by
AI DEPARTMENT.

Internal Examiner External Examiner


INDEX
1). Write Python code to create a pandas Data Frame using any
sequence data type.
(a) Display the Data Frame
(b) Display the first 5 records
(c) Display the last 10 records.

(d) Display the number of missing Values in the dataset.


2). Download dataset in the form of CSV from any public open
source website.
(a) Read CSV File and convert it into Pandas Data Frame.
(b) Perform statistical functions on the dataset to check the
data, checking missing values, filling missing data etc
(c) Read CSV and convert to Data Fram
3). Perform step wise procedure of Data Visualization using the
Orange Data Mining Tool.
4). Perform Classification with Orange Data Mining.

5). Evaluate the Classification Model with Orange.


6). Perform Image analytics using the orange data mining tool.

7). Write down steps to visualize word frequencies with world


cloud using the orange Data Mining Tool.
8). WAP Chatbot using Google Gemini API.
9). Orange Data Mining for Data Analytics.

10). Regression problem using Tensor Flow Playground.


Q1- Write Python code to create a pandas Data Frame
using any sequence data type.
(a) Display the Data Frame
(b) Display the first 5 records
(c) Display the last 10 records.
(d) Display the number of missing Values in the dataset.
Ans- A Python code to create a pandas Data Frame using
Display the Data Frame

Output :-
Q2- Download dataset in the form of CSV from any public
open source website.
(a) Read CSV File and convert it into Pandas Data Frame.
(b) Perform statistical functions on the dataset to check
the data, checking missing values, filling missing data
etc
(c) Read CSV and convert to Data
Fram Ans-
(a) Read CSV File and convert it into Pandas Data Frame.

(b) Perform statistical functions on the dataset to check


the data, checking missing values, filling missing data etc
(c) Read CSV and convert to Data Fram
Q3- Perform step wise procedure of Data Visualization using
the Orange Data Mining Tool.

Ans-
Step 1: Install Orange
 Download and install the Orange software from the official website.
 Follow the installation instructions for your operating system.

Step 2: Load Data


 Drag and drop the File widget onto the canvas.
 Double-click the File widget to open its settings.
 Select your dataset (e.g., a CSV file) from your local storage or an
online source.

Step 3: Select Visualization Widget


 From the left pane, choose a visualization widget such as Scatter Plot,
Box Plot, or Data Table.
 Drag the selected widget onto the canvas
Step 4: Connect Widgets
 Connect the File widget to the visualization widget by clicking and
dragging a line between them. This establishes a data flow from the file
to the visualization.

Step 5: Configure Visualization


 Double-click the visualization widget to open its configuration settings.
 Select the variables you want to visualize (e.g., choose which columns
to use for the X and Y axes in a scatter plot).

Step 6: View Results


 Click the "Run" button (often represented by a play icon) to generate
the visualization.
 Interact with the plot to explore data points, zoom in/out, or select
specific data ranges.
Q4- Perform Classification with Orange Data Mining.
Ans- Classification in Orange – Step-by-Step with Snapshots

 Step 1: Open Orange and Create New Workflow


 Launch Orange.
 Click "New" to start a fresh workflow.

 Step 2: Load Dataset


 Drag and drop the File widget (from “Data” tab) onto the canvas.
 Select a dataset (e.g., [Link] or your own CSV).

 Step 3: Explore the Data (Optional)


 Add Data Table and connect it to File to inspect raw data.

 Step 4: Preprocess the Data (Optional)


 Use the Select Columns, Edit Domain, or Preprocess widgets
if needed.
 Ensure the target variable (class) is correctly selected.
 Step 5: Split Data into Train and Test Sets
 Drag Data Sampler or Train/Test Split widget.
 Connect it to File or Preprocess.
 Set split ratio (e.g., 70% training, 30% testing).

 Step 6: Choose Classification Algorithm


 Use one or more of the following classifier widgets:
o Logistic Regression
o Naive Bayes
o Random Forest
o kNN (k-Nearest Neighbors)
o SVM (Support Vector Machine)
 Step 7: Train the Model
 Connect classifier to the Train Data output from the Train/Test Split.

 Step 8: Evaluate the Model


 Add the Test & Score widget.
 Connect classifier(s) and Test Data to it.
 View metrics like Accuracy, Precision, Recall, F1 Score, ROC AUC.
 Step 9: Visualize Predictions
 Add Confusion Matrix, ROC Analysis, or Classification Tree
widgets.
 Connect them to the classifier or Test & Score.

 Step 10: Save Workflow


 Save your workflow using File → Save As, choose .ows extension
Q5- Evaluate the Classification Model with Orange.

Ans-
Step 1: Load Dataset
Widget Used: File

 Drag the File widget onto the canvas.


 Load a dataset (e.g., [Link] or any .csv file).

Step 2: Data Preprocessing (optional)


Widgets Used: Select Columns, Impute, etc.

 Use Select Columns to choose features and target variable.


 Use Impute if there are missing values.

Step 3: Apply Classification Model


Widgets Used: Logistic Regression, Random Forest, Naive
Bayes, etc.

 Connect your dataset to the classification algorithm widget.


 Choose your algorithm and adjust its parameters.
Step 4: Evaluate Model using Test & Score
Widget Used: Test & Score

 Drag the Test & Score widget.


 Connect it to both your data and your classifier.
 Orange will apply methods like:
o Cross-validation (default)
o Test on train data
o Test on separate test

data What It Shows:


 Classification Accuracy
 AUC
 Precision / Recall / F1 Score.

Step 5: Visualize Evaluation


You can visualize evaluation results with the following:
1. Confusion Matrix

Widget: Confusion Matrix

 Connect it to the Test & Score widget.


 Choose the model to analyze.
 Helps you see how well classes are predicted.

2. ROC Analysis

Widget: ROC Analysis

 Visualizes True Positive Rate vs False Positive Rate.


 Helps compare classifiers.

3. Lift Curve (optional)

 Used in business/marketing model evaluation.


Q6- Perform Image analytics using the orange data mining
tool.

Ans- 1. Import Images


You use the Import Images widget to load images from folders—each subfolder
becomes a class label.
The Data Table then includes metadata (name, path, size) and an auto-created
class attribute

2. Image Embedding
The Image Embedding widget converts images into numerical vectors using
pretrained models like SqueezeNet, Inception v3, VGG-16, or specialized
embedders Snapshot shows vectorized features added as new columns.

3. Visualize with Image Grid


Connect embeddings to the Image Grid widget to perform t-SNE dimensionality
reduction. Here, visually distinct clusters (city, food, mountains, sunsets) emerge.

4. Train & Evaluate Classifier


Add Test & Score and classifiers (e.g., Logistic Regression) to assess
performance.
In one example, the model achieved AUC = 0.992 and accuracy = 0.943
using cross-validation

5. Label & Save Predicted Images


Use the Predictions widget to label new images.
Then, Save Images saves sorted files into folder structure by predicted class
labels
Q7- Write down steps to visualize word frequency with
world cloud using the orange Data Mining Tool.
Ans- 1. Load Text Data
1. Install the Text Mining add-on (via Options → Add-ons).
2. Use the Corpus widget to load documents (e.g., .txt, .csv, .tab).
3. Browse and select your dataset.
The widget reads the corpus and forwards it for analysis

2. Preprocess Text
1. Connect Corpus → Preprocess Text.
2. Configure:
o Convert to lowercase
o Tokenize (regexp or words only)
o Remove stopwords.
3. Generate Word Cloud
1. Add Word Cloud and link from Preprocess Text.
2. Tweak display options:
o Random colors
o Word tilt
o Regenerate cloud
o Click terms to inspect related documents
3. It visually sizes words by frequency or average Bag-of-Words/Tf-IDF
values
[Link]+[Link]+11datasciencesmachine
l [Link]+11.

4. Inspect Exact Frequencies


1. Connect Word Cloud → Bar Plot via “Word Counts” output.
2. Switch on Annotations (label bars by word).
3. View the precise counts—spot attention-worthy terms and refine
preprocessing if necessary (e.g., remove frequent but insignificant
words like “said”)
Corpus → Preprocess Text → [Bag of Words] → Word Cloud

Word Counts → Bar Plot
Q8- WAP Chatbot using Google Gemini API.

Ans- Building a chatbot using the Google Gemini API in Python


involves several key steps:
1. Obtain an API Key: You'll need to get a Gemini API key. You
can typically generate this for free in Google AI Studio or
MakerSuite. This key will authenticate your requests to the
Gemini API.

2. Install the Google GenAI SDK: Use pip to install the


necessary Python library:
Bash

3. Configure the API Key: Once you have your API key, you'll
need to configure the SDK with it. It's recommended to store your
API key securely, for example, as an environment variable or
using a secrets manager if you're working in Google Colab.
Python
4. Initialize the Generative Model: Choose the Gemini model
you want to use. gemini-pro is a common choice for text-
based conversations.
Python

5. Start a Chat Session: For conversational chatbots, you'll want to


use the start_chat() method to maintain conversation
history.
Python

6. Send Messages and Get Responses: You can send user


messages using chat.send_message(). The model's
response can be accessed via [Link].
Python

7. Manage Conversation History (Implicitly handled by


start_chat()): The start_chat() function automatically
manages the conversation history, sending previous turns to the
model with each new message to maintain context. You can
also explicitly access the history if needed:
Python

8. Add System Instructions (Optional but Recommended): You


can guide your chatbot's persona or behavior by providing
system instructions. This helps the model understand its role.
Python
Q9- Orange Data Mining for Data Analytics.

Ans- Step 1: Load Dataset


Widget Used: File

1. Drag the File widget onto the canvas.


2. Double-click it and upload a .csv file or select from Orange’s sample
datasets (e.g., Iris, Titanic).

Step 2: View the Data


Widget Used: Data Table

1. Connect File → Data Table.


2. Double-click Data Table to preview your loaded data.

Step 3: Preprocess the Data


Widgets Used:

 Select Columns – choose features and target


 Impute – fill missing values

Continuize – convert categorical to numerical


Step 4: Visualize the Data
Widgets Used:

 Distributions – histogram of features


 Box Plot – feature comparison
 Scatter Plot – relationship between variables
 t-SNE – dimensionality reduction for clustering view

Step 5: Apply Data Modeling (Classification or Regression)


Widgets Used:

 Classifiers: Random Forest, Naive Bayes,


Logistic Regression
 Connect from preprocessing widgets

Step 6: Evaluate the Model


Widgets Used:
 Test & Score
 Confusion Matrix
 ROC Analysis

1. Connect models and data to Test & Score.


2. Check accuracy, precision, recall, F1 score.
3. Use Confusion Matrix to see classification results.

Step 7: View Predictions


Widgets Used:
 Predictions
 Connect to Data Table for detailed result display

Step 8: Save Results


Widget Used: Save Data

1. Connect Predictions to Save Data


2. Export your results as .csv or Excel
Full Workflow Summary

File → Select Columns → Impute → (Scatter Plot, Box


Plot)

Classifier(s) → Test & Score → Confusion Matrix

Predictions → Save Data
Q10- Regression problem using Tensor Flow Playground.
Ans-
Step 1: Open TensorFlow Playground
Navigate to [Link] You’ll see an interactive interface
with controls for data type, network structure, and training parameters.

Step 2: Select Regression Data


 In the DATA panel (left), switch the problem type to Regression.
 Choose a dataset like XOR, Gaussian, or Spiral that
supports continuous-value output.
 The output plot will display gradients instead of class points.
(See image showing regression setup)

Step 3: Choose Features

 Toggle input features relevant to your scenario: x1, x2, and


optionally their squares, products, or sine transformations.
 These features feed directly into the neural network.

Step 4: Build the Neural Network


 Add hidden layers (e.g., two hidden layers with 5–8 neurons each).
 Set activation functions: ReLU or Tanh for hidden layers, and Linear
for the output node (essential for regression).
 Adjust Learning Rate, Regularization, Batch Size, and Noise as needed.

Step 5: Train and Observe


 Press Play to initiate training.
 Watch as training and test loss (MSE) decrease over epochs.
 The output plot will update in real time to reflect the network’s learned
mapping.

Step 6: Analyze Results


 Monitor the loss graph to check for underfitting or overfitting.
 Watch how the predictions gradually align with the underlying
regression function.
Step 7: Experiment and Refine
 Increase/decrease neurons or layers to study effects on performance
and complexity.
 Toggle regularization (L1/L2) if overfitting occurs.

Adjust learning rate—too high can diverge, too low leads to slow learning.
BIBLIOGRAPHY

1) Text book
2) Programiz:- [Link]
3) Getliner:- [Link]
4) YouTube:- [Link]
5) Chat GPT:- [Link]

THANK YOU

You might also like