> For the complete documentation index, see [llms.txt](https://ncxlib.gitbook.io/ncxlib/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ncxlib.gitbook.io/ncxlib/getting-started/api-documentation/overview/lossfunction.md).

# LossFunction

```python
class LossFunction(ABC):
    
    @abstractmethod
    def compute_loss(self, y_true: np.ndarray, y_pred: np.ndarray) -> float:
        raise NotImplementedError
    
    @abstractmethod
    def compute_gradient(self, y_true: np.ndarray, y_pred: np.ndarray):
        raise NotImplementedError
```
