sebaba/utils.py
def plot_cost_function(cost = None, width = 10.0, height = 6.5):
    """
    Function to plot the cost function from an optimization algorithm e.g. gradient descent

    Parameters
    --------------------------------------------------
        cost  : ndarray of shape (iterations, 1)
        width : float plot width in inches (default: 10.0)
        height: float plot height in inches (default: 6.5)

    Returns
    --------------------------------------------------
        figure: None displays the cost function plot and returns
    """
    plt.rcParams.update(params)
    fig, ax = plt.subplots(figsize = (width, height))
    ax = sns.lineplot(x = range(len(cost)), y = cost, scalex = True, scaley = True)
    ax.axhline(y = min(cost), color = "r", linewidth = 0.5, linestyle = "--")
    ax.set_ylabel("Cost $J(\\theta)$")
    ax.set_xlabel("Number of Iterations $(t)$")
    ax.xaxis.set_major_locator(tkr.MaxNLocator(integer = True))
    ax.margins(0.05)
    ax.axis("tight")
    ax.grid(True)
    fig.tight_layout()

    plt.show()

    Function to plot the cost function from an optimization algorithm e.g. gradient descent

    Parameters
    --------------------------------------------------
        cost  : ndarray of shape (iterations, 1)
        width : float plot width in inches (default: 10.0)
        height: float plot height in inches (default: 6.5)

    Returns
    --------------------------------------------------
        figure: None displays the cost function plot and returns
    
Function to plot the cost function from an optimization algorithm e.g. gradient descent
Parameters



Returns

None displays the cost function plot and returns
Function to plot the cost function from an optimization algorithm e . g . gradient descent Parameters Returns None displays the cost function plot and returns
def plot_cost_function(cost = None, width = 10.0, height = 6.5):
    plt.rcParams.update(params)
    fig, ax = plt.subplots(figsize = (width, height))
    ax = sns.lineplot(x = range(len(cost)), y = cost, scalex = True, scaley = True)
    ax.axhline(y = min(cost), color = "r", linewidth = 0.5, linestyle = "--")
    ax.set_ylabel("Cost $J(\\theta)$")
    ax.set_xlabel("Number of Iterations $(t)$")
    ax.xaxis.set_major_locator(tkr.MaxNLocator(integer = True))
    ax.margins(0.05)
    ax.axis("tight")
    ax.grid(True)
    fig.tight_layout()
    plt.show()
def plot_cost_function ( cost = None , width = 10.0 , height = 6.5 ) : plt . rcParams . update ( params ) fig , ax = plt . subplots ( figsize = ( width , height ) ) ax = sns . lineplot ( x = range ( len ( cost ) ) , y = cost , scalex = True , scaley = True ) ax . axhline ( y = min ( cost ) , color = "r" , linewidth = 0.5 , linestyle = "--" ) ax . set_ylabel ( "Cost $J(\\theta)$" ) ax . set_xlabel ( "Number of Iterations $(t)$" ) ax . xaxis . set_major_locator ( tkr . MaxNLocator ( integer = True ) ) ax . margins ( 0.05 ) ax . axis ( "tight" ) ax . grid ( True ) fig . tight_layout ( ) plt . show ( )
Function to plot the cost function from an optimization algorithm e.g.
Function to plot the cost function from an optimization algorithm e . g .
"""
    Function to plot the cost function from an optimization algorithm e.g. gradient descent

    Parameters
    --------------------------------------------------
        cost  : ndarray of shape (iterations, 1)
        width : float plot width in inches (default: 10.0)
        height: float plot height in inches (default: 6.5)

    Returns
    --------------------------------------------------
        figure: None displays the cost function plot and returns
    """
cost
width
height