本文整理匯總了Python中hpelm.ELM.error方法的典型用法代碼示例。如果您正苦於以下問題:Python ELM.error方法的具體用法?Python ELM.error怎麽用?Python ELM.error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類hpelm.ELM
的用法示例。
在下文中一共展示了ELM.error方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_MultilabelError_CorrectWithMultipleClasses
# 需要導入模塊: from hpelm import ELM [as 別名]
# 或者: from hpelm.ELM import error [as 別名]
def test_MultilabelError_CorrectWithMultipleClasses(self):
T = np.zeros((100, 5))
T[:, 0] = 1
Y = np.zeros((100, 5))
Y[:, 1] = 1
model = ELM(1, 5, classification='ml')
self.assertEqual(0.4, model.error(T, Y))
示例2: test_RegressionError_Works
# 需要導入模塊: from hpelm import ELM [as 別名]
# 或者: from hpelm.ELM import error [as 別名]
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)
elm = ELM(1, 1)
e = elm.error(T, Y)
np.testing.assert_allclose(e, err1)
示例3: test_MultiLabelClassError_Works
# 需要導入模塊: from hpelm import ELM [as 別名]
# 或者: from hpelm.ELM import error [as 別名]
def test_MultiLabelClassError_Works(self):
X = np.array([1, 2, 3])
T = np.array([[0, 1], [1, 1], [1, 0]])
Y = np.array([[0.4, 0.6], [0.8, 0.6], [1, 1]])
elm = ELM(1, 2, classification="ml")
elm.add_neurons(1, "lin")
e = elm.error(T, Y)
np.testing.assert_allclose(e, 1.0 / 6)
示例4: test_WeightedClassError_Works
# 需要導入模塊: from hpelm import ELM [as 別名]
# 或者: from hpelm.ELM import error [as 別名]
def test_WeightedClassError_Works(self):
T = np.array([[0, 1], [0, 1], [1, 0]])
Y = 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)
elm = ELM(1, 2, classification="wc", w=w)
elm.add_neurons(1, "lin")
e = elm.error(T, Y)
np.testing.assert_allclose(e, 0.9)
示例5: build_ELM_encoder
# 需要導入模塊: from hpelm import ELM [as 別名]
# 或者: from hpelm.ELM import error [as 別名]
def build_ELM_encoder(xinput, target, num_neurons):
elm = ELM(xinput.shape[1], target.shape[1])
elm.add_neurons(num_neurons, "sigm")
elm.add_neurons(num_neurons, "lin")
#elm.add_neurons(num_neurons, "rbf_l1")
elm.train(xinput, target, "r")
ypred = elm.predict(xinput)
print "mse error", elm.error(ypred, target)
return elm, ypred