AmeyaYaminiLinearRegressionDoc (1)
AmeyaYaminiLinearRegressionDoc (1)
Part 1:
Dataset used:
https://archive.ics.uci.edu/ml/datasets/
Metro+Interstate+Traffic+Volume
Fig1
df['holiday'] = df['holiday'].map({
'None': 0,
'Columbus Day': 1,
'Veterans Day': 2,
'Thanksgiving Day': 3,
'Christmas Day': 4,
'New Years Day': 5,
'Washingtons Birthday': 6,
'Memorial Day': 7,
'Independence Day': 8,
'State Fair': 9,
'Labor Day': 10,
'Martin Luther King Jr Day': 11
})
Observations:
How we got below observations:
- We ran our code with epoch range from 1000 to 1
reducing epoch by 20% every time.
- For each epoch we changed the learning rate
from 0.001 to 0.010 with a step of 0.001.
- We got total number of 270 observations
- On that we applied sorting to get a range of MSE
on training data in which 0.193553234889187 is
minimum MSE of training data.
- We considered 0.05 as a tolerating range to get a
minimum epoch and maximum learning rate.
- The table below shows MSE values in range (0.19
to 0.25)
- We feel that highlighted rows can be the best
values of epoch and learning rates.
Recording were taking with same starting weights
Fig 4
Fig 5
How Satisfied?
- We are satisfied with our values. We trained our
model with different epochs and learning rates
and recorded observations. From these
observations we checked for minimum MSE on
training data and picked best values for epoch
and learning rate.
- Fig 3 shows output for 100 epochs with learning
rate of 0.008. From the graph it is clear that the
model is converging somewhere near iteration
number 20-25. Rest of the iterations are not
required. Fig 4 is a zoomed version of fig 3
- To find this convergence point we added a
condition to keep difference in error more than
0.001. Training will stop if the difference in error
is less than 0.001. Fig 5 shows that training
stopped at convergence point.
Part 2:
- We used the SGD linear regression package.
- We applied same logic as part 1 to get the
observations.
Index Epochs Learning Rate MSE Training Data MSE Testing data