Beispiel #1
0
def readDataSetFile(filename, F):
	with open(filename) as f:
		E = DataSet()
		for line in f:
			line =line.split()
			if len(line) != len(F):
				print("Number of attributes in the Training record:"+str(line)+"does not match the number in the attribute file")
				raise Exception('DataValidation')
			d  = Data()
			idx= 0
			for value in ine:
				if value in F[idx].values:
					d.addValue(F[idx].name,value)
				else:
					print('Value='+value+' is not a valid value for attribute='+ F[idx].name)
				idx += 1
			E.addData(d)
		f.close()