<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def predict(self, X, exposure=None):
 """ preduct expected value of target given model and input X often this is done via expected value of GAM given input X Parameters --------- X : array-like of shape (n_samples, m_features), default: None containing the input dataset exposure : array-like shape (n_samples,) or None, default: None containing exposures if None, defaults to array of ones Returns ------- y : np.array of shape (n_samples,) containing predicted values under the model """

        if not self._is_fitted:
            raise AttributeError('GAM has not been fitted. Call fit first.')

        X = check_X(X, n_feats=self.statistics_['m_features'],
                    edge_knots=self.edge_knots_, dtypes=self.dtype,
                    features=self.feature, verbose=self.verbose)

        if exposure is not None:
            exposure = np.array(exposure).astype('f')
        else:
            exposure = np.ones(X.shape[0]).astype('f')
        check_lengths(X, exposure)

        return self.predict_mu(X) * exposure