def generate_ai_log(log_file=ai_training_log.txt):
打开日志文件,以追加模式写入
with open(log_file, a) as f:
for i in range(10): 模拟10次训练迭代
模拟训练过程中的一些数据
loss = round(random.uniform(0.1, 1.0), 4) 随机生成损失值
accuracy = round(random.uniform(0.8, 1.0), 4) 随机生成准确率
epoch = i + 1 当前训练轮数