Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Assignment 10 Homework 10: Naïve Bayesian Naïve Bayesian custom density Linear and Discriminant Classifier Implement a linear and quadratic discriminant classifier

Assignment 10 Homework 10: Naïve Bayesian Naïve Bayesian custom density Linear and Discriminant Classifier Implement a linear and quadratic discriminant classifier

Computer Science

Assignment 10

Homework 10:

  1. Naïve Bayesian
  2. Naïve Bayesian custom density
  3. Linear and Discriminant Classifier

Implement a linear and quadratic discriminant classifier. As before, for each classifier use year 1 labels as training set and predict year 2 labels. For each week, your feature set is (μ, σ) for that week. Use your labels (you will have 52 weekly labels per year) from year 1 to train your classifier and predict labels for year 2.

Questions:

  1. what is the equation for linear and quadratic classifier found from year 1 data?
  2. what is the accuracy for year 2 for each classifier. Which classifier is ”better”?
  3. compute the confusion matrix for year 2 for each classifier
  4. what is true positive rate (sensitivity or recall) and true negative rate (specificity) for year 2?
  5. implement trading strategyies based on your labels for year 2 (for both linear and quadratic) and compare the performance with the ”buy-and-hold” strategy. Which strategy results in a larger amount at the end of the year?

In principle, any density can be used to implement Naive bayesian classifier. The default for continuous variables is to use nor- mal distribution. In this assignment, we consider implementing Naive Bayesian using Student-t distribution:

https://en.wikipedia.org/wiki/Student%27s t-dis tribution

Student-t distribution is charcterized by 3 parameters:

1. degrees of freedom - dfrac

2. location parameter μ
3. scale parameter s2 (similar to variance in normal)

We can estimate these parameters in Python as follows:

from scipy import stats
# assume data is in array x
df, location , scale = stats.t.fir(x)

To compute the density function for some value z we would use:

value = stats.t.pdf(z, location , scale)

When degrees of freedom is large, Student-t distribution ap- proaches normal. When df ?→ 0, we get a distribution sim- ilar to normal but with fatter tails. In this assignment, we will investigate whether we can improve our accuracy if we use Student-t distribution and consider fatter tails.

You task is to implement a Naive Bayesian classifier with Student- t with df = 0.5, 1, 5). For each week, your feature set is (μ, σ) for that week. Use your labels (you will have 52 labels per year for each week) from year 1 to train your classifier and predict labels for year 2. Use Student-t for the prediction.

Questions:

  1. implement a Student-t Naive Bayesian classifier (df = 0.5, 1, 5) and compute its accuracy for year 2
  2. compute the confusion matrices for year 2
  3. what is true positive rate and true negative rate for year 2
  4. what is the best value of df? Is it better than normal Naive bayesian
  5. for the best value of df, implement a trading strategy based on your labels for year 2 and compare the performance with the ”buy-and-hold” strategy. Which strategy results in a larger amount at the end of the year?

Implement a Naive Bayesian classifier. For each week, your feature set is (μ,σ) for that week. Use your labels (you will have 52 labels per year for each week) from year 1 to train your classifier and predict labels for year 2. Use Gaussian Naive Bayesian (this is the default).

Questions:

  1. implement a Gaussian naive bayesian classifier and compute its accuracy for year 2
  2. compute the confusion matrix for year 2
  3. what is true positive rate and true negative rate for year 2
  4. implement a trading strategy based on your labels for year 2 and compare the performance with the ”buy-and-hold” strategy. Which strategy results in a larger amount at the end of the year?

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE