Options
All
  • Public
  • Public/Protected
  • All
Menu

ml-pipe

Index

Functions

  • generalizedDegreesOfFreedom(X: Matrix, Y: Matrix, estimator: Estimator | Pipeline, epsilon?: number, numberOfDraws?: number): Promise<number>
  • Computes generalized degrees of freedom as originally proposed in [1]. Here, we use a Monte Carlo approximation, as described in [2]

    Note that the model is retrained multiple times, which can take time. Also, the model state changes due to this process.

    [1] Ye, Jianming. “On Measuring and Correcting the Effects of Data Mining and Model Selection.” Journal of the American Statistical Association, vol. 93, no. 441, 1998, pp. 120–31, https://doi.org/10.2307/2669609. Accessed 3 May 2022. [2] Gao, Tianxiang, Vladimir Jojic. ‘Degrees of Freedom in Deep Neural Networks’. arXiv preprint arXiv: Arxiv-1603. 09260 (2016): n. pag. Print.

    export

    Parameters

    • X: Matrix

      Input data (Features)

    • Y: Matrix

      Input data (Labels)

    • estimator: Estimator | Pipeline

      Estimator to use

    • epsilon: number = 1e-3

      Epsilon of the Tailor expansion

    • numberOfDraws: number = 5

      number of Monte Carlo draws

    Returns Promise<number>

    {Promise}

  • meanAbsoluteError(y: Matrix, yHat: Matrix): number
  • meanSquaredError(y: Matrix, yHat: Matrix): number
  • trainTestSplit(x: Matrix, y: Matrix, options?: TrainTestSplitOptions): { testX: Matrix; testY: Matrix; trainX: Matrix; trainY: Matrix }
  • Split a dataset into a train and test set.

    export

    Parameters

    Returns { testX: Matrix; testY: Matrix; trainX: Matrix; trainY: Matrix }

    • xTrain xTest, yTrain yTest
    • testX: Matrix
    • testY: Matrix
    • trainX: Matrix
    • trainY: Matrix