# Path: epistasis/models/utils.py
# def arghandler(method):
#     """Points methods to argument handlers. Assumes each argument has a
#     corresponding method attached to the object named "_{argument}". These
#     methods given default values to arguments.
# 
#     Ignores self and kwargs
#     """
#     @wraps(method)
#     def inner(self, *args, **kwargs):
#         # Get method name
#         name = method.__name__
# 
#         # Inspect function for arguments to update.
#         out = inspect.signature(method)
# 
#         # Construct kwargs from signature.
#         kws = {key: val.default for key, val in out.parameters.items()}
#         kws.pop('self')
# 
#         # Try to remove kwargs.
#         try:
#             kws.pop('kwargs')
#         except:
#             pass
# 
#         # Update kwargs with user specified kwargs.
#         kws.update(**kwargs)
# 
#         # Handle each argument
#         for arg in kws:
#             # Get handler function.
#             handler_name = "_{}".format(arg)
#             handler = getattr(self, handler_name)
#             kws[arg] = handler(data=kws[arg], method=name)
# 
#         return method(self, **kws)
#     return inner


import numpy as np
import warnings
from sklearn.linear_model import Ridge
from ..base import BaseModel, use_sklearn
from ..utils import arghandler
    def fit(self, X=None, y=None, **kwargs):
        # If a threshold exists in the data, pre-classify genotypes
        X = np.asfortranarray(X)
        self = super(self.__class__, self).fit(X, y)

        # Link coefs to epistasis values.
        self.epistasis.values = np.reshape(self.coef_, (-1,))
        return self

    def fit_transform(self, X=None, y=None, **kwargs):
        return self.fit(X=X, y=y, **kwargs)

    @arghandler
    def predict(self, X=None):
        X = np.asfortranarray(X)
        return super(self.__class__, self).predict(X)

    @arghandler
    def predict_transform(self, X=None, y=None):
        return self.predict(X=X)

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

    @property
    def thetas(self):
        return self.coef_


# Path: epistasis/models/utils.py
# def arghandler(method):
#     """Points methods to argument handlers. Assumes each argument has a
#     corresponding method attached to the object named "_{argument}". These
#     methods given default values to arguments.
# 
#     Ignores self and kwargs
#     """
#     @wraps(method)
#     def inner(self, *args, **kwargs):
#         # Get method name
#         name = method.__name__
# 
#         # Inspect function for arguments to update.
#         out = inspect.signature(method)
# 
#         # Construct kwargs from signature.
#         kws = {key: val.default for key, val in out.parameters.items()}
#         kws.pop('self')
# 
#         # Try to remove kwargs.
#         try:
#             kws.pop('kwargs')
#         except:
#             pass
# 
#         # Update kwargs with user specified kwargs.
#         kws.update(**kwargs)
# 
#         # Handle each argument
#         for arg in kws:
#             # Get handler function.
#             handler_name = "_{}".format(arg)
#             handler = getattr(self, handler_name)
#             kws[arg] = handler(data=kws[arg], method=name)
# 
#         return method(self, **kws)
#     return inner


# Path: epistasis/models/linear/ridge.py
import numpy as np
import warnings
from sklearn.linear_model import Ridge
from ..base import BaseModel, use_sklearn
from ..utils import arghandler

    def fit(self, X=None, y=None, **kwargs):
        # If a threshold exists in the data, pre-classify genotypes
        X = np.asfortranarray(X)
        self = super(self.__class__, self).fit(X, y)

        # Link coefs to epistasis values.
        self.epistasis.values = np.reshape(self.coef_, (-1,))
        return self

    def fit_transform(self, X=None, y=None, **kwargs):
        return self.fit(X=X, y=y, **kwargs)

    @arghandler
    def predict(self, X=None):
        X = np.asfortranarray(X)
        return super(self.__class__, self).predict(X)

    @arghandler
    def predict_transform(self, X=None, y=None):
        return self.predict(X=X)

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

    @property
    def thetas(self):
        return self.coef_


    @arghandler