# Path: brainiak/utils/utils.py
# def circ_dist(x, y):
#     """
#     Computes the pairwise circular distance between two arrays of
#     points (in radians).
# 
#     Parameters
#     ----------
#         x: numpy vector of positions on a circle, in radians.
#         y: numpy vector of positions on a circle, in radians.
# 
#     Returns
#     -------
#         r: numpy vector of distances between inputs.
#     """
#     if x.size != y.size:
#         raise ValueError("Input sizes must match to compute pairwise "
#                          "comparisons.")
#     r = np.angle(np.exp(x*1j) / np.exp(y*1j))
#     return r


import logging
import warnings
import numpy as np
import scipy.stats
from sklearn.base import BaseEstimator
from sklearn.metrics.pairwise import cosine_distances, euclidean_distances
from ..utils.utils import circ_dist
            raise ValueError("Data matrix has too many or too few "
                             "dimensions.")

        model_prediction = self._predict_features(X)

        return model_prediction

    def score(self, X, y):
        """Calculate error measure of prediction. Default measurement
        is R^2, the coefficient of determination.

        Parameters
        ----------
            X: numpy matrix of voxel activation from new data
                [observations,voxels]
            y: numpy array of responses. [observations]

        Returns
        -------
            score_value: the error measurement between the actual
                feature and predicted features.
        """
        pred_features = self.predict(X)
        if self.stimulus_mode == 'halfcircular':
            # multiply features by 2. otherwise doesn't wrap properly
            pred_features = pred_features * 2
            y = y * 2

        ssres = (circ_dist(np.deg2rad(y),
                           np.deg2rad(pred_features)) ** 2).sum()

# Path: brainiak/utils/utils.py
# def circ_dist(x, y):
#     """
#     Computes the pairwise circular distance between two arrays of
#     points (in radians).
# 
#     Parameters
#     ----------
#         x: numpy vector of positions on a circle, in radians.
#         y: numpy vector of positions on a circle, in radians.
# 
#     Returns
#     -------
#         r: numpy vector of distances between inputs.
#     """
#     if x.size != y.size:
#         raise ValueError("Input sizes must match to compute pairwise "
#                          "comparisons.")
#     r = np.angle(np.exp(x*1j) / np.exp(y*1j))
#     return r


# Path: brainiak/reconstruct/iem.py
import logging
import warnings
import numpy as np
import scipy.stats
from sklearn.base import BaseEstimator
from sklearn.metrics.pairwise import cosine_distances, euclidean_distances
from ..utils.utils import circ_dist

            raise ValueError("Data matrix has too many or too few "
                             "dimensions.")

        model_prediction = self._predict_features(X)

        return model_prediction

    def score(self, X, y):
        """Calculate error measure of prediction. Default measurement
        is R^2, the coefficient of determination.

        Parameters
        ----------
            X: numpy matrix of voxel activation from new data
                [observations,voxels]
            y: numpy array of responses. [observations]

        Returns
        -------
            score_value: the error measurement between the actual
                feature and predicted features.
        """
        pred_features = self.predict(X)
        if self.stimulus_mode == 'halfcircular':
            # multiply features by 2. otherwise doesn't wrap properly
            pred_features = pred_features * 2
            y = y * 2

        ssres = (circ_dist(np.deg2rad(y),
                           np.deg2rad(pred_features)) ** 2).sum()

        sstot = (circ_dist(np.deg2rad(y),