def predict(self, X):
    'Use the fitted model to predict on data'
    assert (self._weights is not None), 'Model needs to be fitted first. Use the fit method'
    if self.normalize:
        X = self._feature_scaler.transform(X)
    X = X.to_numpy()
    if self.add_intercept:
        X = np.hstack((np.ones((X.shape[0], 1)), X))
    y_pred = np.dot(X, self._weights)
    if self.normalize:
        y_pred = self._target_scaler.inverse_transform(y_pred)
    return np.round(y_pred, 2)
Use the fitted model to predict on data
def predict(self, X):
    
    assert (self._weights is not None), 'Model needs to be fitted first. Use the fit method'
    if self.normalize:
        X = self._feature_scaler.transform(X)
    X = X.to_numpy()
    if self.add_intercept:
        X = np.hstack((np.ones((X.shape[0], 1)), X))
    y_pred = np.dot(X, self._weights)
    if self.normalize:
        y_pred = self._target_scaler.inverse_transform(y_pred)
    return np.round(y_pred, 2)