This class defines a StoppingCriterion for PALM4MSA algorithms.
More...
This class defines a StoppingCriterion for PALM4MSA algorithms.
A stopping criterion can be of two kinds:
- number of iterations,
- error threshold.
- See also
- StoppingCriterion.__init__
◆ __init__()
def pyfaust.factparams.StoppingCriterion.__init__ |
( |
|
self, |
|
|
|
num_its = DEFAULT_NUMITS , |
|
|
|
tol = None , |
|
|
|
maxiter = DEFAULT_MAXITER , |
|
|
|
relerr = False , |
|
|
|
relmat = None , |
|
|
|
erreps = None |
|
) |
| |
Class constructor.
- Parameters
-
num_its | (int) the fixed number of iterations of the algorithm. By default the value is DEFAULT_NUMITS. The constructor will fail if arguments num_its and tol are used together. |
tol | (float) error target according to the algorithm is stopped. The constructor will fail if arguments num_its and tol are used together. |
maxiter | (int) The maximum number of iterations to run the algorithm, whatever is the criterion used (tol or num_its). |
relerr | (bool) if False the tol error defines an absolute error, otherwise it defines a relative error (in this case the 'relmat' matrix will be used to convert internally the given 'tol' value to the corresponding absolute error). |
relmat | (bool) The matrix against which is defined the relative error. if relerr is True, this argument is mandatory. |
erreps | (float) defines the epsilon on the approximation error between two PALM4MSA iterations. If the error doesn't improve more than erreps then the algorithm stops (warning: this argument is only supported by the 2020 backend of PALM4MSA implementations). |
Examples
>>> from numpy.random import rand, seed
>>> s = StoppingCriterion()
>>> print(s)
num_its: 500, maxiter: 10000
>>> s = StoppingCriterion(5)
>>> print(s)
num_its: 5, maxiter: 10000
>>> s = StoppingCriterion(tol=.5)
>>> print(s)
tol: 0.5, relerr: False, maxiter: 10000
>>> s = StoppingCriterion(tol=.2, relerr=
True, relmat=
rand(10,10))
>>> print(s)
tol: 1.1111883397755122, relerr: True, maxiter: 10000
◆ __repr__()
def pyfaust.factparams.StoppingCriterion.__repr__ |
( |
|
self | ) |
|
◆ __str__()
def pyfaust.factparams.StoppingCriterion.__str__ |
( |
|
self | ) |
|
◆ DEFAULT_MAXITER
int pyfaust.factparams.StoppingCriterion.DEFAULT_MAXITER = 10000 |
|
static |
◆ DEFAULT_NUMITS
int pyfaust.factparams.StoppingCriterion.DEFAULT_NUMITS = 500 |
|
static |
◆ DEFAULT_TOL
float pyfaust.factparams.StoppingCriterion.DEFAULT_TOL = 0.3 |
|
static |
◆ erreps
pyfaust.factparams.StoppingCriterion.erreps |
◆ maxiter
pyfaust.factparams.StoppingCriterion.maxiter |
◆ num_its
pyfaust.factparams.StoppingCriterion.num_its |
◆ relerr
pyfaust.factparams.StoppingCriterion.relerr |
◆ tol
pyfaust.factparams.StoppingCriterion.tol |
The documentation for this class was generated from the following file:
def rand(num_rows, num_cols, num_factors=None, dim_sizes=None, density=None, fac_type='sparse', per_row=True, dev='cpu', dtype='float64', field=None, seed=0)
Generates a random Faust.
Definition: __init__.py:4936