// Binarize solution
sol = np.ravel(solution) // convert to 1-d array
maxi = np.nanmax((filter(lambda x: x != float("inf"), sol))
) // Max except NaN and Inf
mini = np.nanmin((filter(lambda x: x != float("-inf"), sol))
) // Mini except NaN and Inf
if maxi == mini:
After Change
// ) // Max except NaN and Inf
//mini = np.nanmin((filter(lambda x: x != float("-inf"), sol))
// ) // Mini except NaN and Inf
maxi = np.nanmax(sol[np.isfinite(sol)])
mini = np.nanmin(sol[np.isfinite(sol)])
if maxi == mini:
print("Warning, cannot normalize")
return [solution, prediction]