Ejemplo n.º 1
0
	def parse(self):
		# Data Processing
		for row in self.spamreader:
			temp=[]
			for i in range(0,len(row)):
				if(self.pFeatures[i]==1):
					temp+=[int(float(self.mapDefine((self.pHeader[i]),row[i])))]
			self.pData+=[temp]
		HF=dataRecovery.holesFiller('LinearRegression');
		HF.feedData(self.featureFilter(self.pFeatures,self.pHeader),self.pData,'age');
		Y=HF.fillData();		
		return Y;	
Ejemplo n.º 2
0
    def dump(self):
        HF = dataRecovery.holesFiller("LinearRegression")
        HF.feedData(self.featureFilter(self.fMapTrain, self.TrainHeader), self.data, "age")
        Y = HF.fillData()

        with open("DATA/pnewtrain_v2.csv", "wb") as csvfile:
            csvwriter = csv.writer(csvfile, delimiter=",", quotechar='"')
            self.fMapTrain[self.mainF] = 1
            pHeader = self.featureFilter(self.fMapTrain, self.TrainHeader)
            print(pHeader)
            csvwriter.writerow(pHeader)
            for i in range(0, self.TrainCount):
                csvwriter.writerow([self.TrainXtra[i]] + Y[i])

        with open("DATA/pnewtest_v2.csv", "wb") as csvfile:
            csvwriter = csv.writer(csvfile, delimiter=",", quotechar='"')
            pHeader = self.featureFilter(self.fMapTest, self.TestHeader)
            print(pHeader)
            csvwriter.writerows([pHeader] + Y[self.TrainCount : self.TestCount + self.TrainCount])