vak.learncurve.curvefit.fit_learning_curve#

vak.learncurve.curvefit.fit_learning_curve(train_set_size, error_test, error_train=None, pinit=(1.0, -1.0), funcs=1)[source]#

returns parameters to predict learning curve as a power function with the form y = a + b * x**alpha where x is the training set size, i.e., the independent variable

You provide the function with your data: a vector of the training set sizes you used, and arrays of the error you found when training models with those training sets. The function then returns the fit parameters. Based on [1]_.

Parameters:
  • train_set_size (ndarray) – vector of m integers representing number of samples in training sets, should increase monotonically

  • error_test (ndarray) – m x n array of errors where error_train[m,n] is the error measured for replicate n of training a model with train_set_size[m] samples. Error is measured on on a test set separate from the training set.

  • error_train (ndarray) – same as error_test except the error is measured on the training set. Default is None.

  • pinint (list) – initial guess for parameters b and alpha, default is [1.0, -1.0]

  • funcs (int) – number of functions to fit, default is 1. If funcs==1 and only test error is passed as an argument, a power function is fit just to the test error If funcs==1 and both test error and train error are passed as arguments, it is assumed the train error and test error can be fit with same exponent and scaling parameter. If funcs==2, both test error and train error must be passed and each is fit with separate exponent and scaling parameters, but both share an extra parameter which is the asymptote.

Returns:

  • a (float) – asymptotic value of error predicted for infinite training data

  • b (float) – scaling parameter of power function

  • alpha (float) – exponent parameter of power function

  • ** if funcs = 2 ****

  • c (float) – scaling parameter of power function fit to train error (b fits test error)

  • beta (float) – exponent parameter of power function fit to train error (alpha fits test error)

  • .. [1] Cortes, Corinna, et al.

  • ”Learning curves (Asymptotic values and rate of convergence.”)

  • Advances in Neural Information Processing Systems. 1994.