Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please I'm new at Python and I need help writing this program in Python. All the instructions and files that I was given are being

please I'm new at Python and I need help writing this program in Python. All the instructions and files that I was given are being posted below. Thank you so much in advance, I'll make sure I give you a thumbs up :)
image text in transcribed
This is the iris testing file
image text in transcribed
This is the irisTraining file
image text in transcribed
image text in transcribed
Naive Bayes Classifier Exercise In Python The iris dataset contains 150 instances where each instance has 4 attributes (measurements) and a class label indicating the type of iris plant. The attribute information are as follows: 1) sepal length in cm, 2.) sepal width in cm, 3.) petal length in cm, 4.) petal width in cm. In this exercise, we combined 2 classes into one class so we have a total of 2 classes only. (-1 and 1). The data in irisPCTraining.txt and irisPCTesting.txt is the results of applying data reduction using PCA technique on the original data. Your program should accept the file names of the training data and the testing data. Example: trainingFile = "iris Training.txt" testingFile = "irisTesting.txt" Your program output should consist of the following information: 1. The classification accuracy on each testing dataset. 2. The number of true positives(TPs), false positives(FPs), true negatives (TNs), and false negatives (FNs). 3. The classification Precision and Recall. iris Testing.it - Notepad File Edit Format View Help 6.8 -1.8 4.8 1.4 1 6.1 -1.9 4.7 1.4 1 6.5 -1.2 5.1 -1 -1 6.7 -1.3 5.7 -1.1 - 1 6.7 -1.1 4.4 1.4 1 4.8 -1.4 1.9 0.2 -1 4.9 -1 1.4 0.2 -1 6.9 -1.2 5.7 -1.3 -1 4.5 -1.3 1.3 0.3 -1 4.3 -1 1.1 0.1 -1 5.2 -1.7 -1.9 1.41 5 -1.6 1.4 0.2 -1 6.4 -1.9 4.3 1.31 5.2 -1.5 1.5 0.2 -1 5.8 -1.7 -1.9 1.2 1 5.5 4.2 1.4 0.2 -1 7.6 -1 6.6 -1.1 -1 6.3 -1.8 5.1 1.5 -1 6.4 -1.1 5.5 1.8 -1 6.3 -1.5 4.9 1.5 1 5.8 -1.7 5.1 1.9 -1 5 -1 1.6 0.2 -1 6.7 -1.1 4.7 1.5 1 6 -1.7 5.1 1.6 1 5.1 -1.5 1.4 0.2 - 1 4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3 -1 4.7 -1.2 1.6 2.2 -1 4.4 -1.9 1.4 0.2 - 1 6.2 -1.8 4.8 1.8 -1 4.8 -1 1.4 0.3 -1 6 -1.9.4.5 1.5 1 6.2 -1.4 5.4 -1.3 -1 5 -1.3 -1.3 11 6.4 -1.2 4.5 1.5 1 6.3 -1.9 5.6 1.8 -1 6.7 -1 5 1.71 5-1 -1.5 1 1 5.9 -1.2 4.8 1.8 1 6.7 -1.3 5.7 -1.5 -1 5.4 -1.9 1.7 0.4 -1 6.3 -1.7 4.9 1.8 -1 4.8 -1.4 1.6 0.2 - 1 4.4 -1.2 1.3 0.2 - 1 6.4 -1.2 5.3 -1.3 -1 6.2 1.2 4.5 1.5 1 6 -1.25 1.5 -1 7.4 1.8 6.1 1.9 1 4.9 -1.4 -1.3 11 7 -1.2 4.7 1.4 1 5.5 -1.4 -1.7 11 6.3 -1.3 4.7 1.6 1

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

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions