Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
![build](https://img.shields.io/github/actions/workflow/status/eckelsjd/amisc/deploy.yml?logo=github)
![docs](https://img.shields.io/github/actions/workflow/status/eckelsjd/amisc/docs.yml?logo=materialformkdocs&logoColor=%2523cccccc&label=docs)
![tests](https://img.shields.io/github/actions/workflow/status/eckelsjd/amisc/tests.yml?logo=github&logoColor=%2523cccccc&label=tests)
![Code Coverage](https://img.shields.io/badge/coverage-89%25-yellowgreen?logo=codecov)
![Code Coverage](https://img.shields.io/badge/coverage-86%25-yellowgreen?logo=codecov)
[![Algorithm description](https://img.shields.io/badge/DOI-10.1002/nme.6958-blue)](https://doi.org/10.1002/nme.6958)

Efficient framework for building surrogates of multidisciplinary systems using the adaptive multi-index stochastic collocation ([AMISC](https://onlinelibrary.wiley.com/doi/full/10.1002/nme.6958)) technique.
Expand Down
18 changes: 13 additions & 5 deletions src/amisc/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
from pydantic import BaseModel, ConfigDict, ValidationInfo, field_validator
from typing_extensions import TypedDict

from amisc.interpolator import Interpolator, InterpolatorState, Lagrange
from amisc.interpolator import GPR, Interpolator, InterpolatorState, Lagrange
from amisc.serialize import PickleSerializable, Serializable, StringSerializable, YamlSerializable
from amisc.training import SparseGrid, TrainingData
from amisc.training import SparseGrid, TrainingData, UncertaintySampling
from amisc.typing import COORDS_STR_ID, LATENT_STR_ID, Dataset, MultiIndex
from amisc.utils import (
_get_yaml_path,
Expand Down Expand Up @@ -1213,8 +1213,17 @@ def activate_index(self, alpha: MultiIndex, beta: MultiIndex, model_dir: str | P
# Training data is the same for all surrogate fidelity indices, given constant data fidelity
design_list.append([])
continue

design_coords, design_pts = self.training_data.refine(a, b[:len(self.data_fidelity)],
if isinstance(self.interpolator, GPR) and isinstance(self.training_data, UncertaintySampling):
states = list(self.misc_states)
match_state = [tup for tup in states if tup[0] == a]
if match_state:
best_state = max(match_state, key=lambda x: sum(x[1]))[2].regressor.named_steps['gpr']
else:
best_state = None
design_coords, design_pts = self.training_data.refine(a, b[:len(self.data_fidelity)],
domains,best_state, weight_fcns)
else:
design_coords, design_pts = self.training_data.refine(a, b[:len(self.data_fidelity)],
domains, weight_fcns)
design_pts, fc = to_model_dataset(design_pts, self.inputs, del_latent=True, **field_coords)

Expand Down Expand Up @@ -1301,7 +1310,6 @@ def activate_index(self, alpha: MultiIndex, beta: MultiIndex, model_dir: str | P
# Only for initial index which didn't come from the candidate set
self.update_misc_coeff(IndexSet(s), index_set='test')
self.active_set.update(s)

self.update_misc_coeff(neighbors, index_set='test') # neighbors will only ever pass through here once
self.candidate_set.update(neighbors)

Expand Down
Loading