def main(weight_file=None): if weight_file: with open(weight_file, "r") as f: weights = json.load(f) mlp = NeuralNet(weights["mlp"]) lr = NeuralNet(weights["lr"]) else: mlp = NeuralNet.create(10, 10, 1) lr = NeuralNet.create(10, 1) train(mlp) train(lr) with open("weights.json", "w") as f: json.dump({ "mlp": mlp.weights, "lr": lr.weights, }, f) tournament(NeuralNetAgent("MLP", mlp), NeuralNetAgent("LR", lr))