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


Python hpelm.HPELM类代码示例

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


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

示例1: test_AddNeurons_InitDefault_BiasWNotZero

 def test_AddNeurons_InitDefault_BiasWNotZero(self):
     hpelm = HPELM(2, 1)
     hpelm.add_neurons(3, "sigm")
     W = hpelm.nnet.get_neurons()[0][2]
     bias = hpelm.nnet.get_neurons()[0][3]
     self.assertGreater(np.sum(np.abs(W)), 0.001)
     self.assertGreater(np.sum(np.abs(bias)), 0.001)
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:7,代码来源:test_corr_hpelm.py

示例2: test_MultilabelError_CorrectWithMultipleClasses

 def test_MultilabelError_CorrectWithMultipleClasses(self):
     T = np.zeros((100, 5))
     T[:, 0] = 1
     Y = np.zeros((100, 5))
     Y[:, 1] = 1
     model = HPELM(1, 5, classification='ml')
     self.assertEqual(0.4, model.error(T, Y))
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:7,代码来源:unittest_hpelm.py

示例3: test_SLFN_AddTwoNeuronTypes_GotThem

 def test_SLFN_AddTwoNeuronTypes_GotThem(self):
     hpelm = HPELM(1, 1)
     hpelm.add_neurons(1, "lin")
     hpelm.add_neurons(1, "sigm")
     self.assertEquals(2, len(hpelm.nnet.get_neurons()))
     ntypes = [nr[1] for nr in hpelm.nnet.get_neurons()]
     self.assertIn("lin", ntypes)
     self.assertIn("sigm", ntypes)
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:8,代码来源:test_corr_hpelm.py

示例4: test_MultiLabelClassError_Works

 def test_MultiLabelClassError_Works(self):
     T = self.makeh5(np.array([[0, 1], [1, 1], [1, 0]]))
     Y = self.makeh5(np.array([[0.4, 0.6], [0.8, 0.6], [1, 1]]))
     hpelm = HPELM(1, 2)
     hpelm.add_neurons(1, "lin")
     hpelm.classification = "ml"
     e = hpelm.error(T, Y)
     np.testing.assert_allclose(e, 1.0 / 6)
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:8,代码来源:test_corr_hpelm.py

示例5: test_AddDataAsyncToFile_SingleAddition

 def test_AddDataAsyncToFile_SingleAddition(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(3, "lin")
     fHH = self.makefile()
     fHT = self.makefile()
     hpelm.add_data_async(X, T, fHH=fHH, fHT=fHT)
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:8,代码来源:test_corr_hpelm.py

示例6: test_RegressionError_Works

 def test_RegressionError_Works(self):
     T = np.array([1, 2, 3])
     Y = np.array([1.1, 2.2, 3.3])
     err1 = np.mean((T - Y) ** 2)
     fT = self.makeh5(T)
     fY = self.makeh5(Y)
     hpelm = HPELM(1, 1)
     e = hpelm.error(fT, fY)
     np.testing.assert_allclose(e, err1)
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:9,代码来源:test_corr_hpelm.py

示例7: test_AddNeurons_InitTwiceBiasW_CorrectlyMerged

 def test_AddNeurons_InitTwiceBiasW_CorrectlyMerged(self):
     hpelm = HPELM(2, 1)
     W1 = np.random.rand(2, 3)
     W2 = np.random.rand(2, 4)
     bias1 = np.random.rand(3,)
     bias2 = np.random.rand(4,)
     hpelm.add_neurons(3, "sigm", W1, bias1)
     hpelm.add_neurons(4, "sigm", W2, bias2)
     np.testing.assert_array_almost_equal(np.hstack((W1, W2)), hpelm.nnet.get_neurons()[0][2])
     np.testing.assert_array_almost_equal(np.hstack((bias1, bias2)), hpelm.nnet.get_neurons()[0][3])
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:10,代码来源:test_corr_hpelm.py

示例8: test_PredictAsync_Works

 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,代码行数:8,代码来源:test_corr_hpelm.py

示例9: test_Project_Works

 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,代码行数:8,代码来源:test_corr_hpelm.py

示例10: test_AddDataToFile_MixedSequentialAsync

 def test_AddDataToFile_MixedSequentialAsync(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(3, "lin")
     fHH = self.makefile()
     fHT = self.makefile()
     hpelm.add_data(X, T, fHH=fHH, fHT=fHT)
     hpelm.add_data_async(X, T, fHH=fHH, fHT=fHT)
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:9,代码来源:test_corr_hpelm.py

示例11: test_TrainIcount_HasEffect

 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,代码行数:10,代码来源:test_corr_hpelm.py

示例12: test_SolveCorr_Works

 def test_SolveCorr_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(3, "lin")
     fHH = self.makefile()
     fHT = self.makefile()
     hpelm.add_data(X, T, fHH=fHH, fHT=fHT)
     hpelm.solve_corr(fHH, fHT)
     self.assertIsNot(hpelm.nnet.get_B(), None)
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:10,代码来源:test_corr_hpelm.py

示例13: test_ValidationCorr_ReturnsConfusion

 def test_ValidationCorr_ReturnsConfusion(self):
     X = self.makeh5(np.random.rand(10, 3))
     T = self.makeh5(np.random.rand(10, 2))
     hpelm = HPELM(3, 2, classification="c")
     hpelm.add_neurons(6, "tanh")
     fHH = self.makefile()
     fHT = self.makefile()
     hpelm.add_data(X, T, fHH=fHH, fHT=fHT)
     _, _, confs = hpelm.validation_corr(fHH, fHT, X, T, steps=3)
     self.assertGreater(np.sum(confs[0]), 1)
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:10,代码来源:test_corr_hpelm.py

示例14: test_ValidationCorr_Works

 def test_ValidationCorr_Works(self):
     X = self.makeh5(np.random.rand(30, 3))
     T = self.makeh5(np.random.rand(30, 2))
     hpelm = HPELM(3, 2, norm=1e-6)
     hpelm.add_neurons(6, "tanh")
     fHH = self.makefile()
     fHT = self.makefile()
     hpelm.add_data(X, T, fHH=fHH, fHT=fHT)
     nns, err, confs = hpelm.validation_corr(fHH, fHT, X, T, steps=3)
     self.assertGreater(err[0], err[-1])
开发者ID:IstanbulBoy,项目名称:hpelm,代码行数:10,代码来源:test_corr_hpelm.py

示例15: test_WeightedClassError_Works

 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,代码行数:11,代码来源:test_corr_hpelm.py


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