Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEFECT] SyntheticHistory ROM Interpolation Broken #2389

Open
8 of 13 tasks
dylanjm opened this issue Oct 24, 2024 · 2 comments
Open
8 of 13 tasks

[DEFECT] SyntheticHistory ROM Interpolation Broken #2389

dylanjm opened this issue Oct 24, 2024 · 2 comments

Comments

@dylanjm
Copy link
Collaborator

dylanjm commented Oct 24, 2024

Thank you for the defect report

Defect Description

I am trying to train a SyntheticHistory ROM using a 6 sets of data. I want the data sets 0-4 to represent years 2024-2028 and then I want to interpolate between 2029-2054 using the 5 set of data.

When performing the training in RAVEN I get the following error:

Traceback (most recent call last):
  File "/Users/mcdodj/.local/share/pyenv/versions/3.10.0/bin/raven_framework", line 8, in <module>
    sys.exit(wheelMain())
  File "/Users/mcdodj/.local/share/pyenv/versions/3.10.0/lib/python3.10/site-packages/ravenframework/Driver.py", line 34, in wheelMain
    main(False)
  File "/Users/mcdodj/.local/share/pyenv/versions/3.10.0/lib/python3.10/site-packages/ravenframework/Driver.py", line 207, in main
    raven()
  File "/Users/mcdodj/.local/share/pyenv/versions/3.10.0/lib/python3.10/site-packages/ravenframework/Driver.py", line 160, in raven
    simulation.run()
  File "/Users/mcdodj/.local/share/pyenv/versions/3.10.0/lib/python3.10/site-packages/ravenframework/Simulation.py", line 901, in run
    self.executeStep(stepInputDict, stepInstance)
  File "/Users/mcdodj/.local/share/pyenv/versions/3.10.0/lib/python3.10/site-packages/ravenframework/Simulation.py", line 834, in executeStep
    stepInstance.takeAstep(stepInputDict)
  File "/Users/mcdodj/.local/share/pyenv/versions/3.10.0/lib/python3.10/site-packages/ravenframework/Steps/Step.py", line 317, in takeAstep
    self._localTakeAstepRun(inDictionary)
  File "/Users/mcdodj/.local/share/pyenv/versions/3.10.0/lib/python3.10/site-packages/ravenframework/Steps/RomTrainer.py", line 89, in _localTakeAstepRun
    ROM.train(inDictionary['Input'][0])
  File "/Users/mcdodj/.local/share/pyenv/versions/3.10.0/lib/python3.10/site-packages/ravenframework/Models/ROM.py", line 372, in train
    self.supervisedContainer[0].train(self.trainingSet)
  File "/Users/mcdodj/.local/share/pyenv/versions/3.10.0/lib/python3.10/site-packages/ravenframework/SupervisedLearning/ROMCollection.py", line 1644, in train
    self._interpolateSteps(tdict)
  File "/Users/mcdodj/.local/share/pyenv/versions/3.10.0/lib/python3.10/site-packages/ravenframework/SupervisedLearning/ROMCollection.py", line 1706, in _interpolateSteps
    newModel = self._interpolateSVL(trainingDict, exampleRoms, exampleModel, self._macroTemplate, numSegments, globalInterp, interps, y)
  File "/Users/mcdodj/.local/share/pyenv/versions/3.10.0/lib/python3.10/site-packages/ravenframework/SupervisedLearning/ROMCollection.py", line 1786, in _interpolateSVL
    params = exampleModel._roms[0].setGlobalRomFeatures(params, pivotValues)
  File "/Users/mcdodj/.local/share/pyenv/versions/3.10.0/lib/python3.10/site-packages/ravenframework/SupervisedLearning/SyntheticHistory.py", line 370, in setGlobalRomFeatures
    params = algo.setClusteringValues(settings, self._tsaTrainedParams[algo])
  File "/Users/mcdodj/.local/share/pyenv/versions/3.10.0/lib/python3.10/site-packages/ravenframework/TSA/Fourier.py", line 316, in setClusteringValues
    params[target]['intercept'] = value
KeyError: 'TOTALLOAD'

Steps to Reproduce

See attached files

Expected Behavior

I expect the interpolation to happen without issue.

Screenshots and Input Files

synthetic_history.zip

OS

MacOS

OS Version

14.7

Dependency Manager

PIP

For Change Control Board: Issue Review

  • Is it tagged with a type: defect or task?
  • Is it tagged with a priority: critical, normal or minor?
  • If it will impact requirements or requirements tests, is it tagged with requirements?
  • If it is a defect, can it cause wrong results for users? If so an email needs to be sent to the users.
  • Is a rationale provided? (Such as explaining why the improvement is needed or why current code is wrong.)

For Change Control Board: Issue Closure

  • If the issue is a defect, is the defect fixed?
  • If the issue is a defect, is the defect tested for in the regression test system? (If not explain why not.)
  • If the issue can impact users, has an email to the users group been written (the email should specify if the defect impacts stable or master)?
  • If the issue is a defect, does it impact the latest release branch? If yes, is there any issue tagged with release (create if needed)?
  • If the issue is being closed without a pull request, has an explanation of why it is being closed been provided?
@j-bryan
Copy link
Collaborator

j-bryan commented Oct 24, 2024

The issue appears to be in SyntheticHistory.py. When trying to set global ROM features, the loop
for algo in self._tsaAlgorithms: ... (line 365)
should probably be looping over self._tsaGlobalAlgorithms instead.

@GabrielSoto-INL
Copy link
Collaborator

Working on fixing what Jacob just described. But I think the actual issue happens when there are multiple algorithm nodes with different targets (e.g., two <fourier> nodes, one for target_0 and one for target_1). Seems I had implemented a fix but it's commented out on Line 368... unsure why that is, I will re-implemented in another branch with testing to cover that error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants