Exemplo n.º 1
0
"""

from __future__ import division

import numpy as np

from magni.cs.reconstruction._config import Configger as _Configger
from magni.utils.validation import validate_generic as _generic
from magni.utils.validation import validate_numeric as _numeric


configger = _Configger(
    {'iterations': 300,
     'kappa_fixed': 0.65,
     'precision_float': np.float64,
     'threshold': 'far',
     'threshold_fixed': 0.1,
     'tolerance': 1e-3},
    {'iterations': _numeric(None, 'integer', range_='[1;inf)'),
     'kappa_fixed': _numeric(None, 'floating', range_='[0;1]'),
     'precision_float': _generic(None, type, value_in=(
         np.float,
         getattr(np, 'float16', np.float_),
         getattr(np, 'float32', np.float_),
         getattr(np, 'float64', np.float_),
         getattr(np, 'float128', np.float_))),
     'threshold': _generic(None, 'string', value_in=('far', 'oracle')),
     'threshold_fixed': _numeric(None, 'floating', range_='[0;1]'),
     'tolerance': _numeric(None, 'floating', range_='[0;inf]')})
Exemplo n.º 2
0
"""

from __future__ import division

import numpy as np

from magni.cs.reconstruction._config import Configger as _Configger
from magni.utils.validation import validate_generic as _generic
from magni.utils.validation import validate_numeric as _numeric


configger = _Configger(
    {'iterations': 300,
     'kappa_fixed': 0.65,
     'precision_float': np.float64,
     'threshold': 'far',
     'threshold_fixed': 0.1,
     'tolerance': 1e-3},
    {'iterations': _numeric(None, 'integer', range_='[1;inf)'),
     'kappa_fixed': _numeric(None, 'floating', range_='[0;1]'),
     'precision_float': _generic(None, type, value_in=(
         np.float,
         getattr(np, 'float16', np.float_),
         getattr(np, 'float32', np.float_),
         getattr(np, 'float64', np.float_),
         getattr(np, 'float128', np.float_))),
     'threshold': _generic(None, 'string', value_in=('far', 'oracle')),
     'threshold_fixed': _numeric(None, 'floating', range_='[0;1]'),
     'tolerance': _numeric(None, 'floating', range_='[0;inf]')})
Exemplo n.º 3
0
configger = _Configger(
    {
        'damping': 0.0,
        'input_channel': _IIDBG,
        'input_channel_parameters': dict(),
        'iterations': 300,
        'output_channel': _AWGN,
        'output_channel_parameters': dict(),
        'precision_float': np.float64,
        'report_A_asq_setup': False,
        'report_history': False,
        'stop_criterion': _MSEConvergence,
        'sum_approximation_constant': {
            'rangan': 1.0
        },
        'tolerance': 1e-6,
        'true_solution': None,
        'warm_start': None
    }, {
        'damping':
        _numeric(None, 'floating', range_='[0;1)'),
        'input_channel':
        _generic(None, 'class', superclass=_MMSEInputChannel),
        'input_channel_parameters':
        _generic(None, 'mapping'),
        'iterations':
        _numeric(None, 'integer', range_='[1;inf)'),
        'output_channel':
        _generic(None, 'class', superclass=_MMSEOutputChannel),
        'output_channel_parameters':
        _generic(None, 'mapping'),
        'precision_float':
        _generic(None,
                 type,
                 value_in=(np.float, getattr(np, 'float16', np.float_),
                           getattr(np, 'float32', np.float_),
                           getattr(np, 'float64', np.float_),
                           getattr(np, 'float128', np.float_),
                           getattr(np, 'complex64', np.complex_),
                           getattr(np, 'complex128', np.complex_),
                           getattr(np, 'complex256', np.complex_))),
        'report_A_asq_setup':
        _numeric(None, 'boolean'),
        'report_history':
        _numeric(None, 'boolean'),
        'stop_criterion':
        _generic(None, 'class', superclass=_StopCriterion),
        'sum_approximation_constant':
        _levels(
            None,
            (_generic(None, 'mapping', keys_in=('rangan', 'krzakala'), len_=1),
             _numeric(None, ('integer', 'floating'), range_='(0;inf)'))),
        'tolerance':
        _numeric(None, 'floating', range_='[0;inf)'),
        'true_solution':
        _numeric(None, ('integer', 'floating', 'complex'),
                 shape=(-1, 1),
                 ignore_none=True),
        'warm_start':
        _levels(
            None,
            (_generic(None, 'explicit collection', len_=2, ignore_none=True),
             _numeric(None,
                      ('integer', 'floating', 'complex'), shape=(-1, 1))))
    })
Exemplo n.º 4
0
configger = _Configger(
    {'iterations': 300,
     'precision_float': np.float64,
     'report_history': False,
     'stop_criterion': _MSEConvergence,
     'threshold': _SoftThreshold,
     'threshold_parameters': dict(),
     'tolerance': 1e-6,
     'true_solution': None,
     'warm_start': None},
    {'iterations': _numeric(None, 'integer', range_='[1;inf)'),
     'precision_float': _generic(None, type, value_in=(
         np.float,
         getattr(np, 'float16', np.float_),
         getattr(np, 'float32', np.float_),
         getattr(np, 'float64', np.float_),
         getattr(np, 'float128', np.float_),
         getattr(np, 'complex64', np.complex_),
         getattr(np, 'complex128', np.complex_),
         getattr(np, 'complex256', np.complex_))),
     'report_history': _numeric(None, 'boolean'),
     'stop_criterion': _generic(None, 'class', superclass=_StopCriterion),
     'threshold': _generic(None, 'class', superclass=_ThresholdOperator),
     'threshold_parameters': _generic(None, 'mapping'),
     'tolerance': _numeric(None, 'floating', range_='[0;inf)'),
     'true_solution': _numeric(
         None, ('integer', 'floating', 'complex'), shape=(-1, 1),
         ignore_none=True),
     'warm_start': _numeric(None, ('integer', 'floating', 'complex'),
                            shape=(-1, 1), ignore_none=True)})
Exemplo n.º 5
0
configger = _Configger(
    {
        'epsilon': 1e-2,
        'L': 'geometric',
        'L_fixed': 2,
        'L_geometric_ratio': 2.0,
        'L_geometric_start': 2.0,
        'mu': 'step',
        'mu_fixed': 1.0,
        'mu_step_end': 1.5,
        'mu_step_iteration': 4,
        'mu_step_start': 0.001,
        'precision_float': np.float64,
        'sigma_geometric': 0.7,
        'sigma_start': 'reciprocal',
        'sigma_start_fixed': 2.0,
        'sigma_start_reciprocal': 2.75,
        'sigma_stop_fixed': 0.01
    }, {
        'epsilon':
        _numeric(None, 'floating', range_='(0;inf)'),
        'L':
        _generic(None, 'string', value_in=('fixed', 'geometric')),
        'L_fixed':
        _numeric(None, 'integer', range_='[1;inf)'),
        'L_geometric_ratio':
        _numeric(None, 'floating', range_='(0;inf)'),
        'L_geometric_start':
        _numeric(None, 'floating', range_='[1;inf)'),
        'mu':
        _generic(None, 'string', value_in=('fixed', 'step')),
        'mu_fixed':
        _numeric(None, 'floating', range_='(0;inf)'),
        'mu_step_end':
        _numeric(None, 'floating', range_='(0;inf)'),
        'mu_step_iteration':
        _numeric(None, 'integer', range_='(0;inf)'),
        'mu_step_start':
        _numeric(None, 'floating', range_='(0;inf)'),
        'precision_float':
        _generic(None,
                 type,
                 value_in=(np.float, getattr(np, 'float16', np.float_),
                           getattr(np, 'float32', np.float_),
                           getattr(np, 'float64', np.float_),
                           getattr(np, 'float128', np.float_))),
        'sigma_geometric':
        _numeric(None, 'floating', range_='(0;1)'),
        'sigma_start':
        _generic(None, 'string', value_in=('fixed', 'reciprocal')),
        'sigma_start_fixed':
        _numeric(None, 'floating', range_='(0;inf)'),
        'sigma_start_reciprocal':
        _numeric(None, 'floating', range_='(0;inf)'),
        'sigma_stop_fixed':
        _numeric(None, 'floating', range_='(0;inf)')
    })
Exemplo n.º 6
0
configger = _Configger(
    {'iterations': 300,
     'kappa': 'fixed',
     'kappa_fixed': 0.65,
     'precision_float': np.float64,
     'report_history': False,
     'stop_criterion': 'residual_measurements_ratio',
     'threshold': 'far',
     'threshold_fixed': 1,
     'threshold_operator': 'hard',
     'threshold_weights': np.array([[1]]),
     'tolerance': 1e-3,
     'true_solution': None,
     'warm_start': None},
    {'iterations': _numeric(None, 'integer', range_='[1;inf)'),
     'kappa': _generic(
         None, 'string', value_in=_util._get_methods('step_size')),
     'kappa_fixed': _numeric(None, 'floating', range_='(0;inf)'),
     'precision_float': _generic(None, type, value_in=(
         np.float,
         getattr(np, 'float16', np.float_),
         getattr(np, 'float32', np.float_),
         getattr(np, 'float64', np.float_),
         getattr(np, 'float128', np.float_))),
     'report_history': _numeric(None, 'boolean'),
     'stop_criterion': _generic(
         None, 'string', value_in=_util._get_methods('stop_criterion')),
     'threshold': _generic(
         None, 'string', value_in=_util._get_methods('threshold')),
     'threshold_fixed': _numeric(None, 'integer', range_='(0;inf)'),
     'threshold_operator': _generic(
         None, 'string', value_in=_util._get_operators('threshold_operators')),
     'threshold_weights': _numeric(
         None, ('integer', 'floating'), shape=(-1, 1)),
     'tolerance': _numeric(None, 'floating', range_='[0;inf]'),
     'true_solution': _numeric(
         None, ('integer', 'floating', 'complex'), shape=(-1, 1),
         ignore_none=True),
     'warm_start': _numeric(
         None, ('integer', 'floating', 'complex'), shape=(-1, 1),
         ignore_none=True)})
Exemplo n.º 7
0
configger = _Configger(
    {'epsilon': 1e-2,
     'L': 'geometric',
     'L_fixed': 2,
     'L_geometric_ratio': 2.0,
     'L_geometric_start': 2.0,
     'mu': 'step',
     'mu_fixed': 1.0,
     'mu_step_start': 0.001,
     'mu_step_end': 1.5,
     'precision_float': np.float64,
     'sigma_geometric': 0.7,
     'sigma_start': 'reciprocal',
     'sigma_start_fixed': 2.0,
     'sigma_start_reciprocal': 2.75,
     'sigma_stop_fixed': 0.01},
    {'epsilon': _numeric(None, 'floating', range_='(0;inf)'),
     'L': _generic(None, 'string', value_in=('fixed', 'geometric')),
     'L_fixed': _numeric(None, 'integer', range_='[1;inf)'),
     'L_geometric_ratio': _numeric(None, 'floating', range_='(0;inf)'),
     'L_geometric_start': _numeric(None, 'floating', range_='[1;inf)'),
     'mu': _generic(None, 'string', value_in=('fixed', 'step')),
     'mu_fixed': _numeric(None, 'floating', range_='(0;inf)'),
     'mu_step_start': _numeric(None, 'floating', range_='(0;inf)'),
     'mu_step_end': _numeric(None, 'floating', range_='(0;inf)'),
     'precision_float': _generic(None, type, value_in=(
         np.float,
         getattr(np, 'float16', np.float_),
         getattr(np, 'float32', np.float_),
         getattr(np, 'float64', np.float_),
         getattr(np, 'float128', np.float_))),
     'sigma_geometric': _numeric(None, 'floating', range_='(0;1)'),
     'sigma_start': _generic(None, 'string', value_in=('fixed', 'reciprocal')),
     'sigma_start_fixed': _numeric(None, 'floating', range_='(0;inf)'),
     'sigma_start_reciprocal': _numeric(None, 'floating', range_='(0;inf)'),
     'sigma_stop_fixed': _numeric(None, 'floating', range_='(0;inf)')})