Ejemplo n.º 1
0
		for files in os.listdir(basepath):
			if finished == True:
				break
			path = os.path.join(basepath, files)
			if os.path.isdir(path):
				for logFile in os.listdir(path):
					if limit == 0:
						finished = True
						break

					with open(os.path.join(path,logFile), 'r') as h:					
						lines = h.readlines()
						for line in lines:
							if line:
								feature = [features.durationLessThanMinute(line)]
								feature.extend([features.durationOneToFive(line)])
								feature.extend([features.durationFiveOrMore(line)])
								feature.extend([features.device(line)])
								feature.extend(features.ipFeature(line))
								feature.extend(features.timeStartFeature(line))
								feature.extend(features.timeEndFeature(line))

								arrayOfFeatures.append(feature)

					
					limit -= 1
					print "limit: ", limit

	nparray = np.array(arrayOfFeatures)
	print nparray.shape
	row, col = nparray.shape
Ejemplo n.º 2
0
 def feature2(self):
     if features.durationOneToFive(self.line):
         return 1
     else:
         return 0