本文整理汇总了Python中nupic.algorithms.temporal_memory.TemporalMemory.read方法的典型用法代码示例。如果您正苦于以下问题:Python TemporalMemory.read方法的具体用法?Python TemporalMemory.read怎么用?Python TemporalMemory.read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nupic.algorithms.temporal_memory.TemporalMemory
的用法示例。
在下文中一共展示了TemporalMemory.read方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testWriteRead
# 需要导入模块: from nupic.algorithms.temporal_memory import TemporalMemory [as 别名]
# 或者: from nupic.algorithms.temporal_memory.TemporalMemory import read [as 别名]
def testWriteRead(self):
tm1 = TemporalMemory(
columnDimensions=(32,),
cellsPerColumn=4,
activationThreshold=3,
initialPermanence=0.21,
connectedPermanence=0.50,
minThreshold=2,
maxNewSynapseCount=3,
permanenceIncrement=0.1,
permanenceDecrement=0.1,
predictedSegmentDecrement=0.0,
seed=42
)
self.serializationTestPrepare(tm1)
proto1 = TemporalMemoryProto_capnp.TemporalMemoryProto.new_message()
tm1.write(proto1)
# Write the proto to a temp file and read it back into a new proto
with tempfile.TemporaryFile() as f:
proto1.write(f)
f.seek(0)
proto2 = TemporalMemoryProto_capnp.TemporalMemoryProto.read(f)
# Load the deserialized proto
tm2 = TemporalMemory.read(proto2)
self.assertEqual(tm1, tm2)
self.serializationTestVerify(tm2)
示例2: testReadTestFile
# 需要导入模块: from nupic.algorithms.temporal_memory import TemporalMemory [as 别名]
# 或者: from nupic.algorithms.temporal_memory.TemporalMemory import read [as 别名]
def testReadTestFile(self):
with open("TemporalMemorySerializationWrite.tmp", "r") as f:
proto = TemporalMemoryProto_capnp.TemporalMemoryProto.read(f)
# Load the deserialized proto
tm = TemporalMemory.read(proto)
self.serializationTestVerify(tm)