本文整理汇总了Python中sklearn.linear_model.base.LinearModel方法的典型用法代码示例。如果您正苦于以下问题:Python base.LinearModel方法的具体用法?Python base.LinearModel怎么用?Python base.LinearModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.linear_model.base
的用法示例。
在下文中一共展示了base.LinearModel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_linear_model
# 需要导入模块: from sklearn.linear_model import base [as 别名]
# 或者: from sklearn.linear_model.base import LinearModel [as 别名]
def test_linear_model(model_cls):
n = 365
# TODO: add test for time other time ranges (e.g. < 365 days)
index = pd.date_range("2019-01-01", periods=n)
X = pd.DataFrame({"foo": np.sin(np.linspace(-10 * np.pi, 10 * np.pi, n)) * 10}, index=index)
y = X + 2
model = model_cls()
model.fit(X, y)
model.predict(X)
assert isinstance(model, LinearModel)
示例2: test_linear_model_prec
# 需要导入模块: from sklearn.linear_model import base [as 别名]
# 或者: from sklearn.linear_model.base import LinearModel [as 别名]
def test_linear_model_prec(model_cls):
n = 365
# TODO: add test for time other time ranges (e.g. < 365 days)
index = pd.date_range("2019-01-01", periods=n)
X = pd.DataFrame({"foo": np.random.random(n)}, index=index)
y = X + 2
model = model_cls()
model.fit(X, y)
model.predict(X)
assert isinstance(model, LinearModel)
示例3: _checkLM
# 需要导入模块: from sklearn.linear_model import base [as 别名]
# 或者: from sklearn.linear_model.base import LinearModel [as 别名]
def _checkLM(lm):
if isinstance(lm, (LinearModel, LinearRegression, SparseCoefMixin)):
return lm
raise ValueError("LM class " + _class_name(lm) + " is not supported")