0% found this document useful (0 votes)
55 views

AI Lab 10 Lab Tasks

Uploaded by

Sufyan Akram
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)
55 views

AI Lab 10 Lab Tasks

Uploaded by

Sufyan Akram
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/ 5

Lab Session -10

Artificial Intelligence (Comp – 00634)


Lab Session-10

Objective: Understanding the basics of Tensorflow

A- Outcomes:
After completion of the lab session students will be able:
a. To understand basics of neural networks
b. To define the architecture of a neural network and compile it
c. To understand how to train a neural network model for the given data
d. To understand the predictions from a neural network

1
Lab Session -10

B- Lab Tasks:
1- Predicting House Prices:
Suppose you are given a data set containing the sizes of houses (in square feet) in
Bahawalpur and their corresponding prices (in PKR). Your task is to build a simple
sequential model using TensorFlow and Keras to predict house prices based on their
sizes.
a. Import the necessary libraries.
b. Build a sequential model with a single dense layer.
c. Compile the model using an appropriate optimizer and loss function.
d. Assume the following data for house sizes and prices:
house_sizes=np.array([1000,1500,2000,2500,3000,3500,4000], dtype=float)
prices=np.array([20000000,30000000,40000000,50000000,60000000,700000
00,80000000], dtype=float)
e. Train the model using the given data for 1000 epochs.
f. Predict the price of a house that is 2700 square feet in size.
Write/copy your code here:

2- Estimating Car Mileage:


You have a dataset containing the ages of cars (in years) in Islamabad and their
corresponding mileages (in kilometers). Build a model to estimate car mileage based
on age.
a. Import the necessary libraries.
b. Build a sequential model with a single dense layer.
c. Compile the model using an appropriate optimizer and loss function.
d. Assume the following data for car ages and mileages:
car_ages=np.array([1,2,3,45,6], dtype=float)
mileages=np.array([20000, 40000, 60000, 80000, 100000, 120000],
dtype=float)
e. Train the model using the given data for 1000 epochs.
f. Predict the mileage of a car that is 7 years old.

2
Lab Session -10

Write/copy your code here:

3- Predicting Temperature Changes in Karachi:


Given a dataset with the number of days since the beginning of the year and the
corresponding average daily temperatures (in degree Celsius) in Karachi, build a
model to predict temperature changes.
a. Import the necessary libraries.
b. Build a sequential model with a single dense layer.
c. Compile the model using an appropriate optimizer and loss function.
d. Assume the following data for days and temperatures:
days=np.array([1, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 336],
dtype=float)
temps=np.array([20, 22, 26, 30, 33, 35, 33, 32, 31, 29, 26, 22], dtype=float)
e. Train the model using the given data for 1000 epochs.
f. Predict the temperature on the 200th day of the year.
Write/copy your code here:

4- Estimating Tea Sales:


You are given a dataset containing the number of tea shops in Multan and the total
tea sales (in PKR) per month. Build a model to estimate tea sales based on the
number of tea shops.
a. Import the necessary libraries.
b. Build a sequential model with a single dense layer.
c. Compile the model using an appropriate optimizer and loss function.
d. Assume the following data for the number of tea shops and sales:
tea_shops=np.array([10, 20, 30, 40, 50], dtype=float)
sales=np.array([500000, 1000000, 1500000, 2000000, 2500000], dtype=float)
e. Train the model using the given data for 1000 epochs.
3
Lab Session -10

f. Predict the total tea sales in a city with 60 tea shops.


Write/copy your code here:

5- Predicting Stock Prices:


Suppose you have a dataset containing the number of days since a Pakistani
company’s Initial Public Offering (IPO) and the corresponding stock prices (in PKR).
Build a model to predict stock prices based on the number of days since the IPO.
a. Import the necessary libraries.
b. Build a sequential model with a single dense layer.
c. Compile the model using an appropriate optimizer and loss function.
d. Assume the following data for days and stock prices:
days_since_IPO=np.array([1, 30, 60, 90, 120, 150, 180], dtype=float)
stock_prices=np.array([200, 220, 250, 270, 300, 320, 350], dtype=float)
e. Train the model using the given data for 1000 epochs.
f. Predict the stock price on the 210th day since the IPO.
Write/copy your code here:

6- Write a conclusion of this lab in your own words.

Write your answer here by hand:

4
Lab Session-10

You might also like