Combines the train and predict methods to create a surrogate
        model function fitted to the input/output combinations given in
        u_sparse and q_sparse.

        :param numpy.ndarray u_sparse: input values at which the output
            values are obtained.  Must be the same as the qaudrature
            points defined by the getQuadraturePoints method.
        :param numpy.ndarray q_sparse: output values corresponding
            to the input values given in u_sparse to which the
            surrogate is fitted

        :return: surrogate model fitted to u_sparse and q_sparse

        :rtype: function

        *Sample Usage*::

            >>> thePC = PolySurrogate(dimensions=2)
            >>> U = thePC.getQuadraturePoints()
            >>> Q = [myFunc(u) for u in U]
            >>> surrogateFunc = thePC.surrogate(U, Q)

def surrogate(self, u_sparse, q_sparse):
        '''Combines the train and predict methods to create a surrogate
        model function fitted to the input/output combinations given in
        u_sparse and q_sparse.

        :param numpy.ndarray u_sparse: input values at which the output
            values are obtained.  Must be the same as the qaudrature
            points defined by the getQuadraturePoints method.
        :param numpy.ndarray q_sparse: output values corresponding
            to the input values given in u_sparse to which the
            surrogate is fitted

        :return: surrogate model fitted to u_sparse and q_sparse

        :rtype: function

        *Sample Usage*::

            >>> thePC = PolySurrogate(dimensions=2)
            >>> U = thePC.getQuadraturePoints()
            >>> Q = [myFunc(u) for u in U]
            >>> surrogateFunc = thePC.surrogate(U, Q)

        '''
        self.train(q_sparse)
        def model(u):
            return self.predict(u)
        return model