ktrain/lroptimize/lrfinder.py
def plot_loss_change(self, sma=1, n_skip_beginning=10, n_skip_end=5, y_lim=(-0.01, 0.01)):
        """
        Plots rate of change of the loss function.
        Parameters:
            sma - number of batches for simple moving average to smooth out the curve.
            n_skip_beginning - number of batches to skip on the left.
            n_skip_end - number of batches to skip on the right.
            y_lim - limits for the y axis.
        """
        assert sma >= 1
        derivatives = [0] * sma
        for i in range(sma, len(self.lrs)):
            derivative = (self.losses[i] - self.losses[i - sma]) / sma
            derivatives.append(derivative)

        plt.ylabel("rate of loss change")
        plt.xlabel("learning rate (log scale)")
        plt.plot(self.lrs[n_skip_beginning:-n_skip_end], derivatives[n_skip_beginning:-n_skip_end])
        plt.xscale('log')
        plt.ylim(y_lim)

        Plots rate of change of the loss function.
        Parameters:
            sma - number of batches for simple moving average to smooth out the curve.
            n_skip_beginning - number of batches to skip on the left.
            n_skip_end - number of batches to skip on the right.
            y_lim - limits for the y axis.
        
Plots rate of change of the loss function.
Parameters:
sma - number of batches for simple moving average to smooth out the curve.
n_skip_beginning - number of batches to skip on the left.
n_skip_end - number of batches to skip on the right.
y_lim - limits for the y axis.
Plots rate of change of the loss function . Parameters : sma - number of batches for simple moving average to smooth out the curve . n_skip_beginning - number of batches to skip on the left . n_skip_end - number of batches to skip on the right . y_lim - limits for the y axis .
def plot_loss_change(self, sma=1, n_skip_beginning=10, n_skip_end=5, y_lim=(-0.01, 0.01)):
        assert sma >= 1
        derivatives = [0] * sma
        for i in range(sma, len(self.lrs)):
            derivative = (self.losses[i] - self.losses[i - sma]) / sma
            derivatives.append(derivative)
        plt.ylabel("rate of loss change")
        plt.xlabel("learning rate (log scale)")
        plt.plot(self.lrs[n_skip_beginning:-n_skip_end], derivatives[n_skip_beginning:-n_skip_end])
        plt.xscale('log')
        plt.ylim(y_lim)
def plot_loss_change ( self , sma = 1 , n_skip_beginning = 10 , n_skip_end = 5 , y_lim = ( - 0.01 , 0.01 ) ) : assert sma >= 1 derivatives = [ 0 ] * sma for i in range ( sma , len ( self . lrs ) ) : derivative = ( self . losses [ i ] - self . losses [ i - sma ] ) / sma derivatives . append ( derivative ) plt . ylabel ( "rate of loss change" ) plt . xlabel ( "learning rate (log scale)" ) plt . plot ( self . lrs [ n_skip_beginning : - n_skip_end ] , derivatives [ n_skip_beginning : - n_skip_end ] ) plt . xscale ( 'log' ) plt . ylim ( y_lim )
Plots rate of change of the loss function.
Plots rate of change of the loss function .
"""
        Plots rate of change of the loss function.
        Parameters:
            sma - number of batches for simple moving average to smooth out the curve.
            n_skip_beginning - number of batches to skip on the left.
            n_skip_end - number of batches to skip on the right.
            y_lim - limits for the y axis.
        """
self
sma
n_skip_beginning
n_skip_end
y_lim