'Computes a neighborhood consisting of the  n users to a given
user based on the strategy implemented in this method.
Parameters
user_id:  int or string
ID of user for which to find most similar other users
data_model: DataModel instance
The data model that will be the source for the possible
candidates
n_similarity: string
The similarity to compute the neighborhood (Default = \'user_similarity\')
nhood_size: int
The neighborhood size (default = None all users)
Optional Parameters
minimal_similarity: float
minimal similarity required for neighbors (default = 0.0)
sampling_rate: int
percentage of users to consider when building neighborhood
(default = 1)'

def user_neighborhood(self, user_id, data_model, n_similarity='user_similarity', distance=None, nhood_size=None, **params):

    minimal_similarity = params.get('minimal_similarity', 0.0)
    sampling_rate = params.get('sampling_rate', 1.0)
    data_model = self._sampling(data_model, sampling_rate)
    if (distance is None):
        distance = euclidean_distances
    if (n_similarity == 'user_similarity'):
        self._set_similarity(data_model, n_similarity, distance, nhood_size)
    else:
        raise ValueError('similarity    argument    must    be    user_similarity')
    neighborhood = [to_user_id for (to_user_id, score) in self.similarity[user_id] if ((not np.isnan(score)) and (score >= minimal_similarity) and (user_id != to_user_id))]
    return neighborhood
