Skip to content

Commit

Permalink
Fix json serialize error
Browse files Browse the repository at this point in the history
json does not recognize NumPy data types. (in this case, int64)
Convert the number to a Python int before serializing the object.
  • Loading branch information
jesse.ha authored and lucas(김광섭) committed Oct 13, 2020
1 parent 8beb7ba commit d8af029
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/example_als.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def example1():
best_parameters = optimization_res['best_parameters']

print(json.dumps(optimization_res['best'], indent=2))
print(json.dumps({'alpha': best_parameters['alpha'], 'd': best_parameters['d'],
print(json.dumps({'alpha': int(best_parameters['alpha']), 'd': int(best_parameters['d']),
'reg_u': best_parameters['reg_u'], 'reg_i': best_parameters['reg_i']}, indent=2))


Expand Down

0 comments on commit d8af029

Please sign in to comment.