Esempio n. 1
0
 def localInputAndChecks(self,xmlNode):
   """
     Function to read the portion of the xml input that belongs to this specialized class
     and initialize some stuff based on the inputs got
     @ In, xmlNode, xml.etree.ElementTree.Element, Xml element node
     @ Out, None
   """
   HybridModelBase.localInputAndChecks(self, xmlNode)
   paramInput = HybridModel.getInputSpecification()()
   paramInput.parseNode(xmlNode)
   for child in paramInput.subparts:
     if child.getName() == 'TargetEvaluation':
       self.targetEvaluationInstance = child.value.strip()
     if child.getName() == 'ROM':
       romName = child.value.strip()
       self.romsDictionary[romName] = {'Instance': None, 'Converged': False, 'Valid': False}
     if child.getName() == 'settings':
       for childChild in child.subparts:
         if childChild.getName() == 'maxTrainSize':
           self.romTrainMaxSize = utils.intConversion(childChild.value)
         if childChild.getName() == 'minInitialTrainSize':
           self.romTrainStartSize = utils.intConversion(childChild.value)
         if childChild.getName() == 'tolerance':
           self.romConvergence = utils.floatConversion(childChild.value)
     if child.getName() == 'validationMethod':
       name = child.parameterValues['name']
       self.validationMethod[name] = {}
       for childChild in child.subparts:
         if childChild.getName() == 'threshold':
           self.validationMethod[name]['threshold'] = utils.floatConversion(childChild.value)
       if name != 'CrowdingDistance':
         self.raiseAnError(IOError, "Validation method ", name, " is not implemented yet!")
Esempio n. 2
0
  def checkCV(self, trainingSize):
    """
      The function will check whether we can use Cross Validation or not
      @ In, trainingSize, int, the size of current training size
      @ Out, None
    """
    useCV = True
    initDict =  self.cvInstance.interface.initializationOptionDict
    if 'SciKitLearn' in initDict.keys() and 'n_splits' in initDict['SciKitLearn'].keys():
      if trainingSize < utils.intConversion(initDict['SciKitLearn']['n_splits']):
        useCV = False

    return useCV