def number_of_neighbors_allowed_set(self):
        """
        Get the set of allowed values for the numberOfNeighbors parameter.

        Returns
        -------
        Set of allowed values or ``None`` if the set of allowed values hasn't been
        populated.
        """
        if self.spec.kNearestNeighborsClassifier.numberOfNeighbors.HasField("set"):
            spec_values = (
                self.spec.kNearestNeighborsClassifier.numberOfNeighbors.set.values
            )
            allowed_values = set()
            for v in spec_values:
                allowed_values.add(v)
            return allowed_values
        return None

        Get the set of allowed values for the numberOfNeighbors parameter.

        Returns
        -------
        Set of allowed values or ``None`` if the set of allowed values hasn't been
        populated.
        
coremltools/models/nearest_neighbors/builder.py