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

New representativity calculations post processor #2058

Open
wants to merge 366 commits into
base: devel
Choose a base branch
from

Conversation

Jimmy-INL
Copy link
Collaborator

@Jimmy-INL Jimmy-INL commented Feb 7, 2023


Pull Request Description

What issue does this change request address? (Use "#" before the issue to link it, i.e., #42.)

Closes #1650 and #1546
This PR will add a representativity calculations post-processor. This post-processor can be used to calculation similarities between prototype and full scale models/experiments, perform input data adjustment, and uncertainty reductions for full scale models/experiments.

Future development will enable this post-processor to accept probability weight coming from other Samplers, such as grid/LHS. See #2196

What are the significant changes in functionality due to this change request?

Implements the representativity theory through bias factors for validation purposes

For Change Control Board: Change Request Review

The following review must be completed by an authorized member of the Change Control Board.

  • 1. Review all computer code.
  • 2. If any changes occur to the input syntax, there must be an accompanying change to the user manual and xsd schema. If the input syntax change deprecates existing input files, a conversion script needs to be added (see Conversion Scripts).
  • 3. Make sure the Python code and commenting standards are respected (camelBack, etc.) - See on the wiki for details.
  • 4. Automated Tests should pass, including run_tests, pylint, manual building and xsd tests. If there are changes to Simulation.py or JobHandler.py the qsub tests must pass.
  • 5. If significant functionality is added, there must be tests added to check this. Tests should cover all possible options. Multiple short tests are preferred over one large test. If new development on the internal JobHandler parallel system is performed, a cluster test must be added setting, in XML block, the node <internalParallel> to True.
  • 6. If the change modifies or adds a requirement or a requirement based test case, the Change Control Board's Chair or designee also needs to approve the change. The requirements and the requirements test shall be in sync.
  • 7. The merge request must reference an issue. If the issue is closed, the issue close checklist shall be done.
  • 8. If an analytic test is changed/added is the the analytic documentation updated/added?
  • 9. If any test used as a basis for documentation examples (currently found in raven/tests/framework/user_guide and raven/docs/workshop) have been changed, the associated documentation must be reviewed and assured the text matches the example.

moosebuild added 30 commits September 27, 2017 14:15
Copy link
Collaborator

@mandd mandd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comments


@article{Epiney1,
title={A Systematic Approach to Inform Experiment Design Through Modern Modeling and Simulation Methods},
author={Epiney, A and Rabiti, C and Davis, C},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this reference does not indicate if it is a journal of conf proceeding

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@ In, None
@ Out, stat, object, Basic Statistic PostProcessor Object
"""
from .. import factory as ppFactory # delay import to allow definition
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this import be moved to the beginning of the file?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just reverted the change. It can not moved to the beginning of the file since the class has not been initialized yet. We need to first initialize the PP class then we can import the factory.

sensMatr[i, j] = sensDict[senName][0]* datasets[inpVar].meanValue / datasets[outVar].meanValue
return sensMatr

def _computeMoments(self, datasets, features, targets):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have something already developed that does the same functionality?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do have similar functions inside Basic Statistics PP. However, it seems there is a more general issue in the developed post-processor. The probability weight is not considered in some functions. For example, the _computeMoments function. I will open an issue for this to allow this PP to accept probability weight in general.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see issue #2196

@wangcj05
Copy link
Collaborator

@joshua-cogliati-inl It seems there is another issue with windows installation:

Could not solve for environment specs

The following packages are incompatible

├─ python 3.8**  is requested and can be installed;

└─ truststore is not installable because there are no viable options

   ├─ truststore [0.7.0|0.8.0] would require

   │  └─ python >=3.10  but there are no viable options

   │     ├─ python [3.11.0|3.11.1|...|3.11.6] conflicts with any installable versions previously reported;

   │     ├─ python [3.10.0|3.10.1|...|3.10.9] conflicts with any installable versions previously reported;

   │     ├─ python 3.12.0 conflicts with any installable versions previously reported;

   │     └─ python 3.12.0rc3 would require

   │        └─ _python_rc, which does not exist (perhaps a missing channel);

   ├─ truststore 0.8.0 would require

   │  └─ python >=3.10,<3.11.0a0 , which conflicts with any installable versions previously reported;

   └─ truststore 0.8.0 would require

      └─ python >=3.11,<3.12.0a0 , which conflicts with any installable versions previously reported.


ERROR: exiting with code 1

@moosebuild
Copy link

Job Mingw Test on 645644e : invalidated by @wangcj05

issue with installation, truststore is not installable because there are no viable options

@moosebuild
Copy link

Job Test qsubs sawtooth on 645644e : invalidated by @wangcj05

@moosebuild
Copy link

Job Mingw Test on 645644e : invalidated by @wangcj05

@moosebuild
Copy link

Job Test qsubs sawtooth on 645644e : invalidated by @wangcj05

@moosebuild
Copy link

Job Test qsubs sawtooth on 6d7d77b : invalidated by @joshua-cogliati-inl

failed in set python environment

@moosebuild
Copy link

Job Test qsubs sawtooth on 548f9f7 : invalidated by @wangcj05

@wangcj05
Copy link
Collaborator

wangcj05 commented Nov 7, 2023

@mandd FYI, the tests are green for this PR. Please let me know if you have additional comments.

@moosebuild
Copy link

All jobs on 548f9f7 : invalidated by @wangcj05

retesting

@wangcj05
Copy link
Collaborator

wangcj05 commented Jan 3, 2024

Hi @mandd, I think this PR is ready for you to take another review. Could you take a look in the next two weeks?

@moosebuild
Copy link

Job Test qsubs sawtooth on 548f9f7 : invalidated by @wangcj05

directory exists issue

@moosebuild
Copy link

Job Test qsubs sawtooth on 548f9f7 : invalidated by @wangcj05

environment issue

@moosebuild
Copy link

Job Test qsubs sawtooth on 548f9f7 : invalidated by @wangcj05

@moosebuild
Copy link

All jobs on 548f9f7 : invalidated by @wangcj05

retesting

@moosebuild
Copy link

Job Test qsubs sawtooth on 548f9f7 : invalidated by @wangcj05

Diff tests/cluster_tests/test_mpiqsub_nosplit, not related to this PR

@wangcj05
Copy link
Collaborator

@mandd @PaulTalbot-INL @dylanjm @yoshiurr-INL @GabrielSoto-INL Can any of you review this PR? Both Josh and I have contributions to this PR.

@moosebuild
Copy link

Job Test Ubuntu 18 PIP on 4ca3eb7 : invalidated by @joshua-cogliati-inl

restarted civet

Copy link
Collaborator

@PaulTalbot-INL PaulTalbot-INL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several requests and comments for review.

\item \xmlNode{Targets}, \xmlDesc{comma separated string, required field}, contains a comma separated list of
targets. \nb Each target is paired with a feature listed in xml node \xmlNode{Features}. In this case, the
number of targets should be equal to the number of features.
\item \xmlNode{prototypeOutputs}, \xmlDesc{comma separated string, required field}, specifies the names of the prototype outputs.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this sufficient description to understand what we mean by prototype outputs? I don't feel like I have a good understanding, based solely on this description.

\begin{itemize}
\item \xmlAttr{type}, \xmlDesc{optional string attribute}, options are `ratio' or `raw\_values'. The default is `ratio'.
\end{itemize}
\item \xmlNode{multiOutput}, \xmlDesc{string, required field}, to extract raw values for the HistorySet. The user must use ‘raw values’ for the full set of metrics’ calculations to be dumped.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The grammar here could be touched up. What does "to extract raw values from the History Set" mean?

doc/user_manual/PostProcessors/Validation.tex Show resolved Hide resolved
three versions of PCM so far: `Static', `Snapshot', and `Tdep'. Static PCM is for static problem, and Snapshot PCM
and Tdep PCM are for time-dependent problem.
\paragraph{Representativity}
The \textbf{Representativity} post-processor is one of three \textbf{Validation} post-processors, in fact there is a
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a period after "post-processors"? "in fact there is" is a strange statement after a comma.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description also seems a little focused on a software engineer's understanding of this interface. Can we make it more user-centric?

%form a good representation of a target model. Two, if a set of experiments can represent a target model and can
%claim a full coverage of the design space and scenarios, and three, if the available set of experiments are not
%enough to declare coverage what are the remaining experiments required in order to achieve full coverage and
%increase the representativity/bias factor.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep or remove this commented description?

@ In, UmesVar, np.array, variance covariance matrix of the measurables in the error space
@ In, normalizedSen, np.array, the normalized sensitivity matrix
@ Out, parTilde, np.array, the corrected parameters
@ Out, parTildeVar, np.array, the variance covariance matrix of the corrected parameters (uncertainty in the corrected parameters)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like this name changed

"""
# Compute adjusted target #eq 71
UtarTilde = normalizedSenTar @ UparVar @ normalizedSenExp.T @ np.linalg.pinv(normalizedSenExp @ UparVar @ normalizedSenTar.T + UmesVar) @ Umes
# back transform to parameters
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment resolved?

@@ -187,7 +187,7 @@ def localFinalizeActualSampling(self, jobObject, model, myInput):
@ Out, None
"""
if self.counter > 1:
output = self.basicStatPP.run(self._targetEvaluation)
output = self.basicStatPP._runLegacy(self._targetEvaluation)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this resolved?

<variable name="p2">
<distribution>dist2</distribution>
</variable>
<constant name="e1">2,-3</constant>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved?

<variable name="p2">
<distribution>dist2</distribution>
</variable>
<constant name="o1">2,-3</constant>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved?

@wangcj05 wangcj05 changed the title New rep congjian New representativity calculations post processor Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TASK] Adding representativity PP for validation
7 participants