AI_Practical_File_Expanded
AI_Practical_File_Expanded
---
### **Acknowledgment**
I would like to express my sincere gratitude to my school, Mount Carmel School, and my
teachers for providing me the opportunity to explore the fascinating world of Artificial
Intelligence (AI). This project file is a culmination of all the knowledge and skills I have
gained. Special thanks to my family and peers for their continuous support and motivation.
---
### **Preface**
This practical file has been prepared to showcase my understanding of Artificial Intelligence
concepts and their applications in various domains. The content is structured to include
theoretical explanations, practical examples, and projects, offering a comprehensive
learning experience.
---
### **Index**
1. Smart City (Labelled)
2. Domains of AI Using Gamification:
- Data: Rock-Paper-Scissors
- Computer Vision: Quick Draw
- NLP: Semantris
3. AI Project Life Cycle
- Five Real-Life Problems
4. Mind Maps (2 Examples)
5. Decision Trees (2 Examples)
6. Letter to Future Self (2080)
7. Job Advertisement (Robotics Firm, 2050)
8. Python Programs:
- Lists (5)
- If-Elif-Else (5)
- For Loops (10)
9. AI Projects:
- Chatbot
- Pictoblox Project
- Machine Learning for Kids Project
10. Jupyter Notebooks on Data, Computer Vision, and NLP
---
#### **Explanation:**
A smart city integrates technology to improve the quality of life for its citizens. By using AI,
IoT, and data analytics, smart cities aim to enhance infrastructure, reduce waste, and
optimize energy usage. For example, AI-powered sensors can monitor traffic and
automatically adjust traffic lights to reduce congestion.
---
def get_computer_choice():
return random.choice(['rock', 'paper', 'scissors'])
# Load dataset
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0
# Build model
model = Sequential([
Conv2D(32, (3, 3), activation='relu', input_shape=(28, 28, 1)),
Flatten(),
Dense(128, activation='relu'),
Dense(10, activation='softmax')
])
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
model.fit(x_train, y_train, epochs=5)
```
def semantris_game(prompt):
generator = pipeline('text-generation', model='gpt2')
response = generator(f"{prompt}", max_length=30, num_return_sequences=1)
return response[0]['generated_text']
---
---
9. Jupyter Notebooks on AI
This notebook includes examples of using Pandas and Matplotlib for data analysis and
visualization.
Example:
```python
import pandas as pd
import matplotlib.pyplot as plt
# Load dataset
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.cifar10.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0
# Build model
model = Sequential([
Flatten(input_shape=(32, 32, 3)),
Dense(128, activation='relu'),
Dense(10, activation='softmax')
])
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
model.fit(x_train, y_train, epochs=10)
```