# Path: splearn/utils/validation.py
# def check_rdd(rdd, expected_dtype):
#     """Wrapper function to check_rdd_dtype. Raises TypeError in case of dtype
#     mismatch.
# 
#     Parameters:
#     -----------
#     rdd: splearn.BlockRDD
#         The RDD to check
#     expected_dtype: {type, list of types, tuple of types, dict of types}
#         Expected type(s). If the RDD is a DictRDD the parameter type is
#         restricted to dict.
#     """
#     if not check_rdd_dtype(rdd, expected_dtype):
#         raise TypeError("{0} dtype mismatch.".format(rdd))


import operator
import numpy as np
import scipy.sparse as sp
from sklearn.base import copy
from sklearn.linear_model.base import LinearRegression
from ..utils.validation import check_rdd
    def fit(self, Z):
        """
        Fit linear model.

        Parameters
        ----------
        Z : DictRDD with (X, y) values
            X containing numpy array or sparse matrix - The training data
            y containing the target values

        Returns
        -------
        self : returns an instance of self.
        """
        check_rdd(Z, {'X': (sp.spmatrix, np.ndarray)})
        return self._spark_fit(SparkLinearRegression, Z)

    def predict(self, X):
        """Distributed method to predict class labels for samples in X.

        Parameters
        ----------
        X : ArrayRDD containing {array-like, sparse matrix}
            Samples.

        Returns
        -------
        C : ArrayRDD
            Predicted class label per sample.
        """

# Path: splearn/utils/validation.py
# def check_rdd(rdd, expected_dtype):
#     """Wrapper function to check_rdd_dtype. Raises TypeError in case of dtype
#     mismatch.
# 
#     Parameters:
#     -----------
#     rdd: splearn.BlockRDD
#         The RDD to check
#     expected_dtype: {type, list of types, tuple of types, dict of types}
#         Expected type(s). If the RDD is a DictRDD the parameter type is
#         restricted to dict.
#     """
#     if not check_rdd_dtype(rdd, expected_dtype):
#         raise TypeError("{0} dtype mismatch.".format(rdd))


# Path: splearn/linear_model/base.py
import operator
import numpy as np
import scipy.sparse as sp
from sklearn.base import copy
from sklearn.linear_model.base import LinearRegression
from ..utils.validation import check_rdd

    def fit(self, Z):
        """
        Fit linear model.

        Parameters
        ----------
        Z : DictRDD with (X, y) values
            X containing numpy array or sparse matrix - The training data
            y containing the target values

        Returns
        -------
        self : returns an instance of self.
        """
        check_rdd(Z, {'X': (sp.spmatrix, np.ndarray)})
        return self._spark_fit(SparkLinearRegression, Z)

    def predict(self, X):
        """Distributed method to predict class labels for samples in X.

        Parameters
        ----------
        X : ArrayRDD containing {array-like, sparse matrix}
            Samples.

        Returns
        -------
        C : ArrayRDD
            Predicted class label per sample.
        """

        check_rdd(X, (sp.spmatrix, np.ndarray))