当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- Using Es5 to realize the class of ES6
- Leetcode's ransom letter
- Polkadot series (2) -- detailed explanation of mixed consensus
- Common algorithm interview has been out! Machine learning algorithm interview - KDnuggets
- I think it is necessary to write a general idempotent component
- 中小微企业选择共享办公室怎么样?
- JVM memory area and garbage collection
- ES6学习笔记(四):教你轻松搞懂ES6的新增语法
- Python + appium automatic operation wechat is enough
- This article will introduce you to jest unit test
猜你喜欢

Use of vuepress

做外包真的很难,身为外包的我也无奈叹息。

中国提出的AI方法影响越来越大,天大等从大量文献中挖掘AI发展规律

Filecoin主网上线以来Filecoin矿机扇区密封到底是什么意思

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

I think it is necessary to write a general idempotent component

一篇文章带你了解CSS 渐变知识

教你轻松搞懂vue-codemirror的基本用法:主要实现代码编辑、验证提示、代码格式化

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)

小程序入门到精通(二):了解小程序开发4个重要文件
随机推荐
Why do private enterprises do party building? ——Special subject study of geek state holding Party branch
深度揭祕垃圾回收底層,這次讓你徹底弄懂她
使用 Iceberg on Kubernetes 打造新一代云原生数据湖
Network security engineer Demo: the original * * is to get your computer administrator rights! 【***】
Polkadot series (2) -- detailed explanation of mixed consensus
I think it is necessary to write a general idempotent component
A debate on whether flv should support hevc
Python download module to accelerate the implementation of recording
Wiremock: a powerful tool for API testing
中国提出的AI方法影响越来越大,天大等从大量文献中挖掘AI发展规律
I'm afraid that the spread sequence calculation of arbitrage strategy is not as simple as you think
至联云解析:IPFS/Filecoin挖矿为什么这么难?
Grouping operation aligned with specified datum
加速「全民直播」洪流,如何攻克延时、卡顿、高并发难题?
怎么理解Python迭代器与生成器?
After brushing leetcode's linked list topic, I found a secret!
Skywalking series blog 2-skywalking using
OPTIMIZER_ Trace details
CCR炒币机器人:“比特币”数字货币的大佬,你不得不了解的知识
The practice of the architecture of Internet public opinion system