当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- 关于Kubernetes 与 OAM 构建统一、标准化的应用管理平台知识!(附网盘链接)
- Windows 10 tensorflow (2) regression analysis of principles, deep learning framework (gradient descent method to solve regression parameters)
- Character string and memory operation function in C language
- Python download module to accelerate the implementation of recording
- 阿里云Q2营收破纪录背后,云的打开方式正在重塑
- 2018中国云厂商TOP5:阿里云、腾讯云、AWS、电信、联通 ...
- Vue 3 responsive Foundation
- Python Jieba segmentation (stuttering segmentation), extracting words, loading words, modifying word frequency, defining thesaurus
- Serilog原始碼解析——使用方法
- Real time data synchronization scheme based on Flink SQL CDC
猜你喜欢

业内首发车道级导航背后——详解高精定位技术演进与场景应用

Word segmentation, naming subject recognition, part of speech and grammatical analysis in natural language processing

Network security engineer Demo: the original * * is to get your computer administrator rights! 【***】

钻石标准--Diamond Standard

Network security engineer Demo: the original * * is to get your computer administrator rights! 【***】

How to encapsulate distributed locks more elegantly

一篇文章带你了解CSS对齐方式

axios学习笔记(二):轻松弄懂XHR的使用及如何封装简易axios

IPFS/Filecoin合法性:保护个人隐私不被泄露

Character string and memory operation function in C language
随机推荐
Windows 10 tensorflow (2) regression analysis of principles, deep learning framework (gradient descent method to solve regression parameters)
JVM memory area and garbage collection
PN8162 20W PD快充芯片,PD快充充电器方案
Filecoin最新动态 完成重大升级 已实现四大项目进展!
Every day we say we need to do performance optimization. What are we optimizing?
一篇文章带你了解CSS 渐变知识
Natural language processing - BM25 commonly used in search
hadoop 命令总结
The difference between Es5 class and ES6 class
Natural language processing - wrong word recognition (based on Python) kenlm, pycorrector
ES6学习笔记(五):轻松了解ES6的内置扩展对象
Synchronous configuration from git to consult with git 2consul
從小公司進入大廠,我都做對了哪些事?
How to select the evaluation index of classification model
I'm afraid that the spread sequence calculation of arbitrage strategy is not as simple as you think
关于Kubernetes 与 OAM 构建统一、标准化的应用管理平台知识!(附网盘链接)
Thoughts on interview of Ali CCO project team
ipfs正舵者Filecoin落地正当时 FIL币价格破千来了
High availability cluster deployment of jumpserver: (6) deployment of SSH agent module Koko and implementation of system service management
中小微企业选择共享办公室怎么样?