Data Mining

79 views 12:57 pm 0 Comments February 27, 2023

2/17/23, 3:13 PM Bike Rides and the Poisson Model — Data Mining
https://pantelis.github.io/data-mining/aiml-common/assignments/mle/poisson-regression-1/index.html 1/1
Bike Rides and the Poisson Model
Contents
Maximum Likelihood I
Maximum Likelihood II
To help the urban planners, you are called to model the daily bike rides in NYC using this
dataset
. The dataset contains date, day of the week, high and low temp, precipitation and bike
ride couunts as columns.
Maximum Likelihood I
The obvious choice in distributions is the Poisson distribution which depends only on one
parameter, λ, which is the average number of occurrences per interval. We want to estimate this
parameter using Maximum Likelihood Estimation.
Implement a Gradient Descent algorithm from scratch that will estimate the Poisson distribution
according to the Maximum Likelihood criterion. Plot the estimated mean vs iterations to
showcase convergence towards the true mean.
References:
1.
This blog post.
2.
This blog post and note the negative log likelihood function.
Maximum Likelihood II
A colleague of yours suggest that the parameter must be itself dependent on the weather and
other factors since people bike when its not raining. Assume that you model as

where is one of the example features and is a set of parameters.
xi w

Train the model with SGD with this assumption and compare the MSE of the predictions with the
Maximum Likelihood I approach.
You may want to use
this partial derivative of the log likelihood function
# Code here
λ
λ
λ
i = exp(wTxi)
#
By Pantelis Monogioudis, Ph.D
© Copyright 2023.