| 123456789101112131415161718192021222324252627 |
- import sys
- import Vector
- import sample
- # test classifications on a pickled file of samples and denoting active features with
- # sample codes, ex: high.total_packets
- # Usage: main.py pickled_sample_file high.total_packets high.time_spent...
- def main():
- i = 0
- sampleList = Vector.readPickledData(sys.argv[1])
- featureList = []
- for s in sampleList:
- featureList.append(Vector.SampleToFeatureVector(s))
- activeFeatureStrings = []
- for i in range(2, len(sys.argv)):
- activeFeatureStrings.append(sys.argv[i])
- for f in featureList:
- temp = []
- for s in activeFeatureStrings:
- temp.append(f.sampleInfo[s])
- f.activefeatures = temp
- # perform classification on f here
- if __name__ == '__main__':
- main()
|