def fit(self, probs: np.ndarray, targets: np.ndarray):
        """
        Fit che temperature.

        Parameters
        ----------
        probs: np.ndarray
            A two-dimensional array of probabilities, for each input and class.
        targets: np.ndarray
            A one-dimensional array of integer target variables.
        """
        self._check_probs(probs)
        self._check_targets(targets)
        log_probs = np.log(probs)
        one_hot_targets = np.eye(probs.shape[1])[targets.reshape(-1)]

        def temp_scaling_fn(tau):
            log_temp_probs = log_softmax(log_probs / tau, axis=1)
            return -np.sum(one_hot_targets * log_temp_probs)

        self._temperature = brute(temp_scaling_fn, ranges=[(1e-6, 10)], Ns=1000)[0]

        Fit che temperature.

        Parameters
        ----------
        probs: np.ndarray
            A two-dimensional array of probabilities, for each input and class.
        targets: np.ndarray
            A one-dimensional array of integer target variables.
        
fortuna/calibration/classification/temp_scaling/base.py