Пример #1
0
def run(args):
  """ Method to handle scenarios for running a single model or all of them."""
  if args.modelName == "all":
    modelNames = nlpModelTypes
    runningAllModels = True
  else:
    modelNames = [args.modelName]
    runningAllModels = False

  allRanks = {}
  ranks = {}
  stats = {}
  for name in modelNames:
    # Setup args
    args.modelName = name
    args.modelDir = os.path.join(args.experimentDir, name)
    if runningAllModels and name == "htm":
      # Need to specify network config for htm models
      try:
        htmModelInfo = htmConfigs.pop()
      except KeyError:
        print "Not enough HTM configs, so skipping the HTM model."
        continue
      name = htmModelInfo[0]
      args.networkConfigPath = htmModelInfo[1]

    # Run the junit test, update metrics dicts
    ar, r, s = runExperiment(args)
    allRanks.update({name:ar})
    ranks.update({name:r})
    stats.update({name:s})

  plotResults(allRanks, ranks, maxRank=NUMBER_OF_DOCS, testName="JUnit Test 4")
Пример #2
0
def run(args):
  """ Method to handle scenarios for running a single model or all of them."""
  if args.modelName == "all":
    modelNames = nlpModelTypes
    runningAllModels = True
  else:
    modelNames = [args.modelName]
    runningAllModels = False

  allRanks = {}
  ranks = {}
  stats = {}
  for name in modelNames:
    # Setup args
    args.modelName = name
    args.modelDir = os.path.join(args.experimentDir, name)
    if runningAllModels and name == "htm":
      # Need to specify network config for htm models
      try:
        htmModelInfo = htmConfigs.pop()
      except KeyError:
        print "Not enough HTM configs, so skipping the HTM model."
        continue
      name = htmModelInfo[0]
      args.networkConfigPath = htmModelInfo[1]

    # Run the junit test, update metrics dicts
    ar, r, s = runExperiment(args)
    allRanks.update({name:ar})
    ranks.update({name:r})
    stats.update({name:s})

  if args.plot:
    plotResults(allRanks, ranks, maxRank=NUMBER_OF_DOCS,
                testName="JUnit Test 3")
Пример #3
0
def run(args):
  """ Method to handle scenarios for running a single model or all of them."""
  if args.modelName == "all":
    modelNames = nlpModelTypes
    runningAllModels = True
  else:
    modelNames = [args.modelName]
    runningAllModels = False

  # Run both variations (a and b) of junit test 2
  test2Types = (("a", 0), ("b", 4))
  for testVariation, testIndex in test2Types:
    allRanks = {}
    ranks = {}
    stats = {}
    for name in modelNames:
      # Setup args
      args.modelName = name
      args.modelDir = os.path.join(args.experimentDir, name)
      if runningAllModels and name == "htm":
        # Need to specify network config for htm models
        try:
          htmModelInfo = htmConfigs.pop()
          htmConfigs.add(htmModelInfo)  # TODO: replace this hack
        except KeyError:
          print "Not enough HTM configs, so skipping the HTM model."
          continue
        name = htmModelInfo[0]
        args.networkConfigPath = htmModelInfo[1]

      # Run the junit test, update metrics dicts
      ar, r, s = runExperiment(args, testIndex)
      allRanks.update({name:ar})
      ranks.update({name:r})
      stats.update({name:s})

    if args.plot:
      plotResults(
        allRanks, ranks, maxRank=NUMBER_OF_DOCS,
        testName="JUnit Test 2{}".format(testVariation))
Пример #4
0
def run(args):
  """ Method to handle scenarios for running a single model or all of them."""
  if args.modelName == "all":
    modelNames = nlpModelTypes
    runningAllModels = True
  else:
    modelNames = [args.modelName]
    runningAllModels = False

  # Run both variations (a and b) of junit test 2
  test2Types = (("a", 0), ("b", 4))
  for testVariation, testIndex in test2Types:
    allRanks = {}
    ranks = {}
    stats = {}
    for name in modelNames:
      # Setup args
      args.modelName = name
      args.modelDir = os.path.join(args.experimentDir, name)
      if runningAllModels and name == "htm":
        # Need to specify network config for htm models
        try:
          htmModelInfo = htmConfigs.pop()
          htmConfigs.add(htmModelInfo)  # TODO: replace this hack
        except KeyError:
          print "Not enough HTM configs, so skipping the HTM model."
          continue
        name = htmModelInfo[0]
        args.networkConfigPath = htmModelInfo[1]

      # Run the junit test, update metrics dicts
      ar, r, s = runExperiment(args, testIndex)
      allRanks.update({name:ar})
      ranks.update({name:r})
      stats.update({name:s})

    plotResults(
      allRanks, ranks, maxRank=NUMBER_OF_DOCS,
      testName="JUnit Test 2{}".format(testVariation))