当前位置: 首页>>代码示例>>Python>>正文


Python HPELM.train方法代码示例

本文整理汇总了Python中hpelm.HPELM.train方法的典型用法代码示例。如果您正苦于以下问题:Python HPELM.train方法的具体用法?Python HPELM.train怎么用?Python HPELM.train使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hpelm.HPELM的用法示例。


在下文中一共展示了HPELM.train方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_Project_Works

# 需要导入模块: from hpelm import HPELM [as 别名]
# 或者: from hpelm.HPELM import train [as 别名]
 def test_Project_Works(self):
     X = self.makeh5(np.array([[1, 2], [3, 4], [5, 6], [7, 8]]))
     T = self.makeh5(np.array([[1], [2], [3], [4]]))
     hpelm = HPELM(2, 1)
     hpelm.add_neurons(1, "lin")
     hpelm.train(X, T)
     fH = self.makefile()
     hpelm.project(X, fH)
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:10,代码来源:test_corr_hpelm.py

示例2: test_PredictAsync_Works

# 需要导入模块: from hpelm import HPELM [as 别名]
# 或者: from hpelm.HPELM import train [as 别名]
 def test_PredictAsync_Works(self):
     X = self.makeh5(np.array([[1, 2], [3, 4], [5, 6], [7, 8]]))
     T = self.makeh5(np.array([[1], [2], [3], [4]]))
     hpelm = HPELM(2, 1)
     hpelm.add_neurons(1, "lin")
     hpelm.train(X, T)
     fY = self.makefile()
     hpelm.predict_async(X, fY)
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:10,代码来源:test_corr_hpelm.py

示例3: test_TrainIcount_HasEffect

# 需要导入模块: from hpelm import HPELM [as 别名]
# 或者: from hpelm.HPELM import train [as 别名]
 def test_TrainIcount_HasEffect(self):
     X = self.makeh5(np.array([[1, 2], [3, 4], [5, 6]]))
     T = self.makeh5(np.array([[3], [2], [3]]))
     hpelm = HPELM(2, 1)
     hpelm.add_neurons(1, "lin")
     hpelm.train(X, T)
     B1 = hpelm.nnet.get_B()
     hpelm.train(X, T, icount=2)
     B2 = hpelm.nnet.get_B()
     self.assertFalse(np.allclose(B1, B2), "iCount index does not work")
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:12,代码来源:test_corr_hpelm.py

示例4: test_WeightedClassError_Works

# 需要导入模块: from hpelm import HPELM [as 别名]
# 或者: from hpelm.HPELM import train [as 别名]
 def test_WeightedClassError_Works(self):
     X = self.makeh5(np.array([1, 2, 3]))
     T = self.makeh5(np.array([[0, 1], [0, 1], [1, 0]]))
     Y = self.makeh5(np.array([[0, 1], [0.4, 0.6], [0, 1]]))
     # here class 0 is totally incorrect, and class 1 is totally correct
     w = (9, 1)
     hpelm = HPELM(1, 2)
     hpelm.add_neurons(1, "lin")
     hpelm.train(X, T, "wc", w=w)
     e = hpelm.error(T, Y)
     np.testing.assert_allclose(e, 0.9)
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:13,代码来源:test_corr_hpelm.py

示例5: start

# 需要导入模块: from hpelm import HPELM [as 别名]
# 或者: from hpelm.HPELM import train [as 别名]
	def start():
		pairs = MapperUtil.get_allpairs() # Get pairs starting from 0th line
		if not pairs:
			print ("No pairs found.")
			sys.exit()

		p = pyaudio.PyAudio() # Create a PyAudio session

		# Create a stream
		stream = p.open(format=FORMAT,
						channels=CHANNELS,
						rate=RATE,
						output=True)

		#H2V_cursor = NeuralNetUtil.get_neurons("H2V")
		elmH2V = None

		# Loop over the pairs coming from CROSSMODAL
		for pair in pairs:
			   #time.sleep(0.5) # Wait 0.5 seconds to prevent aggressive loop
			   print pair

			   if pair['direction'] == "H2V":
				   print "____________________________________________________________\n"
				   print pair['timestamp1']

				   hearing_memory = HearingMemoryUtil.get_memory(pair['timestamp1'])
				   hearing_memory = hearing_memory.next()['data']
				   #print hearing_memory.next()['data']
				   #chunky_array = numpy.fromstring(hearing_memory.next()['data'], 'int16')
				   #print chunky_array
				   stream.write(hearing_memory)

				   numpy_audio = numpy.fromstring(hearing_memory, numpy.uint8)
				   #print numpy_audio
				   print "Audio: ",numpy_audio.shape
				   #print numpy.transpose(numpy_audio.reshape((numpy_audio.shape[0],1))).shape


				   vision_memory = VisionMemoryUtil.get_memory(pair['timestamp2'])
				   vision_memory = vision_memory.next()

				   frame_amodal = numpy.fromstring(vision_memory['amodal'], numpy.uint8)
				   print "Frame Threshold: ",frame_amodal.shape
				   cv2.imshow("Frame Threshhold", frame_amodal.reshape(360,640))
				   cv2.moveWindow("Frame Threshhold",50,100)

				   frame_color = numpy.fromstring(vision_memory['color'], numpy.uint8)
				   print "Frame Delta Colored: ",frame_color.shape
				   cv2.imshow("Frame Delta Colored", frame_color.reshape(360,640,3))
				   cv2.moveWindow("Frame Delta Colored",1200,100)
				   key = cv2.waitKey(500) & 0xFF
				   #time.sleep(2.0)

				   modulo = numpy_audio.shape[0] % RATE
				   numpy_audio = numpy_audio[:-modulo]
				   for one_second in numpy.array_split(numpy_audio, int(numpy_audio.shape[0] / RATE)):
					   X = numpy.transpose(one_second.reshape((one_second.shape[0],1)))
					   T = numpy.transpose(frame_amodal.reshape((frame_amodal.shape[0],1)))
					   X = X.astype(numpy.float32, copy=False)
					   T = T.astype(numpy.float32, copy=False)
					   X[0] = X[0] / X[0].max()
					   T[0] = T[0] / T[0].max()
					   print X.shape
					   print T.shape
					   if elmH2V is None:
						   elmH2V = HPELM(X.shape[1],T.shape[1])
						   if os.path.exists(os.path.expanduser("~/CerebralCortexH2V.pkl")):
							   #elmH2V.nnet.neurons = H2V_cursor.next()['neurons']
							   elmH2V.load(os.path.expanduser("~/CerebralCortexH2V.pkl"))
						   else:
							   elmH2V.add_neurons(100, "sigm")
					   elmH2V.train(X, T, "LOO")
					   print elmH2V.predict(X)
					   cv2.imshow(">>>PREDICTION<<<", numpy.transpose(elmH2V.predict(X)).reshape(360,640))
					   cv2.moveWindow(">>>PREDICTION<<<",50,550)

		print elmH2V.nnet.neurons
		elmH2V.save(os.path.expanduser("~/CerebralCortexH2V.pkl"))
开发者ID:Unmukt,项目名称:Cerebrum,代码行数:81,代码来源:weaver.py

示例6: test_OneDimensionTargets2_RunsCorrectly

# 需要导入模块: from hpelm import HPELM [as 别名]
# 或者: from hpelm.HPELM import train [as 别名]
 def test_OneDimensionTargets2_RunsCorrectly(self):
     X = self.makeh5(np.array([[1, 2], [3, 4], [5, 6]]))
     T = self.makeh5(np.array([[0], [0], [0]]))
     hpelm = HPELM(2, 1)
     hpelm.add_neurons(1, "lin")
     hpelm.train(X, T)
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:8,代码来源:test_corr_hpelm.py

示例7: test_ZeroInputs_RunsCorrectly

# 需要导入模块: from hpelm import HPELM [as 别名]
# 或者: from hpelm.HPELM import train [as 别名]
 def test_ZeroInputs_RunsCorrectly(self):
     X = self.makeh5(np.array([[0, 0], [0, 0], [0, 0]]))
     T = self.makeh5(np.array([1, 2, 3]))
     hpelm = HPELM(2, 1)
     hpelm.add_neurons(1, "lin")
     hpelm.train(X, T)
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:8,代码来源:test_corr_hpelm.py

示例8: test_OneDimensionTargets_RunsCorrectly

# 需要导入模块: from hpelm import HPELM [as 别名]
# 或者: from hpelm.HPELM import train [as 别名]
 def test_OneDimensionTargets_RunsCorrectly(self):
     X = self.makeh5(np.array([1, 2, 3]))
     T = self.makeh5(np.array([1, 2, 3]))
     hpelm = HPELM(1, 1)
     hpelm.add_neurons(1, "lin")
     hpelm.train(X, T)
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:8,代码来源:test_corr_hpelm.py

示例9: test_HPELM_tprint

# 需要导入模块: from hpelm import HPELM [as 别名]
# 或者: from hpelm.HPELM import train [as 别名]
 def test_HPELM_tprint(self):
     X = self.makeh5(np.array([1, 2, 3, 1, 2, 3]))
     T = self.makeh5(np.array([[1, 0], [1, 0], [1, 0], [0, 1], [0, 1], [0, 1]]))
     hpelm = HPELM(1, 2, batch=2, tprint=0)
     hpelm.add_neurons(1, "lin")
     hpelm.train(X, T)
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:8,代码来源:test_corr_hpelm.py

示例10: test_WeightedClassification_DefaultWeightsWork

# 需要导入模块: from hpelm import HPELM [as 别名]
# 或者: from hpelm.HPELM import train [as 别名]
 def test_WeightedClassification_DefaultWeightsWork(self):
     X = self.makeh5(np.array([1, 2, 3, 1, 2, 3]))
     T = self.makeh5(np.array([[1, 0], [1, 0], [1, 0], [0, 1], [0, 1], [0, 1]]))
     hpelm = HPELM(1, 2)
     hpelm.add_neurons(1, "lin")
     hpelm.train(X, T, 'wc')
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:8,代码来源:test_corr_hpelm.py

示例11: test_TrainIcount_Works

# 需要导入模块: from hpelm import HPELM [as 别名]
# 或者: from hpelm.HPELM import train [as 别名]
 def test_TrainIcount_Works(self):
     X = self.makeh5(np.array([[1, 2], [3, 4], [5, 6]]))
     T = self.makeh5(np.array([[1], [2], [3]]))
     hpelm = HPELM(2, 1)
     hpelm.add_neurons(1, "lin")
     hpelm.train(X, T, icount=2)
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:8,代码来源:test_corr_hpelm.py


注:本文中的hpelm.HPELM.train方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。