June 17, 2024, 12:55 a.m. | Super Kai (Kazuya Ito)

DEV Community dev.to

A loss function is the function which can get the difference(gap) between a model's predictions and true values to evaluate how good a model is. *Loss function is also called Cost Function or Error Function.


There are popular loss function as shown below:


(1) L1 Loss:



  • can compute the average of the sum of the absolute differences between a model's predictions and true values.

  • 's formula is as shown below:


  • is also called Mean Absolute Error(MAE).

  • is L1Loss() in PyTorch. …

compute cost difference error function functions gap good loss lossfunction network neural network neuralnetwork popular predictions pytorch true values

AI Focused Biochemistry Postdoctoral Fellow

@ Lawrence Berkeley National Lab | Berkeley, CA

Senior Data Engineer

@ Displate | Warsaw

Data Architect

@ Unison Consulting Pte Ltd | Kuala Lumpur, Federal Territory of Kuala Lumpur, Malaysia

Data Architect

@ Games Global | Isle of Man, Isle of Man

Enterprise Data Architect

@ Ent Credit Union | Colorado Springs, CO, United States

Lead Data Architect (AWS, Azure, GCP)

@ CapTech Consulting | Chicago, IL, United States