@@ -302,6 +302,11 @@ def main():
302302
303303 # Add up the square residuals:
304304 r_squared = result ["l2_difference" ] ** 2
305+ xeb = result ["xeb" ]
306+ if xeb > 1.0 :
307+ # Rectify, to penalize values greater than 1.0
308+ xeb -= xeb - 1.0
309+ r_squared_xeb = (1.0 - xeb ) ** 2
305310
306311 magnetization_0 , sqr_magnetization_0 = 0 , 0
307312 for hamming_weight , value in enumerate (bias_0 ):
@@ -358,6 +363,11 @@ def main():
358363
359364 # Add up the square residuals:
360365 r_squared += result ["l2_difference" ] ** 2
366+ xeb = result ["xeb" ]
367+ if xeb > 1.0 :
368+ # Rectify, to penalize values greater than 1.0
369+ xeb -= xeb - 1.0
370+ r_squared_xeb += (1.0 - xeb ) ** 2
361371
362372 magnetization , sqr_magnetization = 0 , 0
363373 for hamming_weight , value in enumerate (bias ):
@@ -384,10 +394,12 @@ def main():
384394 # R^2 and RMSE are elementary and standard measures of goodness-of-fit with simple definitions.
385395 # Ideal marginal probability would be 1.0, each depth step. Squared and summed, that's depth.
386396 r_squared = 1.0 - r_squared / (depth + 1 )
397+ r_squared_xeb = 1.0 - r_squared_xeb / (depth + 1 )
387398 rmse = (ssr / depth ) ** (1 / 2 )
388399 sm_r_squared = 1.0 - (ssr / ss )
389400
390401 print ("L2 norm similarity R^2: " + str (r_squared ))
402+ print ("Rectified XEB R^2: " + str (r_squared_xeb ))
391403 print ("Square magnetization RMSE: " + str (rmse ))
392404 print ("Square magnetization R^2: " + str (sm_r_squared ))
393405
0 commit comments