Question
Problem 2) Threshold-based Classifier We have a two-class classification problem (i.e., C1 and C2). Each data sample is represented by two attributes (x,y). The three
Problem 2) Threshold-based Classifier We have a two-class classification problem (i.e., C1 and C2). Each data sample is represented by two attributes (x,y). The three data samples in class C1 2 are {(2, 2), (3, 2), (2, 3)} and {(1, 2), (1, 1), (2, 1)} in class C2. Perform the followings in Python:
a) Plot the data samples. The data points in classes C1 and C2 have to be in two different colors and shapes. Label the axes and add legends as appropriate.
b) The code asks the user to enter two thresholds thx and thy.
c) Your code calculates and prints the training accuracy based on the user-entered thresholds. To do so, assume that for any data point (x,y) with x> thx and y> thy, the data sample belongs to class C1, and C2 if otherwise. Using this rule and the userentered thresholds, the code calculates the classification accuracy for the six data samples. The classification accuracy is defined as the number of correctly classified data points over the total number of data points (6 in here).
d) The code asks the user to enter a new data sample by entering both x and y.
e) Plot the new data sample on the plot in part (a).
f) The code determines and prints the class (C1 or C2) of the new data sample using the user-entered thresholds.
g) The user can enter new data points, and the code repeats parts (d)-(f) unless the user writes x as the input.
h) The code asks the user for new threshold values and starts from part (b)
i) Select the best thresholds that will give the highest accuracy. Run part (c) using these thresholds. What classification accuracy did you achieve? Was it the highest possible accuracy for the given six data samples?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started