You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Keras编译时TypeError:无效关键字参数'matrics'问题排查

错误原因解析

错误代码

classifier.compile(loss='categorical_crossentropy',optimizer='rmsprop',matrics=["accuracy"])

错误提示

TypeError:compile()中存在无效关键字参数:({'matrics'},)。有效的关键字参数包括"cloning"、"experimental_run_tf_function"、"distribute"、"target_tensors"或"sample_weight_mode"。

原因说明

  • 核心问题是参数拼写错误:你把Keras/TensorFlow模型compile()方法中指定评估指标的参数metrics误写成了matrics(多了一个字母r)。
  • 由于compile()方法本身不存在名为matrics的参数,因此触发了无效关键字参数的TypeError。

内容的提问来源于stack exchange,提问作者nabila

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.10 22:05:22