本文整理匯總了Python中nupic.algorithms.anomaly_likelihood.AnomalyLikelihood.write方法的典型用法代碼示例。如果您正苦於以下問題:Python AnomalyLikelihood.write方法的具體用法?Python AnomalyLikelihood.write怎麽用?Python AnomalyLikelihood.write使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類nupic.algorithms.anomaly_likelihood.AnomalyLikelihood
的用法示例。
在下文中一共展示了AnomalyLikelihood.write方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: AnomalyLikelihoodRegion
# 需要導入模塊: from nupic.algorithms.anomaly_likelihood import AnomalyLikelihood [as 別名]
# 或者: from nupic.algorithms.anomaly_likelihood.AnomalyLikelihood import write [as 別名]
#.........這裏部分代碼省略.........
"count": 1,
"required": True,
"isDefaultInput": False
},
},
"outputs": {
"anomalyLikelihood": {
"description": "The resultant anomaly likelihood",
"dataType": "Real32",
"count": 1,
"isDefaultOutput": True,
},
},
"parameters": {
"learningPeriod": {
"description": "The number of iterations required for the\
algorithm to learn the basic patterns in the dataset\
and for the anomaly score to 'settle down'.",
"dataType": "UInt32",
"count": 1,
"constraints": "",
"defaultValue": 288,
"accessMode": "ReadWrite"
},
"estimationSamples": {
"description": "The number of reasonable anomaly scores\
required for the initial estimate of the\
Gaussian.",
"dataType": "UInt32",
"count": 1,
"constraints": "",
"defaultValue": 100,
"accessMode": "ReadWrite"
},
"historicWindowSize": {
"description": "Size of sliding window of historical data\
points to maintain for periodic reestimation\
of the Gaussian.",
"dataType": "UInt32",
"count": 1,
"constraints": "",
"defaultValue": 8640,
"accessMode": "ReadWrite"
},
"reestimationPeriod": {
"description": "How often we re-estimate the Gaussian\
distribution.",
"dataType": "UInt32",
"count": 1,
"constraints": "",
"defaultValue": 100,
"accessMode": "ReadWrite"
},
},
"commands": {
},
}
def __init__(self,
learningPeriod = 288,
estimationSamples = 100,
historicWindowSize = 8640,
reestimationPeriod = 100):
self.anomalyLikelihood = AnomalyLikelihood(
learningPeriod = learningPeriod,
estimationSamples = estimationSamples,
historicWindowSize = historicWindowSize,
reestimationPeriod = reestimationPeriod)
def __eq__(self, other):
return self.anomalyLikelihood == other.anomalyLikelihood
def __ne__(self, other):
return not self == other
@classmethod
def read(cls, proto):
anomalyLikelihoodRegion = object.__new__(cls)
anomalyLikelihoodRegion.anomalyLikelihood = AnomalyLikelihood.read(proto)
return anomalyLikelihoodRegion
def write(self, proto):
self.anomalyLikelihood.write(proto)
def initialize(self):
pass
def compute(self, inputs, outputs):
anomalyScore = inputs["rawAnomalyScore"][0]
value = inputs["metricValue"][0]
anomalyProbability = self.anomalyLikelihood.anomalyProbability(
value, anomalyScore)
outputs["anomalyLikelihood"][0] = anomalyProbability