Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please implement the first image using simple Python code, not any machine learning aspects. The code has to have conditional statements(if, elif, for loops) for

image text in transcribed

image text in transcribed

Please implement the first image using simple Python code, not any machine learning aspects. The code has to have conditional statements(if, elif, for loops) for calculating the classification accuracy, and has to produce an output similar to the one shown in the second image.

Problem 2) Threshold-based Classifier - We have a two-class classification problem (i.e., Cl and C2). Each data sample is represented by two attributes (x, y). The three data samples in class C1 1 are {(1, 1), (3, 2), (2,3)} and {(1, 2), (2, 2), (2, 1)} in class C2. Perform the followings in Python: a) Plot the data samples. The data points in classes C1 and C2 must 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 classification 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 user- entered 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) Use a for loop to repeat part c for a total of three times and enter different sets of thresholds each time. e) Based on your observation from the results above, report a suitable set of thresholds that will give the highest possible accuracy. Report your suggested thresholds and the corresponding classification accuracy. 5 Class 1 Class 2 3 y feature 2 2 1 -1 0 1 3 5 2 x: feature 1 Enter the threshold values, TH_X and TH_y Enter the TH_x value: 0 Enter the Th_y value: 0 The classifier accuracy for the selected thresholds is: 0.50 Enter the threshold values, TH_x and TH_y Enter the TH_x value: 5 Enter the Thy value: 5 The classifier accuracy for the selected thresholds is: 8.50 Enter the threshold values, TH_x and TH_y Enter the TH_x value: -5 Enter the Th_y value: -5 The classifier accuracy for the selected thresholds is: 0.50

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago