jaclearn.logic.propositional.logic_induction#
Functions
|
Search for logic forms inductively. |
Submodules
Functions
- search(inputs, outputs, input_names, type='GENERAL', output_format='DEFAULT', depth=4, coverage=0.99)[source]#
Search for logic forms inductively.
Example
import numpy as np from jaclearn.logic.propositional.logic_induction import search inputs = np.array([[0, 0], [0, 1], [1, 0], [1, 1]], dtype='uint8') outputs = np.array([[0], [1], [1], [0]], dtype='uint8') input_names = ['x', 'y'] print(search(inputs, outputs, input_names)) # ['((x OR y) AND (NOT x OR NOT y))']
- Parameters:
inputs (ndarray) – the input data, with shape (N, D).
outputs (ndarray) – the output data, with shape (N, C).
input_names (List[str]) – the names of the input variables, a list of length D.
type (str | LogicFormTypePy | None) – the type of the logic form (options are ‘GENERAL’, ‘CONJUNCTION’, ‘DISJUNCTION’).
output_format (str | LogicFormOutputFormatPy | None) – the output format of the logic form (options are ‘DEFAULT’, ‘LISP’).
depth (int | None) – the maximum depth of the logic form.
coverage (float | None) – the minimum coverage of the logic form.
- Returns:
a list of strings, of length C.
- Return type: