Optimizers
This module contains the optimizers
gradient_descent
gradient_descent (x:numpy.ndarray, y:numpy.ndarray, pini:dict, ll:dict, niter=1000, eta=0.001)
Type | Default | Details | |
---|---|---|---|
x | ndarray | x data of N elements | |
y | ndarray | y data of N elements | |
pini | dict | initial parameters of the loss function | |
ll | dict | dictionary with the loss (‘loss’), the gradients (‘grads’) and the function (‘fun’) for the regression/classification | |
niter | int | 1000 | number of iterations |
eta | float | 0.001 | learning rate |
Returns | dict | dictionary containing the vector of the losses (‘loss’) and the parameters (following the keys of pini) |
sgd_epoch
sgd_epoch (x:numpy.ndarray, y:numpy.ndarray, pini:dict, ll:dict, bs=10, eta=0.001)
Type | Default | Details | |
---|---|---|---|
x | ndarray | x data of N elements | |
y | ndarray | y data of N elements | |
pini | dict | initial parameters of the loss function | |
ll | dict | dictionary with the loss (‘loss’), the gradients (‘grads’) and the function (‘fun’) for the regression/classification | |
bs | int | 10 | Batch size |
eta | float | 0.001 | learning rate |
Returns | dict | dictionary containing the vector of the losses (‘loss’) and the parameters (following the keys of pini) |
sgd
sgd (x:numpy.ndarray, y:numpy.ndarray, pini:dict, ll:dict, bs=10, eta=0.001, niter=1000)
Type | Default | Details | |
---|---|---|---|
x | ndarray | x data of N elements | |
y | ndarray | y data of N elements | |
pini | dict | initial parameters of the loss function | |
ll | dict | dictionary with the loss (‘loss’), the gradients (‘grads’) and the function (‘fun’) for the regression/classification | |
bs | int | 10 | Batch size |
eta | float | 0.001 | learning rate |
niter | int | 1000 | number of epochs |
Returns | dict | dictionary containing the vector of the losses (‘loss’) and the parameters (following the keys of pini) |