cross_validate_pce_degree

pyapprox.approximate.cross_validate_pce_degree(pce, train_samples, train_vals, min_degree=1, max_degree=3, hcross_strength=1, cv=10, solver_type='lasso_lars', verbosity=0)[source]

Use cross validation to find the polynomial degree which best fits the data. A polynomial is constructed for each degree and the degree with the highest cross validation score is returned.

Parameters
train_samplesnp.ndarray (nvars,nsamples)

The inputs of the function used to train the approximation

train_valsnp.ndarray (nvars,nsamples)

The values of the function at train_samples

min_degreeinteger

The minimum degree to consider

min_degreeinteger

The maximum degree to consider. All degrees in range(min_degree,max_deree+1) are considered

hcross_strengthfloat

The strength of the hyperbolic cross index set. hcross_strength must be in (0,1]. A value of 1 produces total degree polynomials

cvinteger

The number of cross validation folds used to compute the cross validation error

solver_typestring

The type of regression used to train the polynomial

  • ‘lasso_lars’

  • ‘lars’

  • ‘lasso’

  • ‘omp’

verbosityinteger

Controls the amount of information printed to screen

Returns
resultpyapprox.approximate.ApproximateResult

Result object with the following attributes

approxpyapprox.multivariate_polynomials.PolynomialChaosExpansion

The PCE approximation

scoresnp.ndarray (nqoi)

The best cross validation score for each QoI

degreesnp.ndarray (nqoi)

The best degree for each QoI