Skip to content

Latest commit

 

History

History
92 lines (56 loc) · 2.09 KB

homework.md

File metadata and controls

92 lines (56 loc) · 2.09 KB

Homework

The goal of this homework is to train a simple model for predicting the duration of a ride - similar to what we did in this module.

Q1. Downloading the data

We'll use the same NYC taxi dataset, but instead of "Green Taxi Trip Records", we'll use "Yellow Taxi Trip Records".

Download the data for January and February 2023.

Read the data for January. How many columns are there?

  • 16
  • 17
  • 18
  • 19

Q2. Computing duration

Now let's compute the duration variable. It should contain the duration of a ride in minutes.

What's the standard deviation of the trips duration in January?

  • 32.59
  • 42.59
  • 52.59
  • 62.59

Q3. Dropping outliers

Next, we need to check the distribution of the duration variable. There are some outliers. Let's remove them and keep only the records where the duration was between 1 and 60 minutes (inclusive).

What fraction of the records left after you dropped the outliers?

  • 90%
  • 92%
  • 95%
  • 98%

Q4. One-hot encoding

Let's apply one-hot encoding to the pickup and dropoff location IDs. We'll use only these two features for our model.

  • Turn the dataframe into a list of dictionaries (remember to re-cast the ids to strings - otherwise it will label encode them)
  • Fit a dictionary vectorizer
  • Get a feature matrix from it

What's the dimensionality of this matrix (number of columns)?

  • 2
  • 155
  • 345
  • 515
  • 715

Q5. Training a model

Now let's use the feature matrix from the previous step to train a model.

  • Train a plain linear regression model with default parameters, where duration is the response variable
  • Calculate the RMSE of the model on the training data

What's the RMSE on train?

  • 3.64
  • 7.64
  • 11.64
  • 16.64

Q6. Evaluating the model

Now let's apply this model to the validation dataset (February 2023).

What's the RMSE on validation?

  • 3.81
  • 7.81
  • 11.81
  • 16.81

Submit the results