import numpy as _np
from sklearn.linear_model import LinearRegression as _LinearRegression

from epistasis.models.base import BaseModel as _BaseModel
from epistasis.models.base import X_fitter as X_fitter
from epistasis.models.base import X_predictor as X_predictor

class EpistasisLinearRegression(_LinearRegression, _BaseModel):
    """ Ordinary least-squares regression of epistatic interactions.
    """
    def __init__(self, order=1, model_type="global", n_jobs=1, **kwargs):
        # Set Linear Regression settings.
        self.fit_intercept = False
        self.normalize = False
        self.copy_X = False
        self.n_jobs = n_jobs
        self.set_params(model_type=model_type, order=order, **kwargs)

    @X_fitter
    def fit(self, X=None, y=None):
        # Build input linear regression.
        super(self.__class__, self).fit(X,y)

    @X_predictor
    def predict(self, X=None):
        return super(self.__class__, self).predict(X)

    @X_fitter
    def score(self, X=None, y=None):
        return super(self.__class__, self).score(X, y)

@@ -749,35 +749,55 @@
 , X=None, y=None
+, sample_weight=None
 ):%0A
-
         # Build 
@@ -863,17 +863,33 @@
 ).fit(X,
-y
+ y, sample_weight
 )%0A%0A    @
@@ -1029,32 +1029,32 @@
 =None, y=None):%0A
-
         return s
@@ -1092,8 +1092,720 @@
 e(X, y)%0A
+%0A    @X_fitter%0A    def _sample_fit(self, X=None, y=None):%0A        %22%22%22Sample the %60fit%60 method from phenotype standard deviations.%22%22%22%0A        # Fit a model%0A        y = self.gpm.stdeviations * _np.random.randn() + self.gpm.phenotypes%0A        model = self.__class__%0A        model.fit(X=X, y=y)%0A        return model.coef_%0A%0A    @X_fitter%0A    def _sample_predict(self, X=None):%0A        %22%22%22Sample the %60predict%60 method from phenotype standard deviations.%22%22%22%0A        # Fit a model%0A        y = self.gpm.stdeviations * _np.random.randn() + self.gpm.phenotypes%0A        model = self.__class__%0A        model.fit(X=X, y=y)%0A        # predict from that model%0A        predictions = model.predict(X=None)%0A        return predictions%0A

update linear regression class