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


Python regressor.LinearRegression类代码示例

本文整理汇总了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)
开发者ID:beingzy,项目名称:mlxtend,代码行数:7,代码来源:test_linear_regression.py

示例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)
开发者ID:datasci-co,项目名称:mlxtend,代码行数:7,代码来源:test_linear_regression.py

示例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)
开发者ID:beingzy,项目名称:mlxtend,代码行数:7,代码来源:test_linear_regression.py

示例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)
开发者ID:JJLWHarrison,项目名称:mlxtend,代码行数:7,代码来源:test_linear_regression.py

示例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)
开发者ID:JJLWHarrison,项目名称:mlxtend,代码行数:7,代码来源:test_linear_regression.py

示例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)
开发者ID:datasci-co,项目名称:mlxtend,代码行数:7,代码来源:test_linear_regression.py

示例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)
开发者ID:JJLWHarrison,项目名称:mlxtend,代码行数:7,代码来源:test_linear_regression.py

示例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)
开发者ID:JJLWHarrison,项目名称:mlxtend,代码行数:7,代码来源:test_linear_regression.py

示例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)
开发者ID:JJLWHarrison,项目名称:mlxtend,代码行数:8,代码来源:test_linear_regression.py

示例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)
开发者ID:JJLWHarrison,项目名称:mlxtend,代码行数:10,代码来源:test_linear_regression.py

示例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)
开发者ID:CandyPythonFlow,项目名称:mlxtend,代码行数:10,代码来源:test_linear_regression.py

示例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)
开发者ID:CandyPythonFlow,项目名称:mlxtend,代码行数:10,代码来源:test_linear_regression.py

示例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)
开发者ID:JJLWHarrison,项目名称:mlxtend,代码行数:10,代码来源:test_linear_regression.py

示例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)
开发者ID:datasci-co,项目名称:mlxtend,代码行数:4,代码来源:test_linear_regression.py

示例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)
开发者ID:beingzy,项目名称:mlxtend,代码行数:4,代码来源:test_linear_regression.py


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