

code:
from __future__ import with_statement
#COUNT FOR HEALTHY PATIENTS
goodCnt=0;
att1=0
att2=0
att3=0
att4=0
att5=0
att6=0
#COUNT FOR ILL PATIENTS
badCount=0;
attA=0
attB=0
attC=0
attD=0
attE=0
attF=0
attG=0
#READING TRAINING DATA SET
filen=raw_input("enter the name of the training set file:")
with open(filen,'rb') as f:
for temp in f:
st=temp.split(",")
#HEALTHY PATIENTS
if float(st[6])==0:
att1+=(float(st[0]))
att2+=(float(st[1]))
att3+=(float(st[2]))
att4+=(float(st[3]))
att5+=(float(st[4]))
att6+=(float(st[5]))
goodCnt+=1
#ILL PATIENTS
else:
attA+=(float(st[0]))
attB+=(float(st[1]))
attC+=(float(st[2]))
attD+=(float(st[3]))
attE+=(float(st[4]))
attF+=(float(st[5]))
badCount+=1
#HEALTHY PATIENTS AVERAGE
Hatt1=att1/goodCnt
Hatt2=att2/goodCnt
Hatt3=att3/goodCnt
Hatt4=att4/goodCnt
Hatt5=att5/goodCnt
Hatt6=att6/goodCnt
#ILL PATIENTS AVERAGE
HattA=attA/badCount
HattB=attB/badCount
HattC=attC/badCount
HattD=attD/badCount
HattE=attE/badCount
HattF=attF/badCount
#PRINT HEALTHY AND ILL PATIENTS AVERAGE
print "healthy patients' averages:"
print Hatt1,Hatt2,Hatt3,Hatt4,Hatt5,Hatt6
print "Ill patients' averages:"
print HattA,HattB,HattC,HattD,HattE,HattF
#FIND SEPARATOR VALUES
satt1=(Hatt1+HattA)/2
satt2=(Hatt2+HattB)/2
satt3=(Hatt3+HattC)/2
satt4=(Hatt4+HattD)/2
satt5=(Hatt5+HattE)/2
satt6=(Hatt6+HattF)/2
#DISPLAY SEPARATOR VALUES
print "Separator values:"
print satt1,satt2,satt3,satt4,satt5,satt6
#FINDING ACCURACY
ng=0;
nt=0
with open(filen,'rb') as f:
for temp in f:
st=temp.split(",")
if float(st[6])==0:
ng+=1
nt=nt+1
else:
nt+=1
Accuracy=(ng/goodCnt)
print "Accuracy:"
print Accuracy
#DIAGNOSING TEST DATA SET
infilename=raw_input("enter the name of the test set file:")
outfile=raw_input("Enter the name of the output file:")
ot=open(outfile,'wb')
with open(infilename,'rb') as f:
for temp in f:
st=temp.split(",")
att1=(int(st[0]))
att2=(float(st[1]))
att3=(float(st[2]))
att4=(float(st[3]))
att5=(float(st[4]))
att6=(float(st[5]))
att7=(float(st[6]))
if((att2>satt1) or (att3>satt2) or (att4>satt3) or
(att5>satt4) or (att6>satt5) or (att7>satt6)):
st=str(att1)+",Ill"
else:
st=str(att1)+",Healthy"
ot.write(st) #WRITING TO FILE
ot.write(" ")
ot.close()#CLOSE OUTPUT FILE
print "Done"
Note: Due to time constraint i am not able to prepare the flowchart
Problem statement For this program, you are to implement a simple machine-learning algorithm that uses a...
Write a program that will take input from a file of numbers of type double and output the average of the numbers in the file to the screen. Output the file name and average. Allow the user to process multiple files in one run. Part A use an array to hold the values read from the file modify your average function so that it receives an array as input parameter, averages values in an array and returns the average Part...
in C++ language Create an object-oriented program that uses a sorting algorithm to implement the following functionality: The program prompts you to enter a series of numbers (up to a maximum of 24, so you can use a static array) with -1 as an “end” code. When the program encounters a -1, it does not insert the -1, instead, it outputs a list of half the original size, consisting of the averages of the highest and lowest pairs of numbers...
In this lab you will implement tickets-for-seat-management system. The basic idea is that your program reads an event number and seat number request from a user, and determines if the seat is available (and marks it taken if it was), or is unavailable (so asking the user to choose again). As part of that exercise, you’ll be working with a file of “canned” requests to exercise your program. That is, instead of typing the requests in to your program, the...
Any little bit of information will be helpful. Thank
you.
Problem Statement You are to develop a program to read MotoGP rider information from an input file. You will need a MotoGpRider class whose instances will be used to store the statistics for a MotoGP motorcycle racer. The Rider class will have attributes for last name, first name, racing number, nation, motorcycle make, world championship points, world championship position, and an array that stores the number of top finishes (number...
In this assignment, you will write a program in C++ which uses files and nested loops to create a file from the quiz grades entered by the user, then reads the grades from the file and calculates each student’s average grade and the average quiz grade for the class. Each student takes 6 quizzes (unknown number of students). Use a nested loop to write each student’s quiz grades to a file. Then read the data from the file in order...
Problem: You will write a program to compute some statistics based on monthly average temperatures for a given month in each of the years 1901 to 2016. The data for the average August temperatures in the US has been downloaded from the Climate Change Knowledge Portal, and placed in a file named “tempAugData.txt”, available on the class website. The file contains a sequence of 116 values. The temperatures are in order, so that the first one is for 1901, the...
PLEASE DO THIS IN C#.Design and implement a program (name it ProcessGrades) that reads from the user four integer values between 0 and 100, representing grades. The program then, on separate lines, prints out the entered grades followed by the highest grade, lowest grade, and averages of all four grades. Format the outputs following the sample runs below. Sample run 1: You entered: 95, 80, 100, 70 Highest grade: 100 Lowest grade: 70 Average grade: 86.25
C++ OPEN AND COPY FILES Your task is to create a simple C++ program that prompts the user for two file names, opens both files, reads the data from one file and copies that data to the other file. After this is done, the files are both closed and the program ends. 1. Your program, opencopy.cpp, needs to use both an ifstream object and an ofstream object. 2. You only need to use #include for these but make sure that...
Python Programming Topics: list, file input/output You will write a program that allows the user to read grade data from a text file, view computed statistical values based on the data, and to save the computed statistics to a text file. You will use a list to store the data read in, and for computing the statistics. You must use functions. The data: The user has the option to load a data file. The data consists of integer values representing...
HELP NEEDED in C++ (preferred) or any other language Write a simple program where you create an array of single byte characters. Make the array 100 bytes long. In C this would be an array of char. Use pointers and casting to put INTEGER (4 byte) and CHARACTER (1 byte) data into the array and pull it out. Make sure you can access both character and integer data at any location in the array. Read data from a text file....