CombinationSparseGrid

class pyapprox.surrogates.CombinationSparseGrid(num_vars, basis_type='barycentric')[source]

Bases: SubSpaceRefinementManager

Adaptive sparse grid that uses the combination technique.

Methods Summary

__call__(samples[, return_grad])

config values are ignored.

add_new_subspaces(new_subspace_indices)

evaluate_at_interrogation_samples()

Evaluate the sparse grid at self.canonical_interrogation_samples.

evaluate_using_all_data(samples)

Evaluate sparse grid using all subspace indices including active subspaces.

get_samples()

get_subspace_samples(subspace_index, ...)

Must be implemented by derived class This function should only be called when updating grid not interogating grid

moments()

moments_(smolyak_coefficients)

refine_and_add_new_subspaces(...)

save(filename)

set_interrogation_samples(samples)

Set samples which are used to evaluate a sparse grid repeatedly.

set_univariate_rules(univariate_quad_rule[, ...])

setup(function, config_variables_idx, ...[, ...])

Methods Documentation

__call__(samples, return_grad=False)[source]

config values are ignored. The sparse grid just returns its best approximation of the highest fidelity model. TODO: consider enforcing that samples do not have configure variables

add_new_subspaces(new_subspace_indices)[source]
evaluate_at_interrogation_samples()[source]

Evaluate the sparse grid at self.canonical_interrogation_samples.

Note, this fuction only uses subspaces which are not active

evaluate_using_all_data(samples)[source]

Evaluate sparse grid using all subspace indices including active subspaces. __call__ only uses subspaces which are not active

get_samples()[source]
get_subspace_samples(subspace_index, unique_poly_indices)[source]

Must be implemented by derived class This function should only be called when updating grid not interogating grid

moments()[source]
moments_(smolyak_coefficients)[source]
refine_and_add_new_subspaces(best_active_subspace_index)[source]
save(filename)[source]
set_interrogation_samples(samples)[source]

Set samples which are used to evaluate a sparse grid repeatedly. If provided each time a subspace is added the subspace is evaluated at these points so that when self.evaluate_at_interrogation_samples is called no major computations are required. Note the reduced time complexity requires more storage

Parameters:
samplesnp.ndarray (num_vars) or (num_vars-num_config_vars)

Samples at which to evaluate the sparae grid. If config values are provided they are ignored.

set_univariate_rules(univariate_quad_rule, max_level=2)[source]
setup(function, config_variables_idx, refinement_indicator, admissibility_function, univariate_growth_rule, univariate_quad_rule, variable_transformation=None, config_var_trans=None, cost_function=None, work_qoi_index=None, unique_quadrule_indices=None, verbose=0)[source]