def _generateMetricSpecs(options):
inferenceType = options['<STR_LIT>']<EOL>inferenceArgs = options['<STR_LIT>']<EOL>predictionSteps = inferenceArgs['<STR_LIT>']<EOL>metricWindow = options['<STR_LIT>']<EOL>if metricWindow is None:<EOL><INDENT>metricWindow = int(Configuration.get("<STR_LIT>"))<EOL><DEDENT>metricSpecStrings = []<EOL>optimizeMetricLabel = "<STR_LIT>"<EOL>metricSpecStrings.extend(_generateExtraMetricSpecs(options))<EOL>optimizeMetricSpec = None<EOL>if options['<STR_LIT>']:<EOL><INDENT>assert len(predictionSteps) == <NUM_LIT:1><EOL>predictionSteps = ['<STR_LIT>']<EOL><DEDENT>if inferenceType in (InferenceType.TemporalNextStep,<EOL>InferenceType.TemporalAnomaly,<EOL>InferenceType.TemporalMultiStep,<EOL>InferenceType.NontemporalMultiStep,<EOL>InferenceType.NontemporalClassification,<EOL>'<STR_LIT>'):<EOL><INDENT>predictedFieldName, predictedFieldType = _getPredictedField(options)<EOL>isCategory = _isCategory(predictedFieldType)<EOL>metricNames = ('<STR_LIT>',) if isCategory else ('<STR_LIT>', '<STR_LIT>')<EOL>trivialErrorMetric = '<STR_LIT>' if isCategory else '<STR_LIT>'<EOL>oneGramErrorMetric = '<STR_LIT>' if isCategory else '<STR_LIT>'<EOL>movingAverageBaselineName = '<STR_LIT>' if isCategory else '<STR_LIT>'<EOL>for metricName in metricNames:<EOL><INDENT>metricSpec, metricLabel =_generateMetricSpecString(field=predictedFieldName,<EOL>inferenceElement=InferenceElement.multiStepBestPredictions,<EOL>metric='<STR_LIT>',<EOL>params={'<STR_LIT>': metricName,<EOL>'<STR_LIT>':metricWindow,<EOL>'<STR_LIT>': predictionSteps},<EOL>returnLabel=True)<EOL>metricSpecStrings.append(metricSpec)<EOL><DEDENT>if options["<STR_LIT>"] is not None :<EOL><INDENT>metricParams = dict(options["<STR_LIT>"])<EOL>metricParams['<STR_LIT>'] = '<STR_LIT>'<EOL>metricParams['<STR_LIT>'] = predictionSteps<EOL>if not "<STR_LIT>" in metricParams:<EOL><INDENT>metricParams["<STR_LIT>"] = metricWindow<EOL><DEDENT>metricSpec, metricLabel =_generateMetricSpecString(field=predictedFieldName,<EOL>inferenceElement=InferenceElement.multiStepPredictions,<EOL>metric="<STR_LIT>",<EOL>params=metricParams,<EOL>returnLabel=True)<EOL>metricSpecStrings.append(metricSpec)<EOL><DEDENT>optimizeMetricSpec = metricSpec<EOL>metricLabel = metricLabel.replace('<STR_LIT:[>', '<STR_LIT>')<EOL>metricLabel = metricLabel.replace('<STR_LIT:]>', '<STR_LIT>')<EOL>optimizeMetricLabel = metricLabel<EOL>if options["<STR_LIT>"] is not None :<EOL><INDENT>optimizeMetricLabel = "<STR_LIT>"<EOL><DEDENT>if options["<STR_LIT>"]and inferenceType != InferenceType.NontemporalClassification:<EOL><INDENT>for steps in predictionSteps:<EOL><INDENT>metricSpecStrings.append(<EOL>_generateMetricSpecString(field=predictedFieldName,<EOL>inferenceElement=InferenceElement.prediction,<EOL>metric="<STR_LIT>",<EOL>params={'<STR_LIT>':metricWindow,<EOL>"<STR_LIT>":trivialErrorMetric,<EOL>'<STR_LIT>': steps})<EOL>)<EOL>if isCategory:<EOL><INDENT>metricSpecStrings.append(<EOL>_generateMetricSpecString(field=predictedFieldName,<EOL>inferenceElement=InferenceElement.prediction,<EOL>metric=movingAverageBaselineName,<EOL>params={'<STR_LIT>':metricWindow<EOL>,"<STR_LIT>":"<STR_LIT>",<EOL>"<STR_LIT>":<NUM_LIT:200>,<EOL>"<STR_LIT>": steps})<EOL>)<EOL><DEDENT>else :<EOL><INDENT>metricSpecStrings.append(<EOL>_generateMetricSpecString(field=predictedFieldName,<EOL>inferenceElement=InferenceElement.prediction,<EOL>metric=movingAverageBaselineName,<EOL>params={'<STR_LIT>':metricWindow<EOL>,"<STR_LIT>":"<STR_LIT>",<EOL>"<STR_LIT>":<NUM_LIT:200>,<EOL>"<STR_LIT>": steps})<EOL>)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>elif inferenceType in (InferenceType.TemporalClassification):<EOL><INDENT>metricName = '<STR_LIT>'<EOL>trivialErrorMetric = '<STR_LIT>'<EOL>oneGramErrorMetric = '<STR_LIT>'<EOL>movingAverageBaselineName = '<STR_LIT>'<EOL>optimizeMetricSpec, optimizeMetricLabel =_generateMetricSpecString(inferenceElement=InferenceElement.classification,<EOL>metric=metricName,<EOL>params={'<STR_LIT>':metricWindow},<EOL>returnLabel=True)<EOL>metricSpecStrings.append(optimizeMetricSpec)<EOL>if options["<STR_LIT>"]:<EOL><INDENT>if inferenceType == InferenceType.TemporalClassification:<EOL><INDENT>metricSpecStrings.append(<EOL>_generateMetricSpecString(inferenceElement=InferenceElement.classification,<EOL>metric="<STR_LIT>",<EOL>params={'<STR_LIT>':metricWindow,<EOL>"<STR_LIT>":trivialErrorMetric})<EOL>)<EOL>metricSpecStrings.append(<EOL>_generateMetricSpecString(inferenceElement=InferenceElement.classification,<EOL>metric="<STR_LIT>",<EOL>params={'<STR_LIT>':metricWindow,<EOL>"<STR_LIT>":oneGramErrorMetric})<EOL>)<EOL>metricSpecStrings.append(<EOL>_generateMetricSpecString(inferenceElement=InferenceElement.classification,<EOL>metric=movingAverageBaselineName,<EOL>params={'<STR_LIT>':metricWindow<EOL>,"<STR_LIT>":"<STR_LIT>",<EOL>"<STR_LIT>":<NUM_LIT:200>})<EOL>)<EOL><DEDENT><DEDENT>if not options["<STR_LIT>"] == None :<EOL><INDENT>if not "<STR_LIT>" in options["<STR_LIT>"]:<EOL><INDENT>options["<STR_LIT>"]["<STR_LIT>"] = metricWindow<EOL><DEDENT>optimizeMetricSpec = _generateMetricSpecString(<EOL>inferenceElement=InferenceElement.classification,<EOL>metric="<STR_LIT>",<EOL>params=options["<STR_LIT>"])<EOL>optimizeMetricLabel = "<STR_LIT>"<EOL>metricSpecStrings.append(optimizeMetricSpec)<EOL><DEDENT><DEDENT>if options['<STR_LIT>']:<EOL><INDENT>for i in range(len(metricSpecStrings)):<EOL><INDENT>metricSpecStrings[i] = metricSpecStrings[i].replace(<EOL>"<STR_LIT>", "<STR_LIT>")<EOL><DEDENT>optimizeMetricLabel = optimizeMetricLabel.replace(<EOL>"<STR_LIT>", "<STR_LIT>")<EOL><DEDENT>return metricSpecStrings, optimizeMetricLabel<EOL>
Generates the Metrics for a given InferenceType

    Parameters:
    -------------------------------------------------------------------------
    options: ExpGenerator options
    retval: (metricsList, optimizeMetricLabel)
              metricsList: list of metric string names
              optimizeMetricLabel: Name of the metric which to optimize over