romspline/cross_validation.py
def plot_monte_carlo_errors(self, x=None, n=20, axes='plot', ax=None, show=True, color='k', marker='.'):
    """Plot all the Monte Carlo K-fold cross-validation errors
    versus the samples at which the error is recorded 
    in each of the validation partitions.
    
    Input
    -----
      x      -- samples
                (default None)
      n      -- number of bins if plotting a histogram
      axes   -- axis scales for plotting
                (default 'plot')
      ax     -- matplotlib plot/axis object
                (default None)
      show   -- display the plot?
                (default True)
      color  -- data color
                (default 'k')
      marker -- data marker style
                (default '.')
    """
    
    if self._made and state._MATPLOTLIB:
      
      self.stats()
      
      if ax is None:
        fig, ax = plt.subplots(nrows=1, ncols=1)
      
      # Flatten args and errors arrays
      # generated from MonteCarloKFold method
      args = np.asarray(self.all_args).flatten()
      errors = np.asarray(self.all_errors).flatten()
      
      # Set up x-data if not plotting a histogram
      if axes != 'hist':
        ax.set_ylabel('Validation errors')
        if x is None:
          xplot = args
          ax.set_xlabel('Data array indexes')
        else:
          xplot = x[args]
          ax.set_xlabel('$x$')
      
      if axes == 'semilogy':
        ax.semilogy(xplot, errors, color=color, marker=marker, linestyle='')
      elif axes == 'plot':
        ax.plot(xplot, errors, color=color, marker=marker, linestyle='')
        ax.ticklabel_format(axis='y', style='sci', scilimits=(0,0))
      elif axes == 'hist':
        ax.hist(np.log10(errors), n, alpha=0.3, color=color)
        ax.set_xlabel('$\\log_{10}$(Validation errors)')
        ax.set_ylabel('Occurrence')
      
      if show:  # Display the plot
        plt.show()
      else:     # Otherwise, return plot objects for editing the plot in the future
        if ax is None:
          return fig, ax
        else:
          return ax
      
    else:
      print("No data attributes to plot.")
Plot all the Monte Carlo K-fold cross-validation errors
    versus the samples at which the error is recorded 
    in each of the validation partitions.
    
    Input
    -----
      x      -- samples
                (default None)
      n      -- number of bins if plotting a histogram
      axes   -- axis scales for plotting
                (default 'plot')
      ax     -- matplotlib plot/axis object
                (default None)
      show   -- display the plot?
                (default True)
      color  -- data color
                (default 'k')
      marker -- data marker style
                (default '.')
    
Plot all the Monte Carlo K-fold cross-validation errors
versus the samples at which the error is recorded
in each of the validation partitions.

Input


Plot all the Monte Carlo K - fold cross - validation errors versus the samples at which the error is recorded in each of the validation partitions . Input
def plot_monte_carlo_errors(self, x=None, n=20, axes='plot', ax=None, show=True, color='k', marker='.'):
    if self._made and state._MATPLOTLIB:
      self.stats()
      if ax is None:
        fig, ax = plt.subplots(nrows=1, ncols=1)
      args = np.asarray(self.all_args).flatten()
      errors = np.asarray(self.all_errors).flatten()
      if axes != 'hist':
        ax.set_ylabel('Validation errors')
        if x is None:
          xplot = args
          ax.set_xlabel('Data array indexes')
        else:
          xplot = x[args]
          ax.set_xlabel('$x$')
      if axes == 'semilogy':
        ax.semilogy(xplot, errors, color=color, marker=marker, linestyle='')
      elif axes == 'plot':
        ax.plot(xplot, errors, color=color, marker=marker, linestyle='')
        ax.ticklabel_format(axis='y', style='sci', scilimits=(0,0))
      elif axes == 'hist':
        ax.hist(np.log10(errors), n, alpha=0.3, color=color)
        ax.set_xlabel('$\\log_{10}$(Validation errors)')
        ax.set_ylabel('Occurrence')
      if show:  
        plt.show()
      else:     
        if ax is None:
          return fig, ax
        else:
          return ax
    else:
      print("No data attributes to plot.")
def plot_monte_carlo_errors ( self , x = None , n = 20 , axes = 'plot' , ax = None , show = True , color = 'k' , marker = '.' ) : if self . _made and state . _MATPLOTLIB : self . stats ( ) if ax is None : fig , ax = plt . subplots ( nrows = 1 , ncols = 1 ) args = np . asarray ( self . all_args ) . flatten ( ) errors = np . asarray ( self . all_errors ) . flatten ( ) if axes != 'hist' : ax . set_ylabel ( 'Validation errors' ) if x is None : xplot = args ax . set_xlabel ( 'Data array indexes' ) else : xplot = x [ args ] ax . set_xlabel ( '$x$' ) if axes == 'semilogy' : ax . semilogy ( xplot , errors , color = color , marker = marker , linestyle = '' ) elif axes == 'plot' : ax . plot ( xplot , errors , color = color , marker = marker , linestyle = '' ) ax . ticklabel_format ( axis = 'y' , style = 'sci' , scilimits = ( 0 , 0 ) ) elif axes == 'hist' : ax . hist ( np . log10 ( errors ) , n , alpha = 0.3 , color = color ) ax . set_xlabel ( '$\\log_{10}$(Validation errors)' ) ax . set_ylabel ( 'Occurrence' ) if show : plt . show ( ) else : if ax is None : return fig , ax else : return ax else : print ( "No data attributes to plot." )
Plot all the Monte Carlo K-fold cross-validation errors
versus the samples at which the error is recorded
in each of the validation partitions.
Plot all the Monte Carlo K - fold cross - validation errors versus the samples at which the error is recorded in each of the validation partitions .
"""Plot all the Monte Carlo K-fold cross-validation errors
    versus the samples at which the error is recorded 
    in each of the validation partitions.
    
    Input
    -----
      x      -- samples
                (default None)
      n      -- number of bins if plotting a histogram
      axes   -- axis scales for plotting
                (default 'plot')
      ax     -- matplotlib plot/axis object
                (default None)
      show   -- display the plot?
                (default True)
      color  -- data color
                (default 'k')
      marker -- data marker style
                (default '.')
    """ # Flatten args and errors arrays # generated from MonteCarloKFold method # Set up x-data if not plotting a histogram # Display the plot # Otherwise, return plot objects for editing the plot in the future
self
x
n
axes
ax
show
color
marker