Why Choose Us?
0% AI Guarantee
Human-written only.
24/7 Support
Anytime, anywhere.
Plagiarism Free
100% Original.
Expert Tutors
Masters & PhDs.
100% Confidential
Your privacy matters.
On-Time Delivery
Never miss a deadline.
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. 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:
- what is the equation for linear and quadratic classifier found from year 1 data?
- what is the accuracy for year 2 for each classifier. Which classifier is ”better”?
- compute the confusion matrix for year 2 for each classifier
- what is true positive rate (sensitivity or recall) and true negative rate (specificity) for year 2?
- 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:
- implement a Student-t Naive Bayesian classifier (df = 0.5, 1, 5) and compute its accuracy for year 2
- compute the confusion matrices for year 2
- what is true positive rate and true negative rate for year 2
- what is the best value of df? Is it better than normal Naive bayesian
- 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:
- implement a Gaussian naive bayesian classifier and compute its accuracy for year 2
- compute the confusion matrix for year 2
- what is true positive rate and true negative rate for year 2
- 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?
Expert Solution
Please download the answer file using this link
https://drive.google.com/file/d/1wiO6Nj4UVUzb8BuoA1YfR1vUoDF0hNMV/view?usp=sharing
Archived Solution
You have full access to this solution. To save a copy with all formatting and attachments, use the button below.
For ready-to-submit work, please order a fresh solution below.





