Python sklearn.linear_model.base.LinearModel() Examples

The following are 3 code examples of sklearn.linear_model.base.LinearModel(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sklearn.linear_model.base , or try the search function .
Example #1
Source Project: scikit-downscale   Author: jhamman   File: test_pointwise_models.py    License: Apache License 2.0 5 votes vote down vote up
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) 
Example #2
Source Project: scikit-downscale   Author: jhamman   File: test_pointwise_models.py    License: Apache License 2.0 5 votes vote down vote up
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) 
Example #3
Source Project: sklearn2pmml   Author: jpmml   File: __init__.py    License: GNU Affero General Public License v3.0 5 votes vote down vote up
def _checkLM(lm):
	if isinstance(lm, (LinearModel, LinearRegression, SparseCoefMixin)):
		return lm
	raise ValueError("LM class " + _class_name(lm) + " is not supported")