本文整理汇总了Python中mlxtend.regressor.LinearRegression类的典型用法代码示例。如果您正苦于以下问题:Python LinearRegression类的具体用法?Python LinearRegression怎么用?Python LinearRegression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LinearRegression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_multivariate_stochastic_gradient_descent
def test_multivariate_stochastic_gradient_descent():
sgd_lr = LinearRegression(eta=0.0001,
epochs=500,
solver='sgd',
random_seed=0)
sgd_lr.fit(X_rm_lstat_std, y_std)
assert_almost_equal(sgd_lr.w_, expect_rm_lstat_std, decimal=2)
示例2: test_univariate_stochastic_gradient_descent
def test_univariate_stochastic_gradient_descent():
sgd_lr = LinearRegression(minibatches=len(y),
eta=0.0001,
epochs=100,
random_seed=0)
sgd_lr.fit(X_rm_std, y_std)
assert_almost_equal(sgd_lr.w_, expect_rm_std, decimal=2)
示例3: test_univariate_gradient_descent
def test_univariate_gradient_descent():
gd_lr = LinearRegression(solver='gd',
eta=0.001,
epochs=500,
random_seed=0)
gd_lr.fit(X_rm_std, y_std)
assert_almost_equal(gd_lr.w_, expect_rm_std, decimal=3)
示例4: test_univariate_normal_equation
def test_univariate_normal_equation():
w_exp = np.array([[9.1]])
b_exp = np.array([-34.7])
ne_lr = LinearRegression(minibatches=None)
ne_lr.fit(X_rm, y)
assert_almost_equal(ne_lr.w_, w_exp, decimal=1)
assert_almost_equal(ne_lr.b_, b_exp, decimal=1)
示例5: test_univariate_normal_equation_std
def test_univariate_normal_equation_std():
w_exp = np.array([[0.7]])
b_exp = np.array([0.0])
ne_lr = LinearRegression(minibatches=None)
ne_lr.fit(X_rm_std, y_std)
assert_almost_equal(ne_lr.w_, w_exp, decimal=1)
assert_almost_equal(ne_lr.b_, b_exp, decimal=1)
示例6: test_multivariate_gradient_descent
def test_multivariate_gradient_descent():
gd_lr = LinearRegression(eta=0.001,
epochs=500,
minibatches=1,
random_seed=0)
gd_lr.fit(X_rm_lstat_std, y_std)
assert_almost_equal(gd_lr.w_, expect_rm_lstat_std, decimal=3)
示例7: test_progress_3
def test_progress_3():
gd_lr = LinearRegression(minibatches=1,
eta=0.001,
epochs=1,
print_progress=2,
random_seed=0)
gd_lr.fit(X_rm_std, y_std)
示例8: test_multivariate_normal_equation
def test_multivariate_normal_equation():
w_exp = np.array([[5.1], [-0.6]])
b_exp = np.array([-1.5])
ne_lr = LinearRegression(minibatches=None)
ne_lr.fit(X_rm_lstat, y)
assert_almost_equal(ne_lr.w_, w_exp, decimal=1)
assert_almost_equal(ne_lr.b_, b_exp, decimal=1)
示例9: test_ary_persistency_in_shuffling
def test_ary_persistency_in_shuffling():
orig = X_rm_lstat_std.copy()
sgd_lr = LinearRegression(eta=0.0001,
epochs=500,
minibatches=len(y),
random_seed=0)
sgd_lr.fit(X_rm_lstat_std, y_std)
np.testing.assert_almost_equal(orig, X_rm_lstat_std, 6)
示例10: test_multivariate_gradient_descent
def test_multivariate_gradient_descent():
w_exp = np.array([[0.4], [-0.5]])
b_exp = np.array([0.0])
gd_lr = LinearRegression(eta=0.001,
epochs=500,
minibatches=1,
random_seed=0)
gd_lr.fit(X_rm_lstat_std, y_std)
assert_almost_equal(gd_lr.w_, w_exp, decimal=1)
assert_almost_equal(gd_lr.b_, b_exp, decimal=1)
示例11: test_multivariate_stochastic_gradient_descent
def test_multivariate_stochastic_gradient_descent():
w_exp = np.array([[0.389], [-0.499]])
b_exp = np.array([0.000])
sgd_lr = LinearRegression(eta=0.0001,
epochs=500,
minibatches=len(y),
random_seed=0)
sgd_lr.fit(X_rm_lstat_std, y_std)
assert_almost_equal(sgd_lr.w_, w_exp, decimal=3)
assert_almost_equal(sgd_lr.b_, b_exp, decimal=3)
示例12: test_univariate_gradient_descent
def test_univariate_gradient_descent():
w_exp = np.array([[0.695]])
b_exp = np.array([0.00])
gd_lr = LinearRegression(minibatches=1,
eta=0.001,
epochs=500,
random_seed=0)
gd_lr.fit(X_rm_std, y_std)
assert_almost_equal(gd_lr.w_, w_exp, decimal=3)
assert_almost_equal(gd_lr.b_, b_exp, decimal=3)
示例13: test_univariate_stochastic_gradient_descent
def test_univariate_stochastic_gradient_descent():
w_exp = np.array([[0.7]])
b_exp = np.array([0.0])
sgd_lr = LinearRegression(minibatches=len(y),
eta=0.0001,
epochs=150,
random_seed=0)
sgd_lr.fit(X_rm_std, y_std)
assert_almost_equal(sgd_lr.w_, w_exp, decimal=1)
assert_almost_equal(sgd_lr.b_, b_exp, decimal=1)
示例14: test_univariate_normal_equation_std
def test_univariate_normal_equation_std():
ne_lr = LinearRegression(minibatches=None)
ne_lr.fit(X_rm_std, y_std)
assert_almost_equal(ne_lr.w_, expect_rm_std, decimal=3)
示例15: test_univariate_normal_equation_std
def test_univariate_normal_equation_std():
ne_lr = LinearRegression(solver='normal equation')
ne_lr.fit(X_rm_std, y_std)
assert_almost_equal(ne_lr.w_, expect_rm_std, decimal=3)