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

Preparing for unforeseen circumstances

While Brett was tracking his location over 13 weeks, he never went into the office during the weekend. Consequently, the joint probability of P(office and weekend) = 0.

Explore how this impacts the predicted probability that Brett may go to work on the weekend in the future. Additionally, you can see how using the Laplace correction will allow a small chance for these types of unforeseen circumstances.

The model locmodel is available for you to use, along with the data frame weekend_afternoon. The naivebayes package has also 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 locmodel to output predicted probabilities for a weekend afternoon by using the predict() function. Remember to set the type argument.
  • Create a new naive Bayes model with the Laplace smoothing parameter set to 1. You can do this by setting the laplace argument in your call to naive_bayes(). Save this as locmodel2.
  • See how the new predicted probabilities compare by using the predict() function on your new model.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Observe the predicted probabilities for a weekend afternoon


# Build a new model using the Laplace correction
locmodel2 <- ___

# Observe the new predicted probabilities for a weekend afternoon
Kodu Düzenle ve Çalıştır