def weighting_scheme(self, weighting_scheme):
        """
        Set the weighting scheme for the KNearestNeighborsClassifier model.

        Parameters
        ----------
        weighting_scheme
                One of [ ``'uniform'``, ``'inverse_distance'`` ].

        Returns
        -------
        None
        """
        weighting_scheme = weighting_scheme.lower()
        if weighting_scheme not in self._VALID_WEIGHTING_SCHEMES:
            raise TypeError("Invalid weighting scheme")

        if weighting_scheme == "inverse_distance":
            self.spec.kNearestNeighborsClassifier.inverseDistanceWeighting.MergeFromString(
                b""
            )
        else:
            self.spec.kNearestNeighborsClassifier.uniformWeighting.MergeFromString(b"")

        # storing this in the object is just a convenience
        self._weighting_scheme = weighting_scheme

        Set the weighting scheme for the KNearestNeighborsClassifier model.

        Parameters
        ----------
        weighting_scheme
                One of [ ``'uniform'``, ``'inverse_distance'`` ].

        Returns
        -------
        None
        
coremltools/models/nearest_neighbors/builder.py