Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Threshold-based Classifier There are two classes of data points, where each point is represented by two features (x,y). Assume that there are data points in

Threshold-based Classifier There are two classes of data points, where each point is represented by two features (x,y). Assume that there are data points in each class: C1={(2, 2), (3, 2), (2, 3)}; C2={(1, 2), (1, 1), (2, 1)} and perform the followings in Python: a) Plot the data points. The data points in class 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 selected thresholds. To do so, assume that for any data point (x,y) with x> thx and y> thy, the data point belongs to C1, and to C2 if otherwise. Using this rule and the user-selected thresholds, the code calculates the training accuracy as the number of correctly classified data points over the total number of data points (6 in here). I've done parts a and b, but am confused on part c... image text in transcribed code:

from keras.models import Sequential from keras.layers import Dense import matplotlib.pyplot as plt import numpy

plt.plot([2,3,2], [2,2,3],'rx' , label='C1') plt.plot([1,1,2], [2,1,1],'b--', label='C2') plt.xlim(0.5,4) plt.ylim(0.5,4) plt.legend()

# 2b)

th_x = input("Please enter 1st threshold: ") th_y = input("Please enter 2nd threshold: ")

from keras.models import Sequential from keras.layers import Dense import matplotlib.pyplot as plt import numpy plt.plot([2,3,2), (2,2,3],'rx' , label='c1') plt.plot([1,1,2], [2,1,1],'b--', label='c2') plt.xlim(0.5,4) plt.ylim(0.5,4) plt.legend() # 2b) th_x = input("Please enter 1st threshold: ") th_y = input("Please enter and threshold: ") Please enter 1st threshold: 7 Please enter and threshold: 8 4.0 0505 10 15 20 25 30 35 40 from keras.models import Sequential from keras.layers import Dense import matplotlib.pyplot as plt import numpy plt.plot([2,3,2), (2,2,3],'rx' , label='c1') plt.plot([1,1,2], [2,1,1],'b--', label='c2') plt.xlim(0.5,4) plt.ylim(0.5,4) plt.legend() # 2b) th_x = input("Please enter 1st threshold: ") th_y = input("Please enter and threshold: ") Please enter 1st threshold: 7 Please enter and threshold: 8 4.0 0505 10 15 20 25 30 35 40

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

Step: 3

blur-text-image

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

Database Systems For Advanced Applications 9th International Conference Dasfaa 2004 Jeju Island Korea March 2004 Proceedings Lncs 2973

Authors: YoonJoon Lee ,Jianzhong Li ,Kyu-Young Whang

2004th Edition

3540210474, 978-3540210474

More Books

Students also viewed these Databases questions

Question

What physical locations do you work in?

Answered: 1 week ago

Question

Find dy/dx if x = te, y = 2t2 +1

Answered: 1 week ago

Question

Analyse the various techniques of training and learning.

Answered: 1 week ago