コード例 #1
0
ファイル: run.py プロジェクト: simjega/NAB
def main(args):

  root = os.path.dirname(os.path.realpath(__file__))

  numCPUs = int(args.numCPUs) if args.numCPUs is not None else None

  dataDir = os.path.join(root, args.dataDir)
  labelFile = os.path.join(root, args.labelFile)
  resultsDir = os.path.join(root, args.resultsDir)
  profilesFile = os.path.join(root, args.profilesFile)
  thresholdsFile = os.path.join(root, args.thresholdsFile)

  runner = Runner(dataDir=dataDir,
                  labelPath=labelFile,
                  resultsDir=resultsDir,
                  profilesPath=profilesFile,
                  thresholdPath=thresholdsFile,
                  numCPUs=numCPUs)

  runner.initialize()

  if args.detect:
    detectorConstructors = getDetectorClassConstructors(args.detectors)
    runner.detect(detectorConstructors)

  if args.optimize:
    runner.optimize(args.detectors)

  if args.score:
    with open(args.thresholdsFile) as thresholdConfigFile:
      detectorThresholds = json.load(thresholdConfigFile)

    runner.score(args.detectors, detectorThresholds)
コード例 #2
0
def main(args):

    root = os.path.dirname(os.path.realpath(__file__))

    numCPUs = int(args.numCPUs) if args.numCPUs is not None else None

    dataDir = os.path.join(root, args.dataDir)
    windowsFile = os.path.join(root, args.windowsFile)
    resultsDir = os.path.join(root, args.resultsDir)
    profilesFile = os.path.join(root, args.profilesFile)
    thresholdsFile = os.path.join(root, args.thresholdsFile)

    runner = Runner(dataDir=dataDir,
                    labelPath=windowsFile,
                    resultsDir=resultsDir,
                    profilesPath=profilesFile,
                    thresholdPath=thresholdsFile,
                    numCPUs=numCPUs)

    runner.initialize()

    if args.detect:
        detectorConstructors = getDetectorClassConstructors(args.detectors)
        print("Starting Evaluation!!\n")
        start_time = datetime.datetime.now()
        runner.detect(detectorConstructors)
        delta = datetime.datetime.now() - start_time
        print("Total time for classification in milliseconds " +
              str(int(delta.total_seconds() * 1000)) + '\n')
        #print("Total time for classification: " + str(delta) + '\n')

    if args.optimize:
        runner.optimize(args.detectors)

    if args.score:
        with open(args.thresholdsFile) as thresholdConfigFile:
            detectorThresholds = json.load(thresholdConfigFile)
        runner.score(args.detectors, detectorThresholds)

    if args.normalize:
        try:
            runner.normalize()
        except AttributeError("Error: you must run the scoring step with the "
                              "normalization step."):
            return
コード例 #3
0
ファイル: run.py プロジェクト: breznak/NAB
def main(args):

  if not args.detect and not args.score and not args.optimize:
    args.detect = True
    args.optimize = True
    args.score = True


  detectors = args.detectors
  numCPUs = int(args.numCPUs) if args.numCPUs is not None else None
  probationaryPercent = float(args.probationaryPercent)

  dataDir = os.path.join(root, args.dataDir)
  labelDir = os.path.join(root, args.labelDir)
  resultsDir = os.path.join(root, args.resultsDir)
  profilesPath = os.path.join(root, args.profilesPath)
  thresholdPath = os.path.join(root, args.thresholdPath)

  runner = Runner(dataDir=dataDir,
                  labelDir=labelDir,
                  resultsDir=resultsDir,
                  profilesPath=profilesPath,
                  thresholdPath=thresholdPath,
                  probationaryPercent=probationaryPercent,
                  numCPUs=numCPUs)

  runner.initialize()

  if args.detect:
    detectorConstructors = getDetectorClassConstructors(args.detectors)
    runner.detect(detectorConstructors)

  if args.optimize:
    runner.optimize(args.detectors)

  if args.score:
    with open(args.thresholdPath) as thresholdConfigFile:
      detectorThresholds = yaml.load(thresholdConfigFile)

    runner.score(args.detectors, detectorThresholds)
コード例 #4
0
ファイル: run.py プロジェクト: MauricioRoman/NAB
def main(args):
  
  root = os.path.dirname(os.path.realpath(__file__))

  numCPUs = int(args.numCPUs) if args.numCPUs is not None else None

  dataDir = os.path.join(root, args.dataDir)
  labelFile = os.path.join(root, args.labelFile)
  resultsDir = os.path.join(root, args.resultsDir)
  profilesFile = os.path.join(root, args.profilesFile)
  thresholdsFile = os.path.join(root, args.thresholdsFile)
  
  runner = Runner(dataDir=dataDir,
                  labelPath=labelFile,
                  resultsDir=resultsDir,
                  profilesPath=profilesFile,
                  thresholdPath=thresholdsFile,
                  numCPUs=numCPUs)

  runner.initialize()

  if args.detect:
    detectorConstructors = getDetectorClassConstructors(
      args.detectors[0].split(','))
    runner.detect(detectorConstructors)

  if args.optimize:
    runner.optimize(args.detectors)

  if args.score:
    with open(args.thresholdsFile) as thresholdConfigFile:
      detectorThresholds = json.load(thresholdConfigFile)
    runner.score(args.detectors, detectorThresholds)

  if args.normalize:
    try:
      runner.normalize()
    except AttributeError("Error: you must run the scoring step with the "
                          "normalization step."):
      return
コード例 #5
0
def main(args):
    numCPUs = int(args.numCPUs) if args.numCPUs is not None else None

    dataDir = args.dataDir
    windowsFile = args.windowsFile
    resultsDir = args.resultsDir
    profilesFile = args.profilesFile
    thresholdsFile = args.thresholdsFile

    runner = Runner(dataDir=dataDir,
                    labelPath=windowsFile,
                    resultsDir=resultsDir,
                    profilesPath=profilesFile,
                    thresholdPath=thresholdsFile,
                    numCPUs=numCPUs)

    runner.initialize()

    if args.detect:
        detectorConstructors = getDetectorClassConstructors(args.detectors)
        runner.detect(detectorConstructors)

    if args.optimize:
        runner.optimize(args.detectors)

    if args.score:
        with open(args.thresholdsFile) as thresholdConfigFile:
            detectorThresholds = json.load(thresholdConfigFile)
        runner.score(args.detectors, detectorThresholds)

    if args.normalize:
        try:
            runner.normalize()
        except AttributeError("Error: you must run the scoring step with the "
                              "normalization step."):
            return