Skip to content

Evaluated the feasibility of the earth-mover distance loss function instead of cross-entropy for ordinal classification

Notifications You must be signed in to change notification settings

stedcheng/ordinal-loss-functions

Repository files navigation

Comparing Cross-Entropy and Earth-Mover Distance Loss Functions for Ordinal Classification

Introduction

Ordinal classification is a machine learning framework where classes are ordered. Its ubiquity across different fields and its conceptual differences from regression and nominal classification necessitate the development of methods to implement this framework. The current study explores the Earth-Mover Distance (EMD) loss function, which imposes heavier penalties on far predictions. It is compared to the cross-entropy (CE) loss function, which is more commonly used in nominal classification problems. The dataset concerns the relationship between eucalyptus species and their effects on soil conservation. The target variable of the dataset has five classes (soil utilities). After applying scaling and train-test split, a neural network with two hidden layers and a rectified linear unit activation function was trained for 100 epochs to predict the target variables, and evaluated using accuracy and mean absolute error (MAE). Three loss functions were used: CE, EMD, and a hybrid loss function that returns a weighted loss of CE and EMD. Results show that accuracies and MAEs are similar across loss functions. This little improvement may stem from the CE confusion matrix already having few far predictions. This study recommends using the confusion matrix as a diagnostic tool before applying EMD and comparing the results associated with different weights in the hybrid loss function.

Files

  • PDF: Research paper
  • Notebook: Codes for the data preprocessing, neural network, and evaluation
  • eucalyptus.arff: Dataset used in the study

Credits

This project was created by Sted Cheng and submitted as a requirement for the course CSCI 214: Pattern Recognition taken in the first semester of AY 2025-2026 in Ateneo de Manila University.

About

Evaluated the feasibility of the earth-mover distance loss function instead of cross-entropy for ordinal classification

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published