本文整理匯總了Python中mlxtend.classifier.Adaline.predict方法的典型用法代碼示例。如果您正苦於以下問題:Python Adaline.predict方法的具體用法?Python Adaline.predict怎麽用?Python Adaline.predict使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mlxtend.classifier.Adaline
的用法示例。
在下文中一共展示了Adaline.predict方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_normal_equation
# 需要導入模塊: from mlxtend.classifier import Adaline [as 別名]
# 或者: from mlxtend.classifier.Adaline import predict [as 別名]
def test_normal_equation():
t1 = np.array([[-0.08], [1.02]])
b1 = np.array([0.00])
ada = Adaline(epochs=30,
eta=0.01,
minibatches=None,
random_seed=None)
ada.fit(X_std, y1)
np.testing.assert_almost_equal(ada.w_, t1, decimal=2)
np.testing.assert_almost_equal(ada.b_, b1, decimal=2)
assert (y1 == ada.predict(X_std)).all(), ada.predict(X_std)
示例2: test_refit_weights
# 需要導入模塊: from mlxtend.classifier import Adaline [as 別名]
# 或者: from mlxtend.classifier.Adaline import predict [as 別名]
def test_refit_weights():
t1 = np.array([-5.21e-16, -7.86e-02, 1.02e+00])
ada = Adaline(epochs=15, eta=0.01, solver='gd', random_seed=1)
ada.fit(X_std, y1, init_weights=True)
ada.fit(X_std, y1, init_weights=False)
np.testing.assert_almost_equal(ada.w_, t1, 2)
assert((y1 == ada.predict(X_std)).all())
示例3: test_0_1_class
# 需要導入模塊: from mlxtend.classifier import Adaline [as 別名]
# 或者: from mlxtend.classifier.Adaline import predict [as 別名]
def test_0_1_class():
t1 = np.array([0.51, -0.04, 0.51])
ada = Adaline(epochs=30, eta=0.01, learning='sgd', random_seed=1)
ada.fit(X_std, y0)
np.testing.assert_almost_equal(ada.w_, t1, 2)
assert((y0 == ada.predict(X_std)).all())
示例4: test_stochastic_gradient_descent
# 需要導入模塊: from mlxtend.classifier import Adaline [as 別名]
# 或者: from mlxtend.classifier.Adaline import predict [as 別名]
def test_stochastic_gradient_descent():
t1 = np.array([0.03, -0.09, 1.02])
ada = Adaline(epochs=30, eta=0.01, learning='sgd', random_seed=1)
ada.fit(X_std, y1)
np.testing.assert_almost_equal(ada.w_, t1, 2)
assert((y1 == ada.predict(X_std)).all())
示例5: test_gradient_descent
# 需要導入模塊: from mlxtend.classifier import Adaline [as 別名]
# 或者: from mlxtend.classifier.Adaline import predict [as 別名]
def test_gradient_descent():
t1 = np.array([-5.21e-16, -7.86e-02, 1.02e+00])
ada = Adaline(epochs=30, eta=0.01, learning='gd', random_seed=1)
ada.fit(X_std, y1)
np.testing.assert_almost_equal(ada.w_, t1, 2)
assert((y1 == ada.predict(X_std)).all())
示例6: test_normal_equation
# 需要導入模塊: from mlxtend.classifier import Adaline [as 別名]
# 或者: from mlxtend.classifier.Adaline import predict [as 別名]
def test_normal_equation():
t1 = np.array([-5.21e-16, -7.86e-02, 1.02e+00])
ada = Adaline(epochs=30,
eta=0.01,
minibatches=None,
random_seed=1)
ada.fit(X_std, y1)
np.testing.assert_almost_equal(ada.w_, t1, 2)
assert((y1 == ada.predict(X_std)).all())
示例7: test_stochastic_gradient_descent
# 需要導入模塊: from mlxtend.classifier import Adaline [as 別名]
# 或者: from mlxtend.classifier.Adaline import predict [as 別名]
def test_stochastic_gradient_descent():
t1 = np.array([[-0.08], [1.02]])
ada = Adaline(epochs=30,
eta=0.01,
minibatches=len(y),
random_seed=1)
ada.fit(X_std, y1)
np.testing.assert_almost_equal(ada.w_, t1, 2)
assert((y1 == ada.predict(X_std)).all())
示例8: test_standardized_iris_data_with_zero_weights
# 需要導入模塊: from mlxtend.classifier import Adaline [as 別名]
# 或者: from mlxtend.classifier.Adaline import predict [as 別名]
def test_standardized_iris_data_with_zero_weights():
t1 = np.array([-5.21e-16, -7.86e-02, 1.02e+00])
ada = Adaline(epochs=30,
eta=0.01,
minibatches=1,
random_seed=1,
zero_init_weight=True)
ada.fit(X_std, y1)
np.testing.assert_almost_equal(ada.w_, t1, 2)
assert((y1 == ada.predict(X_std)).all())
示例9: test_refit_weights
# 需要導入模塊: from mlxtend.classifier import Adaline [as 別名]
# 或者: from mlxtend.classifier.Adaline import predict [as 別名]
def test_refit_weights():
t1 = np.array([[-0.08], [1.02]])
ada = Adaline(epochs=15,
eta=0.01,
minibatches=1,
random_seed=1)
ada.fit(X_std, y1, init_params=True)
ada.fit(X_std, y1, init_params=False)
np.testing.assert_almost_equal(ada.w_, t1, 2)
assert((y1 == ada.predict(X_std)).all())
示例10: test_standardized_iris_data_with_shuffle
# 需要導入模塊: from mlxtend.classifier import Adaline [as 別名]
# 或者: from mlxtend.classifier.Adaline import predict [as 別名]
def test_standardized_iris_data_with_shuffle():
t1 = np.array([-5.21e-16, -7.86e-02, 1.02e+00])
ada = Adaline(epochs=30,
eta=0.01,
solver='gd',
random_seed=1,
shuffle=True)
ada.fit(X_std, y1)
np.testing.assert_almost_equal(ada.w_, t1, 2)
assert((y1 == ada.predict(X_std)).all())
示例11: test_gradient_descent
# 需要導入模塊: from mlxtend.classifier import Adaline [as 別名]
# 或者: from mlxtend.classifier.Adaline import predict [as 別名]
def test_gradient_descent():
t1 = np.array([[-0.08], [1.02]])
b1 = np.array([0.00])
ada = Adaline(epochs=30,
eta=0.01,
minibatches=1,
random_seed=1)
ada.fit(X_std, y1)
np.testing.assert_almost_equal(ada.w_, t1, decimal=2)
np.testing.assert_almost_equal(ada.b_, b1, decimal=2)
assert((y1 == ada.predict(X_std)).all())