neuralogic.core.constructs.function packageο
Submodulesο
neuralogic.core.constructs.function.concat moduleο
- class ConcatAggregation(name: str, *, axis: int = -1)[source]ο
Bases:
AggregationFunctionRepresents a concatenation aggregation function that joins multiple groundings along a specified axis.
- axisο
- class ConcatCombination(name: str, *, axis: int = -1)[source]ο
Bases:
CombinationFunctionRepresents a concatenation combination function that joins multiple tensors along a specified axis.
- axisο
neuralogic.core.constructs.function.enum moduleο
- class Aggregation[source]ο
Bases:
objectCollection of aggregation functions. Aggregation functions are used to aggregate multiple inputs, typically from different groundings of the same rule.
- AVG: AggregationFunction = <neuralogic.core.constructs.function.function.AggregationFunction object>ο
- CONCAT: ConcatAggregation = <neuralogic.core.constructs.function.concat.ConcatAggregation object>ο
- COUNT: AggregationFunction = <neuralogic.core.constructs.function.function.AggregationFunction object>ο
- MAX: AggregationFunction = <neuralogic.core.constructs.function.function.AggregationFunction object>ο
- MIN: AggregationFunction = <neuralogic.core.constructs.function.function.AggregationFunction object>ο
- SOFTMAX: SoftmaxAggregation = <neuralogic.core.constructs.function.softmax.SoftmaxAggregation object>ο
- SUM: AggregationFunction = <neuralogic.core.constructs.function.function.AggregationFunction object>ο
- class Combination[source]ο
Bases:
objectCollection of combination functions. Combination functions are used to combine multiple inputs into a single output, often as part of a rule body or for combining multiple rules.
- AVG: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- CONCAT: ConcatCombination = <neuralogic.core.constructs.function.concat.ConcatCombination object>ο
- COSSIM: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- COUNT: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- CROSSSUM: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- ELPRODUCT: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- MAX: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- MIN: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- PRODUCT: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- SOFTMAX: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- SPARSEMAX: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- SUM: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- class F[source]ο
Bases:
objectUtility class providing a flat namespace for common functions. It includes transformation, combination, and aggregation functions.
- avg: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- avg_agg: AggregationFunction = <neuralogic.core.constructs.function.function.AggregationFunction object>ο
- concat: ConcatCombination = <neuralogic.core.constructs.function.concat.ConcatCombination object>ο
- concat_agg: ConcatAggregation = <neuralogic.core.constructs.function.concat.ConcatAggregation object>ο
- cossim: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- count: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- count_agg: AggregationFunction = <neuralogic.core.constructs.function.function.AggregationFunction object>ο
- crossum: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- elproduct: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- exp: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- identity: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- inverse: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- leaky_relu: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- log: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- lukasiewicz: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- max: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- max_agg: AggregationFunction = <neuralogic.core.constructs.function.function.AggregationFunction object>ο
- min: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- min_agg: AggregationFunction = <neuralogic.core.constructs.function.function.AggregationFunction object>ο
- norm: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- product: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- relu: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- reverse: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- sigmoid: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- signum: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- softmax: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- softmax_agg: SoftmaxAggregation = <neuralogic.core.constructs.function.softmax.SoftmaxAggregation object>ο
- softmax_comb: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- sparsemax: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- sparsemax_comb: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- sqrt: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- sum: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- sum_agg: AggregationFunction = <neuralogic.core.constructs.function.function.AggregationFunction object>ο
- tanh: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- transp: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- class Transformation[source]ο
Bases:
objectCollection of transformation functions. Transformation functions are applied element-wise or as join operations (e.g., Softmax, Transpose).
- EXP: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- IDENTITY: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- INVERSE: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- LEAKY_RELU: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- LOG: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- LUKASIEWICZ: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- NORM: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- RELU: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- REVERSE: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- SIGMOID: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- SIGNUM: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- SOFTMAX: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- SPARSEMAX: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- SQRT: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- TANH: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- TRANSP: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
neuralogic.core.constructs.function.function moduleο
- class AggregationFunction(name: str, *, namespace: str = '', operator: str | None = None, can_flatten: bool = False)[source]ο
Bases:
FunctionRepresents an aggregation function used to aggregate multiple groundings of the same rule.
- can_flattenο
- get() Any[source]ο
Returns the Java representation of the function.
- Returns:
The Java function object.
- Return type:
Any
- name: strο
- namespaceο
- operator: str | Noneο
- class CombinationFunction(name: str, *, namespace: str = 'combination.{name}', operator: str | None = None, can_flatten: bool = False)[source]ο
Bases:
FunctionRepresents a combination function used to combine multiple relations into a single output.
- can_flattenο
- name: strο
- namespaceο
- operator: str | Noneο
- class Function(name: str, *, namespace: str = '', operator: str | None = None, can_flatten: bool = False)[source]ο
Bases:
objectBase class for all logic functions (transformation, combination, aggregation). Functions are used to transform, combine, or aggregate values in the logic program.
- can_flattenο
- get() Any[source]ο
Returns the Java representation of the function.
- Returns:
The Java function object.
- Return type:
Any
- name: strο
- namespaceο
- operator: str | Noneο
- class TransformationFunction(name: str, *, namespace: str = 'transformation.elementwise.{name}', operator: str | None = None, can_flatten: bool = False)[source]ο
Bases:
FunctionRepresents a transformation function applied to a relation or a container of relations. Transformation functions can be applied element-wise or as join operations.
- can_flattenο
- name: strο
- namespaceο
- operator: str | Noneο
neuralogic.core.constructs.function.function_container moduleο
- class FContainer(nodes: Iterable[Any], function: Function)[source]ο
Bases:
objectA container for multiple logic nodes (relations or other containers) and a function to apply to them.
It allows for nesting and building complex function graphs.
- functionο
- static get_flattened_nodes(nodes: Iterable[Any], function: Function) tuple[source]ο
Flattens the nodes if they are FContainers with the same function.
- Parameters:
nodes (Iterable[Any]) β The nodes to flatten.
function (Function) β The function used for flattening criteria.
- Returns:
The flattened nodes.
- Return type:
tuple
- property name: strο
- nodesο
neuralogic.core.constructs.function.function_graph moduleο
neuralogic.core.constructs.function.reshape moduleο
- class Reshape(name: str, *, shape: tuple[int, int] | int | None = None)[source]ο
Bases:
TransformationFunctionRepresents a reshape transformation function that changes the shape of a tensor.
- get() Any[source]ο
Returns the Java representation of the function.
- Returns:
The Java function object.
- Return type:
Any
- shapeο
neuralogic.core.constructs.function.slice moduleο
- class Slice(name: str, *, rows: EllipsisType | tuple[int, int] = Ellipsis, cols: EllipsisType | tuple[int, int] = Ellipsis)[source]ο
Bases:
TransformationFunctionRepresents a slice transformation function that extracts a sub-tensor from a tensor.
- colsο
- get() Any[source]ο
Returns the Java representation of the function.
- Returns:
The Java function object.
- Return type:
Any
- rowsο
neuralogic.core.constructs.function.softmax moduleο
- class SoftmaxAggregation(name: str, *, agg_terms: Sequence[str] | None = None)[source]ο
Bases:
AggregationFunctionRepresents a Softmax aggregation function. It can be parametrized by specific terms (variables) to aggregate over.
- agg_termsο
- get() Any[source]ο
Returns the Java representation of the function.
- Returns:
The Java function object.
- Return type:
Any
- process_head(head) SoftmaxAggregation[source]ο
Processes the rule head to determine the indices of the aggregation terms.
- Parameters:
head (Any) β The rule head.
- Returns:
A new instance with the determined term indices.
- Return type:
- var_termsο
Module contentsο
- class Aggregation[source]ο
Bases:
objectCollection of aggregation functions. Aggregation functions are used to aggregate multiple inputs, typically from different groundings of the same rule.
- AVG: AggregationFunction = <neuralogic.core.constructs.function.function.AggregationFunction object>ο
- CONCAT: ConcatAggregation = <neuralogic.core.constructs.function.concat.ConcatAggregation object>ο
- COUNT: AggregationFunction = <neuralogic.core.constructs.function.function.AggregationFunction object>ο
- MAX: AggregationFunction = <neuralogic.core.constructs.function.function.AggregationFunction object>ο
- MIN: AggregationFunction = <neuralogic.core.constructs.function.function.AggregationFunction object>ο
- SOFTMAX: SoftmaxAggregation = <neuralogic.core.constructs.function.softmax.SoftmaxAggregation object>ο
- SUM: AggregationFunction = <neuralogic.core.constructs.function.function.AggregationFunction object>ο
- class Combination[source]ο
Bases:
objectCollection of combination functions. Combination functions are used to combine multiple inputs into a single output, often as part of a rule body or for combining multiple rules.
- AVG: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- CONCAT: ConcatCombination = <neuralogic.core.constructs.function.concat.ConcatCombination object>ο
- COSSIM: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- COUNT: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- CROSSSUM: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- ELPRODUCT: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- MAX: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- MIN: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- PRODUCT: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- SOFTMAX: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- SPARSEMAX: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- SUM: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- class F[source]ο
Bases:
objectUtility class providing a flat namespace for common functions. It includes transformation, combination, and aggregation functions.
- avg: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- avg_agg: AggregationFunction = <neuralogic.core.constructs.function.function.AggregationFunction object>ο
- concat: ConcatCombination = <neuralogic.core.constructs.function.concat.ConcatCombination object>ο
- concat_agg: ConcatAggregation = <neuralogic.core.constructs.function.concat.ConcatAggregation object>ο
- cossim: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- count: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- count_agg: AggregationFunction = <neuralogic.core.constructs.function.function.AggregationFunction object>ο
- crossum: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- elproduct: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- exp: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- identity: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- inverse: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- leaky_relu: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- log: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- lukasiewicz: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- max: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- max_agg: AggregationFunction = <neuralogic.core.constructs.function.function.AggregationFunction object>ο
- min: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- min_agg: AggregationFunction = <neuralogic.core.constructs.function.function.AggregationFunction object>ο
- norm: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- product: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- relu: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- reverse: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- sigmoid: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- signum: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- softmax: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- softmax_agg: SoftmaxAggregation = <neuralogic.core.constructs.function.softmax.SoftmaxAggregation object>ο
- softmax_comb: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- sparsemax: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- sparsemax_comb: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- sqrt: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- sum: CombinationFunction = <neuralogic.core.constructs.function.function.CombinationFunction object>ο
- sum_agg: AggregationFunction = <neuralogic.core.constructs.function.function.AggregationFunction object>ο
- tanh: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- transp: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- class FContainer(nodes: Iterable[Any], function: Function)[source]ο
Bases:
objectA container for multiple logic nodes (relations or other containers) and a function to apply to them.
It allows for nesting and building complex function graphs.
- functionο
- static get_flattened_nodes(nodes: Iterable[Any], function: Function) tuple[source]ο
Flattens the nodes if they are FContainers with the same function.
- Parameters:
nodes (Iterable[Any]) β The nodes to flatten.
function (Function) β The function used for flattening criteria.
- Returns:
The flattened nodes.
- Return type:
tuple
- property name: strο
- nodesο
- class Function(name: str, *, namespace: str = '', operator: str | None = None, can_flatten: bool = False)[source]ο
Bases:
objectBase class for all logic functions (transformation, combination, aggregation). Functions are used to transform, combine, or aggregate values in the logic program.
- can_flattenο
- get() Any[source]ο
Returns the Java representation of the function.
- Returns:
The Java function object.
- Return type:
Any
- name: strο
- namespaceο
- operator: str | Noneο
- class Transformation[source]ο
Bases:
objectCollection of transformation functions. Transformation functions are applied element-wise or as join operations (e.g., Softmax, Transpose).
- EXP: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- IDENTITY: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- INVERSE: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- LEAKY_RELU: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- LOG: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- LUKASIEWICZ: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- NORM: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- RELU: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- REVERSE: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- SIGMOID: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- SIGNUM: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- SOFTMAX: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- SPARSEMAX: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- SQRT: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- TANH: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο
- TRANSP: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>ο