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

Closes #673 #674

Merged
merged 20 commits into from
Jul 20, 2018
Merged

Closes #673 #674

merged 20 commits into from
Jul 20, 2018

Conversation

alfoa
Copy link
Collaborator

@alfoa alfoa commented Jun 4, 2018


Pull Request Description

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

Closes #673
Closes #695
Closes #583
Closes #697

What are the significant changes in functionality due to this change request?
  • Fixed the pickling and loading for DMD-based ROMs.
  • Added a test in the DMD
  • Fixed SingleRun prefix with HDF5 and modified a test
  • Fixed manual for optimizer
  • Fixed pivotParameter error for TimeDependent ROMs

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?

Checklist review by @wangc on July 20, 2018

@alfoa alfoa requested a review from wangcj05 June 4, 2018 20:17
Copy link
Collaborator

@wangcj05 wangcj05 left a comment

Choose a reason for hiding this comment

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

In addition to the comment, I think we also need to add the unit tests for the marginal and inverse marginal distributions.

@@ -184,6 +184,15 @@ class BasicMultiDimensionalInverseWeight: public virtual BasicDistributionND
return value;
}

double marginal(double x, int dimension){
Copy link
Collaborator

Choose a reason for hiding this comment

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

docstring

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added

@@ -156,14 +156,16 @@
if (_cdf_provided){
throwError("BasicMultiDimensionalCartesianSpline Distribution error: inverseMarginal calculation not available if CDF provided");
}else{
value = _interpolator.splineCartesianInverseMarginal(f, dimension, 0.01);
value = _interpolator.splineCartesianInverseMarginal(f, dimension, 1.e-6);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we remove the coded value, and add a variable to control that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes this is the final plan

}
}else
throwError("BasicMultiDimensionalCartesianSpline Distribution error: CDF value for inverse marginal distribution is above 1.0");

return value;
}



Copy link
Collaborator

Choose a reason for hiding this comment

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

remove extra line?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed

@@ -3229,6 +3229,15 @@ def __init__(self,messageHandler,**kwargs):
if self.pivotParameterID not in self.target:
self.raiseAnError(IOError,"The pivotParameter "+self.pivotParameterID+" must be part of the Target space!")

def __setstate__(self, newstate):
Copy link
Collaborator

Choose a reason for hiding this comment

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

newstate or newState?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@alfoa
Copy link
Collaborator Author

alfoa commented Jun 4, 2018

Comments addressed + added unit test

Copy link
Collaborator

@wangcj05 wangcj05 left a comment

Choose a reason for hiding this comment

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

minor comment, the docstring of variable in marginalDistribution and inverseMarginalDistribuation, may need to add more informative statement, associate the variable id to the dimension in the nd distribution, which will be more clear for the future developer.

@wangcj05
Copy link
Collaborator

wangcj05 commented Jun 5, 2018

The unit test that you created is failed:

framework/unit_tests/Distributions.Distributions: checking answer MultiVariate inverseMarginalDim1(0.5) 2999.99999881 != 3000.419
framework/unit_tests/Distributions.Distributions: checking answer MultiVariate inverseMarginalDim2(0.5) 2499.97185556 != 2500.044

You may need to update your checked values.

@alfoa
Copy link
Collaborator Author

alfoa commented Jun 5, 2018

ok fixed unit test and better docstrings

@ Out, None
"""
if abs(value - expected) > tol:
diff = abs(value - expected) if not relative else abs(value - expected)/expected
Copy link
Collaborator

Choose a reason for hiding this comment

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

check expected!=0

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@wangcj05
Copy link
Collaborator

wangcj05 commented Jun 5, 2018

Tests are failed, how do you determine the checked value for the unit tests? are they depend on running systems?

@alfoa
Copy link
Collaborator Author

alfoa commented Jun 5, 2018

Well....I am simply pushing the value I get from the mac... The correct value should be 0.5 but unfortunately since the hard-coded discretizations and tolerances I am not able to get it.
I will relax the Multivariate peak to remove the wiggles of the spline.

@moosebuild
Copy link

Job Mingw Test on 805d030 : canceled by @alfoa

the machine is super slow

@moosebuild
Copy link

Job Mingw Test on 805d030 : invalidated by @alfoa

1 similar comment
@moosebuild
Copy link

Job Mingw Test on 805d030 : invalidated by @alfoa

@moosebuild
Copy link

Job Mingw Test on 805d030 : invalidated by @PaulTalbot-INL

Invalidating due to civet restart with new libraries.

@moosebuild
Copy link

Job Mingw Test on 805d030 : invalidated by @alfoa

1 similar comment
@moosebuild
Copy link

Job Mingw Test on 805d030 : invalidated by @alfoa

@PaulTalbot-INL
Copy link
Collaborator

For the record, since we have to force library versions on Windows manually, until #668 merges the libraries will not pass on other MRs. Just as a reminder.

@moosebuild
Copy link

Job Mingw Test on 805d030 : invalidated by @alfoa

@alfoa
Copy link
Collaborator Author

alfoa commented Jul 20, 2018

@wangcj05 can you review this again? It should be green now

@alfoa alfoa mentioned this pull request Jul 20, 2018
10 tasks
Copy link
Collaborator

@wangcj05 wangcj05 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

try:
os.mkdir(currentWorkingDirectory)
except OSError:
self.raiseAWarning('current working dir '+currentWorkingDirectory+' already exists, this might imply deletion of present files')
self.raiseAWarning('current working dir '+currentWorkingDirectory+' already exists, ' +
'this might imply deletion of present files')
Copy link
Collaborator

Choose a reason for hiding this comment

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

better to use , instead of +, but it is fine if not change it.

self.raiseAWarning('As prescribed in the input, trying to re-submit the job "'+
finishedJob.identifier+'". Trial '+
str(self.failureHandling['jobRepetitionPerformed'][finishedJob.identifier]) +
'/'+str(self.failureHandling['repetitions']))
Copy link
Collaborator

Choose a reason for hiding this comment

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

ok here, but better to use ,

self.failureHandling['jobRepetitionPerformed'][finishedJob.identifier] += 1
else:
#add run to a pool that can be sent to the sampler later
self.failedRuns.append(copy.copy(finishedJob))
self.raiseAWarning('The job "'+finishedJob.identifier+'" has been submitted '+ str(self.failureHandling['repetitions'])+' times, failing all the times!!!')
self.raiseAWarning('The job "'+finishedJob.identifier+'" has been submitted '+
str(self.failureHandling['repetitions'])+' times, failing all the times!!!')
Copy link
Collaborator

Choose a reason for hiding this comment

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

same as before

@@ -2210,6 +2210,9 @@ def __init__(self,messageHandler,**kwargs):
"""
supervisedLearning.__init__(self,messageHandler,**kwargs)
name = self.initOptionDict.pop('name','')
if 'pivotParameter' in self.initOptionDict:
# remove pivot parameter if present
self.initOptionDict.pop("pivotParameter")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I did not get here. You changed the way to retrieve the pivotParameter in the LearningGate, but here you start to remove it. why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

because the pivotParameter is needed internally for all the TimeDep ROMs, but not for the SKLearn ROMs., since we pass directly the dictionary into the SKL constructors (that complains in case a variable is not recognized (e.g. pivotParameter)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Got it.

@wangcj05
Copy link
Collaborator

This PR looks good to me. I will go through the checklist.

@alfoa
Copy link
Collaborator Author

alfoa commented Jul 20, 2018

Proposed email:

Dear users,
we recently realized that there was a mismatch between the user manual and the Code regarding the GradientBased optimizers.
The code was expecting the following two parameters:

  • gainGrowthFactor and gainShrinkFactor

but in the manual they were called gainGrowthSize and gainShrinkSize.

In addition:

  • the DMD-based ROMs were not serializable. This was not allowing the usage of the python parallelization with these ROMs.
  • the HDF5 databases were not usable with SingleRun steps.

The issues have been solved with the PR #674 and the modification is currently available in the devel branch

@moosebuild
Copy link

Job Test mac on 3796880 : invalidated by @alfoa

Copy link
Collaborator Author

@alfoa alfoa left a comment

Choose a reason for hiding this comment

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

approved

@wangcj05 wangcj05 merged commit 6ff507c into devel Jul 20, 2018
@alfoa alfoa deleted the alfoa/issue673 branch July 20, 2018 19:17
PaulTalbot-INL added a commit to PaulTalbot-INL/raven that referenced this pull request Jul 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants