args = arg_parser.parse_args() res = [] if args.calc: for (dirpath, dirnames, filenames) in os.walk(args.output): for filename in filenames: if filename.endswith("~"): continue fn = os.path.join(dirpath, filename) r = calc_stats(fn) print(r) res.append(r) print("{:20} {:8} {:8} {:4} {:8} {:8}".format("Feature", "Total", "Sampled", "%", "Accuracy", "Err Rate")) for r in res: print("{:20} {:8} {:8} {:4}% {:8} {:8}".format( r['fn'], r['total'], r['sampled'], r['sampled'] * 100.0 / r['total'], r['accuracy'], r['error_rate'])) exit(0) if args.sample: (input, output) = args.sample if os.path.exists(output): raise RuntimeError(output + " exists") os.mkdir(output) report = BulkReport(input) for fn in report.feature_files(): sample(output, fn)
arg_parser.add_argument("--xpattern", type=str, help="Do not sample lines that include this pattern in the forensic path") arg_parser.add_argument("--calc", help="Compute the statistics",action="store_true") arg_parser.add_argument("--trials", type=int, default="5", help="Number of trials to divide into") arg_parser.add_argument("--quiet",action='store_true',help='do not alert on lines with no classification') args = arg_parser.parse_args() res = [] if args.calc: for (dirpath,dirnames,filenames) in os.walk(args.output): for filename in filenames: if filename.endswith("~"): continue fn = os.path.join(dirpath,filename) r = calc_stats(fn) print(r) res.append(r) print("{:20} {:8} {:8} {:4} {:8} {:8}".format("Feature","Total","Sampled","%","Accuracy","Err Rate")) for r in res: print("{:20} {:8} {:8} {:4}% {:8} {:8}".format( r['fn'],r['total'],r['sampled'],r['sampled']*100.0/r['total'],r['accuracy'],r['error_rate'])) exit(0) if args.sample: (input,output) = args.sample if os.path.exists(output): raise RuntimeError(output+" exists") os.mkdir(output) report = BulkReport(input) for fn in report.feature_files(): sample(output,fn)