flib.base.catalog module

Organization and handling of algorithms.

class Card(category: Type[flib.base.catalog.Category], reference: Callable, data: Dict[str, Any])

Bases: object

Base Class for Catalog Cards.

class Category

Bases: object

Base class for Catalog Categories.

class Manager

Bases: flib.base.abc.Singleton

Catalog Manager.

add(cat: type, kwds: dict, obj: Callable) → None
add_category(cat: type) → None
get(path: Union[str, Callable]) → flib.base.catalog.Card
has_category(cat: type) → bool
search(cat: Optional[type] = None, path: Optional[str] = None, **kwds) → flib.base.catalog.Results
class Results

Bases: list

Class for search results.

get(key: Hashable) → list
association(name: Optional[str] = None, tags: Optional[List[str]] = None, classes: Optional[List[str]] = None, plot: Optional[str] = 'Histogram', directed: bool = True, signed: bool = True, normal: bool = False, **attr) → Callable

Attribute decorator for association measure.

Parameters:
  • name – Name of the measure of association
  • tags – List of strings, that describe the algorithm and allow it to be found by browsing or searching.
  • classes – Optional list of model class names, that can be processed by the algorithm.
  • plot – Name of plot class, which is used to interpret the results. Supported values are: None, ‘Heatmap’, ‘Histogram’, ‘Scatter2D’ or ‘Graph’. Default: ‘Heatmap’.
  • directed – Boolean value which indicates if the measure of association is dictected. Default: True.
  • signed – Boolean value which indicates if the measure of association is signed. Default: True.
  • normal – Boolean value which indicates if the measure of association is normalized. Default: False.
  • **attr – Supplementary user attributes, with the purpose to identify and characterize the algorithm by their respective values.
Returns:

Decorated function or method.

category(cls: type) → Type[flib.base.catalog.Category]

Decorate class as Catalog Category.

custom(name: Optional[str] = None, category: Optional[str] = None, classes: Optional[List[str]] = None, tags: Optional[List[str]] = None, plot: Optional[str] = None, **attr) → Callable

Attribute decorator for custom algorithms.

For the case, that an algorithm does not fit into the builtin categories (‘objective’, ‘sampler’, ‘statistic’, ‘association’) then a custom category is required, which does not prescribe the function arguments and return values.

Parameters:
  • name – Name of the algorithm
  • category – Custom category name for the algorithm.
  • tags – List of strings, that describe the algorithm and allow it to be found by browsing or searching
  • classes – Optional list of model class names, that can be processed by the algorithm
  • plot – Name of plot class, which is used to interpret the results. The default value None indicates, that that results can not be visalized. Supported values are: None, ‘Heatmap’, ‘Histogram’, ‘Scatter2D’ or ‘Graph’
  • **attr – Supplementary user attributes, with the purpose to identify and characterize the algorithm by their respective values.
Returns:

Decorated function or method.

objective(name: Optional[str] = None, classes: Optional[List[str]] = None, tags: Optional[List[str]] = None, optimum: str = 'min', scope: str = 'local', plot: Optional[str] = None, **attr) → Callable

Attribute decorator for objective functions.

Objective functions are scalar functions, thet specify the goal of an optimization problem. Thereby the objective function identifies local or global objectives by it’s extremal points, which allows the application of approximations.

Parameters:
  • name – Name of the algorithm
  • tags – List of strings, that describe the algorithm and allow it to be found by browsing or searching
  • classes – Optional list of model class names, that can be processed by the algorithm
  • plot – Name of plot class, which is used to interpret the results. The default value None indicates, that that results can not be visalized. Supported values are: None, ‘Heatmap’, ‘Histogram’, ‘Scatter2D’ or ‘Graph’
  • scope – Scope of optimizer: Ether ‘local’ or ‘global’
  • optimum – String describung the optimum of the objective functions. Supported values are ‘min’ and ‘max’
  • **attr – Supplementary user attributes, with the purpose to identify and characterize the algorithm by their respective values.
Returns:

Decorated function or method.

pick(cat: Optional[type] = None, path: Optional[str] = None, **kwds) → Callable
register(cat: type, **kwds) → Callable

Decorator to register classes and functions in the catalog.

sampler(name: Optional[str] = None, classes: Optional[List[str]] = None, tags: Optional[List[str]] = None, plot: Optional[str] = 'Histogram', **attr) → Callable

Attribute decorator for statistical samplers.

Statistical samplers are random functions, that generate samples from a desired posterior distribution in Bayesian data analysis. Thereby the different approaches exploit properties of the underlying dependency structure. For more information see e.g. [1]

Parameters:
  • name – Name of the algorithm
  • tags – List of strings, that describe the algorithm and allow it to be found by browsing or searching
  • classes – Optional list of model class names, that can be processed by the algorithm
  • plot – Name of plot class, which is used to interpret the results. Supported values are: None, ‘Heatmap’, ‘Histogram’, ‘Scatter2D’ or ‘Graph’. The default value is ‘Histogram’
  • **attr – Supplementary user attributes, with the purpose to identify and characterize the algorithm by their respective values.
Returns:

Decorated function or method.

References

[1] https://en.wikipedia.org/wiki/Gibbs_sampling

search(cat: Optional[type] = None, path: Optional[str] = None, **kwds) → flib.base.catalog.Results
search_old(module: Optional[module] = None, **kwds) → dict

Search for algorithms, that pass given filters.

Parameters:
  • module – Module instance, which is used to recursively search in submodules for algorithms. Default: Use the module of the caller of this function.
  • **kwds – Attributes, which are testet by using the filter rules
Returns:

Dictionary with function information.

statistic(name: Optional[str] = None, classes: Optional[List[str]] = None, tags: Optional[List[str]] = None, plot: Optional[str] = 'Histogram', **attr) → Callable

Attribute decorator for sample statistics.

Sample statistics are measures of some attribute of the individual columns of a sample, e.g. the arithmetic mean values. For more information see [1]

Parameters:
  • name – Name of the algorithm
  • tags – List of strings, that describe the algorithm and allow it to be found by browsing or searching
  • classes – Optional list of model class names, that can be processed by the algorithm
  • plot – Name of plot class, which is used to interpret the results. Supported values are: None, ‘Heatmap’, ‘Histogram’, ‘Scatter2D’ or ‘Graph’. The default value is ‘Histogram’
  • **attr – Supplementary user attributes, with the purpose to identify and characterize the algorithm by their respective values.
Returns:

Decorated function or method.

References

[1] https://en.wikipedia.org/wiki/Statistic