当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- Synchronous configuration from git to consult with git 2consul
- 数字城市响应相关国家政策大力发展数字孪生平台的建设
- 一篇文章带你了解CSS对齐方式
- Tool class under JUC package, its name is locksupport! Did you make it?
- In order to save money, I learned PHP in one day!
- 2019年的一个小目标,成为csdn的博客专家,纪念一下
- 6.2 handleradapter adapter processor (in-depth analysis of SSM and project practice)
- Don't go! Here is a note: picture and text to explain AQS, let's have a look at the source code of AQS (long text)
- Wiremock: a powerful tool for API testing
- High availability cluster deployment of jumpserver: (6) deployment of SSH agent module Koko and implementation of system service management
猜你喜欢
Examples of unconventional aggregation
IPFS/Filecoin合法性:保护个人隐私不被泄露
I think it is necessary to write a general idempotent component
使用 Iceberg on Kubernetes 打造新一代云原生数据湖
How to select the evaluation index of classification model
PHP应用对接Justswap专用开发包【JustSwap.PHP】
Network security engineer Demo: the original * * is to get your computer administrator rights! 【***】
全球疫情加速互联网企业转型,区块链会是解药吗?
Arrangement of basic knowledge points
DevOps是什么
随机推荐
采购供应商系统是什么?采购供应商管理平台解决方案
熬夜总结了报表自动化、数据可视化和挖掘的要点,和你想的不一样
Network security engineer Demo: the original * * is to get your computer administrator rights! 【***】
Filecoin主网上线以来Filecoin矿机扇区密封到底是什么意思
(2)ASP.NET Core3.1 Ocelot路由
Flink的DataSource三部曲之二:内置connector
Use of vuepress
html
基於MVC的RESTFul風格API實戰
100元扫货阿里云是怎样的体验?
Filecoin的经济模型与未来价值是如何支撑FIL币价格破千的
带你学习ES5中新增的方法
华为云“四个可靠”的方法论
中小微企业选择共享办公室怎么样?
助力金融科技创新发展,ATFX走在行业最前列
Want to do read-write separation, give you some small experience
Programmer introspection checklist
Do not understand UML class diagram? Take a look at this edition of rural love class diagram, a learn!
Python download module to accelerate the implementation of recording
After reading this article, I understand a lot of webpack scaffolding