> 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/optimizer.md).

# Optimizer

```python
class Optimizer(ABC):
    def __init__(self, learning_rate=0.01):
        self.learning_rate = learning_rate

    @abstractmethod
    def apply(self, W: np.ndarray, dl_dw: np.ndarray, b: np.ndarray, dl_db: np.ndarray) -> tuple[np.ndarray]:
        """
        Update model parameters using the calculated gradients.

        Parameters:
        - grads_and_vars: List of (gradient, variable) tuples, where each gradient
          corresponds to a model parameter.

        This method should be implemented by subclasses.
        """
        pass
```
