コード例 #1
0
ファイル: utils.py プロジェクト: smg1/nupic
def runDummyModel(modelID,
                  jobID,
                  useStreams,
                  params,
                  predictedField,
                  reportKeys,
                  optimizeKey,
                  jobsDAO,
                  modelCheckpointGUID,
                  logLevel=None,
                  predictionCacheMaxRecords=None):
    from nupic.swarming.DummyModelRunner import OPFDummyModelRunner

    # The logger for this method
    logger = logging.getLogger('com.numenta.nupic.hypersearch.utils')

    # -------------------------------------------------------------------------
    # if NTA_ROOTDIR is not set in the environment, set it for the user so that
    #   we can find data files expected to be in the share/prediction/data directory
    if not "NTA_ROOTDIR" in os.environ:
        os.environ['NTA_ROOTDIR'] = nupic.rootDir

    # Run the experiment now
    try:
        if type(params) is bool:
            params = {}

        runner = OPFDummyModelRunner(
            modelID=modelID,
            jobID=jobID,
            params=params,
            predictedField=predictedField,
            reportKeyPatterns=reportKeys,
            optimizeKeyPattern=optimizeKey,
            useStreams=useStreams,
            jobsDAO=jobsDAO,
            modelCheckpointGUID=modelCheckpointGUID,
            logLevel=logLevel,
            predictionCacheMaxRecords=predictionCacheMaxRecords)

        (completionReason, completionMsg) = runner.run()

    # The dummy model runner will call sys.exit(1) if
    #  NTA_TEST_sysExitFirstNModels is set and the number of models in the
    #  models table is <= NTA_TEST_sysExitFirstNModels
    except SystemExit:
        sys.exit(1)
    except InvalidConnectionException:
        raise
    except Exception, e:
        (completionReason,
         completionMsg) = _handleModelRunnerException(jobID, modelID, jobsDAO,
                                                      "NA", logger, e)
コード例 #2
0
def runDummyModel(
    modelID,
    jobID,
    params,
    predictedField,
    reportKeys,
    optimizeKey,
    jobsDAO,
    modelCheckpointGUID,
    logLevel=None,
    predictionCacheMaxRecords=None,
):
    from nupic.swarming.DummyModelRunner import OPFDummyModelRunner

    # The logger for this method
    logger = logging.getLogger("com.numenta.nupic.hypersearch.utils")

    # -------------------------------------------------------------------------
    # if NTA_ROOTDIR is not set in the environment, set it for the user so that
    #   we can find data files expected to be in the share/prediction/data directory
    if not "NTA_ROOTDIR" in os.environ:
        os.environ["NTA_ROOTDIR"] = nupic.rootDir

    # Run the experiment now
    try:
        if type(params) is bool:
            params = {}

        runner = OPFDummyModelRunner(
            modelID=modelID,
            jobID=jobID,
            params=params,
            predictedField=predictedField,
            reportKeyPatterns=reportKeys,
            optimizeKeyPattern=optimizeKey,
            jobsDAO=jobsDAO,
            modelCheckpointGUID=modelCheckpointGUID,
            logLevel=logLevel,
            predictionCacheMaxRecords=predictionCacheMaxRecords,
        )

        (completionReason, completionMsg) = runner.run()

    # The dummy model runner will call sys.exit(1) if
    #  NTA_TEST_sysExitFirstNModels is set and the number of models in the
    #  models table is <= NTA_TEST_sysExitFirstNModels
    except SystemExit:
        sys.exit(1)
    except InvalidConnectionException:
        raise
    except Exception, e:
        (completionReason, completionMsg) = _handleModelRunnerException(jobID, modelID, jobsDAO, "NA", logger, e)
コード例 #3
0
ファイル: utils.py プロジェクト: devbeta/nupic
def runDummyModel(
    modelID,
    jobID,
    params,
    predictedField,
    reportKeys,
    optimizeKey,
    jobsDAO,
    modelCheckpointGUID,
    logLevel=None,
    predictionCacheMaxRecords=None,
):
    from nupic.swarming.DummyModelRunner import OPFDummyModelRunner

    # The logger for this method
    logger = logging.getLogger("com.numenta.nupic.hypersearch.utils")

    # Run the experiment now
    try:
        if type(params) is bool:
            params = {}

        runner = OPFDummyModelRunner(
            modelID=modelID,
            jobID=jobID,
            params=params,
            predictedField=predictedField,
            reportKeyPatterns=reportKeys,
            optimizeKeyPattern=optimizeKey,
            jobsDAO=jobsDAO,
            modelCheckpointGUID=modelCheckpointGUID,
            logLevel=logLevel,
            predictionCacheMaxRecords=predictionCacheMaxRecords,
        )

        (completionReason, completionMsg) = runner.run()

    # The dummy model runner will call sys.exit(1) if
    #  NTA_TEST_sysExitFirstNModels is set and the number of models in the
    #  models table is <= NTA_TEST_sysExitFirstNModels
    except SystemExit:
        sys.exit(1)
    except InvalidConnectionException:
        raise
    except Exception, e:
        (completionReason, completionMsg) = _handleModelRunnerException(jobID, modelID, jobsDAO, "NA", logger, e)
コード例 #4
0
def runDummyModel(modelID,
                  jobID,
                  params,
                  predictedField,
                  reportKeys,
                  optimizeKey,
                  jobsDAO,
                  modelCheckpointGUID,
                  logLevel=None,
                  predictionCacheMaxRecords=None):
    from nupic.swarming.DummyModelRunner import OPFDummyModelRunner

    # The logger for this method
    logger = logging.getLogger('com.numenta.nupic.hypersearch.utils')

    # Run the experiment now
    try:
        if type(params) is bool:
            params = {}

        runner = OPFDummyModelRunner(
            modelID=modelID,
            jobID=jobID,
            params=params,
            predictedField=predictedField,
            reportKeyPatterns=reportKeys,
            optimizeKeyPattern=optimizeKey,
            jobsDAO=jobsDAO,
            modelCheckpointGUID=modelCheckpointGUID,
            logLevel=logLevel,
            predictionCacheMaxRecords=predictionCacheMaxRecords)

        (completionReason, completionMsg) = runner.run()

    # The dummy model runner will call sys.exit(1) if
    #  NTA_TEST_sysExitFirstNModels is set and the number of models in the
    #  models table is <= NTA_TEST_sysExitFirstNModels
    except SystemExit:
        sys.exit(1)
    except InvalidConnectionException:
        raise
    except Exception, e:
        (completionReason,
         completionMsg) = _handleModelRunnerException(jobID, modelID, jobsDAO,
                                                      "NA", logger, e)