损失函数画图
- Hinge loss function:
- -learning loss function:
- Normalized Sigmoid loss:
- Ramp loss function:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | %plot loss function %define the loss function H = @(z) max (0,1-z) ; %Hinge loss function P = @(z)(2*(z<0)+0*(z>=0)); %\psi-learning loss function S = @(z)(1- tanh (2*z)); %Normalized Sigmoid loss function R = @(z)(1*(z<0)+(1-z).*(z>=0&z<1)+0*(z>=1)); % ramp loss z=-2:0.01:2; subplot (1,4,1) % plot the 1st figure of 1-4 plot (z,H(z), '-' , 'linewidth' ,2); xlabel ( 'z' ); title ( 'Hinge loss' , 'fontweight' , 'normal' , 'fontsize' ,10); axis ([-2,2 0 3]) subplot (1,4,2) plot (z,P(z), 'g-' , 'linewidth' ,2); xlabel ( 'z' ); title ( '\psi-learnig loss' , 'fontweight' , 'normal' , 'fontsize' ,10); axis ([-2,2 0 3]) subplot (1,4,3) plot (z,S(z), 'r-' , 'linewidth' ,2); xlabel ( 'z' ); title ( 'Normalized Sigmoid loss' , 'fontweight' , 'normal' , 'fontsize' ,10); axis ([-2,2 0 3]) subplot (1,4,4) plot (z,R(z), 'b-' , 'linewidth' ,2); xlabel ( 'z' ); title ( 'Ramp loss' , 'fontweight' , 'normal' , 'fontsize' ,10); axis ([-2,2 0 3]) |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
2015-01-13 IKAnalyzer进行中文分词和去停用词