当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- [event center azure event hub] interpretation of error information found in event hub logs
- In order to save money, I learned PHP in one day!
- 一篇文章带你了解CSS3图片边框
- 速看!互联网、电商离线大数据分析最佳实践!(附网盘链接)
- Not long after graduation, he earned 20000 yuan from private work!
- Installing the consult cluster
- Tool class under JUC package, its name is locksupport! Did you make it?
- 关于Kubernetes 与 OAM 构建统一、标准化的应用管理平台知识!(附网盘链接)
- Natural language processing - BM25 commonly used in search
- PN8162 20W PD快充芯片,PD快充充电器方案
猜你喜欢
I think it is necessary to write a general idempotent component
Natural language processing - BM25 commonly used in search
Use of vuepress
ES6学习笔记(四):教你轻松搞懂ES6的新增语法
vue-codemirror基本用法:实现搜索功能、代码折叠功能、获取编辑器值及时验证
容联完成1.25亿美元F轮融资
你的财务报告该换个高级的套路了——财务分析驾驶舱
Grouping operation aligned with specified datum
快快使用ModelArts,零基础小白也能玩转AI!
至联云解析:IPFS/Filecoin挖矿为什么这么难?
随机推荐
vue-codemirror基本用法:实现搜索功能、代码折叠功能、获取编辑器值及时验证
Skywalking series blog 2-skywalking using
JVM memory area and garbage collection
Serilog原始碼解析——使用方法
深度揭祕垃圾回收底層,這次讓你徹底弄懂她
Face to face Manual Chapter 16: explanation and implementation of fair lock of code peasant association lock and reentrantlock
小程序入门到精通(二):了解小程序开发4个重要文件
Python3 e-learning case 4: writing web proxy
6.2 handleradapter adapter processor (in-depth analysis of SSM and project practice)
Save the file directly to Google drive and download it back ten times faster
至联云分享:IPFS/Filecoin值不值得投资?
Can't be asked again! Reentrantlock source code, drawing a look together!
hadoop 命令总结
容联完成1.25亿美元F轮融资
EOS创始人BM: UE,UBI,URI有什么区别?
What problems can clean architecture solve? - jbogard
Filecoin主网上线以来Filecoin矿机扇区密封到底是什么意思
In depth understanding of the construction of Intelligent Recommendation System
The choice of enterprise database is usually decided by the system architect - the newstack
一篇文章带你了解CSS3圆角知识