当前位置:网站首页>keras model.compile Loss function and optimizer
keras model.compile Loss function and optimizer
2020-11-06 01:22:00 【Elementary school students in IT field】
Loss function
summary
Loss function is the goal of model optimization , So it's also called objective function 、 Optimize the scoring function , stay keras in , Parameters for model compilation loss Class of loss function specified , There are two ways of specifying :
model.compile(loss='mean_squared_error', optimizer='sgd')
perhaps
from keras import losses
model.compile(loss=losses.mean_squared_error, optimizer='sgd')
Available loss function
Available loss objective function :
mean_squared_error or mse
mean_absolute_error or mae
mean_absolute_percentage_error or mape
mean_squared_logarithmic_error or msle
squared_hinge
hinge
categorical_hinge
binary_crossentropy( Also called logarithmic loss ,logloss)
logcosh
categorical_crossentropy: Also known as multi class logarithmic loss , Note when using this objective function , The label needs to be transformed into a shape like (nb_samples, nb_classes) Binary sequence of
sparse_categorical_crossentrop: Above , But accept sparse tags . Be careful , When using this function, you still need to have the same dimension as the output value , You may need to add a dimension to the tag data :np.expand_dims(y,-1)
kullback_leibler_divergence: From the probability distribution of predicted values Q To the truth probability distribution P Information gain of , To measure the difference between two distributions .
poisson: namely (predictions - targets * log(predictions)) The average of
cosine_proximity: That is, the inverse number between the predicted value and the average cosine distance of the real label
Loss function formula
https://zhuanlan.zhihu.com/p/34667893
Two classification - Report errors
On the loss function of the report error :
use Keras Do text classification , I always have mistakes like this ,
My category is 0 or 1, But the mistake told me it couldn't be 1.
See :Received a label value of 1 which is outside the valid range of [0, 1) - Python, Keras
loss function The problem of .
It used to be sparse_categorical_crossentropy,
Change it to binary_crossentropy Problem solving .
Optimizer
https://www.cnblogs.com/xiaobingqianrui/p/10756046.html

版权声明
本文为[Elementary school students in IT field]所创,转载请带上原文链接,感谢
边栏推荐
- Every day we say we need to do performance optimization. What are we optimizing?
- 容联完成1.25亿美元F轮融资
- Wiremock: a powerful tool for API testing
- Synchronous configuration from git to consult with git 2consul
- 5.5 controlleradvice notes - SSM in depth analysis and project practice
- Want to do read-write separation, give you some small experience
- Programmer introspection checklist
- 采购供应商系统是什么?采购供应商管理平台解决方案
- Flink的DataSource三部曲之二:内置connector
- vue-codemirror基本用法:实现搜索功能、代码折叠功能、获取编辑器值及时验证
猜你喜欢
Summary of common algorithms of binary tree
Python download module to accelerate the implementation of recording
每个前端工程师都应该懂的前端性能优化总结:
[C / C + + 1] clion configuration and running C language
IPFS/Filecoin合法性:保护个人隐私不被泄露
Aprelu: cross border application, adaptive relu | IEEE tie 2020 for machine fault detection
PHP应用对接Justswap专用开发包【JustSwap.PHP】
CCR炒币机器人:“比特币”数字货币的大佬,你不得不了解的知识
关于Kubernetes 与 OAM 构建统一、标准化的应用管理平台知识!(附网盘链接)
数据产品不就是报表吗?大错特错!这分类里有大学问
随机推荐
Skywalking series blog 5-apm-customize-enhance-plugin
容联完成1.25亿美元F轮融资
H5 makes its own video player (JS Part 2)
TRON智能钱包PHP开发包【零TRX归集】
嘗試從零開始構建我的商城 (二) :使用JWT保護我們的資訊保安,完善Swagger配置
Summary of common algorithms of linked list
This article will introduce you to jest unit test
6.4 viewresolver view parser (in-depth analysis of SSM and project practice)
Why do private enterprises do party building? ——Special subject study of geek state holding Party branch
Serilog原始碼解析——使用方法
一篇文章带你了解CSS对齐方式
JVM memory area and garbage collection
华为云“四个可靠”的方法论
Word segmentation, naming subject recognition, part of speech and grammatical analysis in natural language processing
至联云解析:IPFS/Filecoin挖矿为什么这么难?
多机器人行情共享解决方案
大数据应用的重要性体现在方方面面
How long does it take you to work out an object-oriented programming interview question from Ali school?
前端基础牢记的一些操作-Github仓库管理
Can't be asked again! Reentrantlock source code, drawing a look together!