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


Python Earth.forward_trace方法代码示例

本文整理汇总了Python中pyearth.Earth.forward_trace方法的典型用法代码示例。如果您正苦于以下问题:Python Earth.forward_trace方法的具体用法?Python Earth.forward_trace怎么用?Python Earth.forward_trace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyearth.Earth的用法示例。


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

示例1: run_pyearth

# 需要导入模块: from pyearth import Earth [as 别名]
# 或者: from pyearth.Earth import forward_trace [as 别名]
def run_pyearth(X, y, **kwargs):
    '''Run with pyearth.  Return prediction value, training time, and number of forward pass iterations.'''
    model = Earth(**kwargs)
    t0 = time.time()
    model.fit(X, y)
    t1 = time.time()
    y_pred = model.predict(X)
    forward_iterations = len(model.forward_trace()) - 1
    return y_pred, t1 - t0, forward_iterations
开发者ID:Biodun,项目名称:py-earth,代码行数:11,代码来源:pyearth_vs_earth.py

示例2: test_untrained

# 需要导入模块: from pyearth import Earth [as 别名]
# 或者: from pyearth.Earth import forward_trace [as 别名]
def test_untrained():

    model = Earth(**default_params)
    assert_raises(NotFittedError, model.predict, X)
    assert_raises(NotFittedError, model.transform, X)
    assert_raises(NotFittedError, model.predict_deriv, X)
    assert_raises(NotFittedError, model.score, X)

    # the following should be changed to raise NotFittedError
    assert_equal(model.forward_trace(), None)
    assert_equal(model.pruning_trace(), None)
    assert_equal(model.summary(), "Untrained Earth Model")
开发者ID:Biodun,项目名称:py-earth,代码行数:14,代码来源:test_earth.py

示例3: test_patsy_compatibility

# 需要导入模块: from pyearth import Earth [as 别名]
# 或者: from pyearth.Earth import forward_trace [as 别名]
def test_patsy_compatibility():
    import pandas
    import patsy
    X_df = pandas.DataFrame(X)
    y_df = pandas.DataFrame(y)
    colnames = ['xx' + str(i) for i in range(X.shape[1])]
    X_df.columns = colnames
    X_df['y'] = y
    y_df, X_df = patsy.dmatrices(
        'y ~ xx0 + xx1 + xx2 + xx3 + xx4 + xx5 + xx6 + xx7 + xx8 + xx9 - 1',
        data=X_df)

    model = Earth(**default_params).fit(X_df, y_df)
    assert_list_equal(
        colnames, model.forward_trace()._getstate()['xlabels'])
开发者ID:RPGOne,项目名称:han-solo,代码行数:17,代码来源:test_earth.py

示例4: test_untrained

# 需要导入模块: from pyearth import Earth [as 别名]
# 或者: from pyearth.Earth import forward_trace [as 别名]
def test_untrained():
    # NotFittedError moved from utils.validation to exceptions
    # some time after 0.17.1
    try:
        from sklearn.exceptions import NotFittedError
    except ImportError:
        from sklearn.utils.validation import NotFittedError
    
    # Make sure calling methods that require a fitted Earth object
    # raises the appropriate exception when using a not yet fitted 
    # Earth object
    model = Earth(**default_params)
    assert_raises(NotFittedError, model.predict, X)
    assert_raises(NotFittedError, model.transform, X)
    assert_raises(NotFittedError, model.predict_deriv, X)
    assert_raises(NotFittedError, model.score, X)

    # the following should be changed to raise NotFittedError
    assert_equal(model.forward_trace(), None)
    assert_equal(model.pruning_trace(), None)
    assert_equal(model.summary(), "Untrained Earth Model")
开发者ID:RPGOne,项目名称:han-solo,代码行数:23,代码来源:test_earth.py


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