BaşlayınÜcretsiz Başlayın

A more sophisticated location model

The locations dataset records Brett's location every hour for 13 weeks. Each hour, the tracking information includes the daytype (weekend or weekday) as well as the hourtype (morning, afternoon, evening, or night).

Using this data, build a more sophisticated model to see how Brett's predicted location not only varies by the day of week but also by the time of day. The dataset locations is already loaded in your workspace.

You can specify additional independent variables in your formula using the + sign (e.g. y ~ x + b).

The naivebayes package has been pre-loaded.

Bu egzersiz

Supervised Learning in R: Classification

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Use the R formula interface to build a model where location depends on both daytype and hourtype. Recall that the function naive_bayes() takes 2 arguments: formula and data.
  • Predict Brett's location on a weekday afternoon using the data frame weekday_afternoon and the predict() function.
  • Do the same for a weekday_evening.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Build a NB model of location
locmodel <- ___

# Predict Brett's location on a weekday afternoon
___

# Predict Brett's location on a weekday evening
___
Kodu Düzenle ve Çalıştır