umbmid/ai/logreg.py
def _param_grad(self, features, labels, preds, n_samples):
        """Get the gradient of the cost func with respect to each param

        Parameters
        ----------
        features : array_like
            The features for each sample used during training
        labels : array_like
            Binary class labels (0s and 1s) for each sample
        preds : array_like
            The predicted probabilities for each sample
        n_samples : int
            The number of samples used during training

        Returns
        -------
        param_grad : array_like
            The gradient of the cost function with respect to each param
        """

        features = self._reshape_features(features)  # Reshape features

        # Find the gradient with respect to each parameter
        param_grad = (1 / n_samples) * np.sum((preds - labels)[:, None] *
                                              features, axis=0)

        return param_grad
Get the gradient of the cost func with respect to each param

        Parameters
        ----------
        features : array_like
            The features for each sample used during training
        labels : array_like
            Binary class labels (0s and 1s) for each sample
        preds : array_like
            The predicted probabilities for each sample
        n_samples : int
            The number of samples used during training

        Returns
        -------
        param_grad : array_like
            The gradient of the cost function with respect to each param
        
Get the gradient of the cost func with respect to each param
Get the gradient of the cost func with respect to each param
def _param_grad(self, features, labels, preds, n_samples):
        features = self._reshape_features(features)  
        param_grad = (1 / n_samples) * np.sum((preds - labels)[:, None] *
                                              features, axis=0)
        return param_grad
def _param_grad ( self , features , labels , preds , n_samples ) : features = self . _reshape_features ( features ) param_grad = ( 1 / n_samples ) * np . sum ( ( preds - labels ) [ : , None ] * features , axis = 0 ) return param_grad
Get the gradient of the cost func with respect to each param
Get the gradient of the cost func with respect to each param
"""Get the gradient of the cost func with respect to each param

        Parameters
        ----------
        features : array_like
            The features for each sample used during training
        labels : array_like
            Binary class labels (0s and 1s) for each sample
        preds : array_like
            The predicted probabilities for each sample
        n_samples : int
            The number of samples used during training

        Returns
        -------
        param_grad : array_like
            The gradient of the cost function with respect to each param
        """ # Reshape features
 # Find the gradient with respect to each parameter

The gradient of the cost function with respect to each param
The gradient of the cost function with respect to each param
array_like

self
features
The features for each sample used during training
The features for each sample used during training
labels
Binary class labels (0s and 1s) for each sample
Binary class labels ( 0s and 1s ) for each sample
preds
The predicted probabilities for each sample
The predicted probabilities for each sample
n_samples
The number of samples used during training
The number of samples used during training