Keras-Sequential模型(2)

这篇博客详细介绍了Keras的Sequential模型的使用方法,包括compile、fit和evaluate三个主要步骤。compile用于配置模型的学习过程,涉及optimizer、loss和metrics等参数。fit函数用于训练模型,参数包括输入数据x、标签y、批次大小batch_size和训练轮数nb_epoch等。evaluate函数则用于计算模型在特定输入数据上的误差,同时支持样本权重。
摘要由CSDN通过智能技术生成

重点介绍Sequential模型方法

compile

compile(self, optimizer, loss, metrics=[], sample_weight_mode=None, **kwargs)

编译用来配置模型的学习过程,其参数有:

  • optimizer: str (name of optimizer) or optimizer object.

    optimizer:字符串(预定义优化器名)或优化器对象,参考优化器

  • loss: str (name of objective function) or objective function.

    loss:字符串(预定义损失函数名)或目标函数

  • metrics: list of metrics to be evaluated by the model.during training and testing.Typically you will use “metrics=[‘accuracy’] “.

    metrics:列表,包含评估模型在训练和测试时的网络性能的指标,典型用法是metrics=[‘accuracy’]

  • sample_weight_mode: if you need to do timestep-wise.sample weighting (2D weights), set this to “temporal”.”None” defaults to sample-wise weights (1D).

    sample_weight_mode:如果你需要按时间步为样本赋权(2D权矩阵),将该值设为“temporal”。默认为“None”,代表按样本赋权(1D权)

  • kwargs: for Theano backend, these are passed into K.function.

    kwargs:使用TensorFlow作为后端请忽略该参数,若使用Theano作为后端,kwargs的值将会传递给 K.function

  • examp

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值