@@ -89,13 +89,23 @@ def getKineticsLeaveOneOut(family, averaging=True):
8989 exactKinetics = {}
9090 approxKinetics = {}
9191
92+ rootTemplate = family .getRootTemplate ()
93+
9294 for entryKey in family .rules .entries .keys ():
9395 template = family .retrieveTemplate (entryKey .split (';' ))
94- exactKineticsData , exactKineticsEntry = family .rules .estimateKinetics (template )
95- if exactKineticsData .comment :
96- # This means it was an averaged node so skip
96+ exactKineticsEntry = family .rules .getRule (template ) # fetch the best matched rule
97+ if exactKineticsEntry .rank == 0 :
98+ # Skip rank zero entries, because they are replaced by averaged values
99+ # during model generation
97100 continue
98101
102+ exactKineticsData = exactKineticsEntry .data
103+ if exactKineticsData .comment :
104+ if 'training' not in exactKineticsData .comment :
105+ # Averaged nodes have kinetics data comments, so skip them unless
106+ # They were created from training reactions
107+ continue
108+
99109 exactKinetics [entryKey ] = exactKineticsData
100110
101111 if averaging :
@@ -111,7 +121,12 @@ def getKineticsLeaveOneOut(family, averaging=True):
111121 # This takes significanty less time to run, but is not a true validation of the data,
112122 # it is just testing our kinetics selection algorithm
113123
114- originalEntry = family .rules .entries (entryKey )
124+ # Skip the top node in this scheme, because nothing can predict it if removed
125+
126+ if template == rootTemplate :
127+ continue
128+
129+ originalEntry = family .rules .entries [entryKey ]
115130 family .rules .entries .pop (entryKey )
116131 approxKinetics [entryKey ], approxKineticsEntry = family .rules .estimateKinetics (template )
117132 # Re-add the data back into the original family
0 commit comments