neuralogic.core.constructs

Submodules

neuralogic.core.constructs.factories

class AtomFactory[source]

Bases: object

class Predicate(hidden=False, special=False)[source]

Bases: object

get(name: str) BaseRelation[source]
static get_predicate(name, arity, hidden, special) Predicate[source]
property hidden: Predicate
property special: Predicate
get(name: str) BaseRelation[source]
class ConstantFactory[source]

Bases: object

get(item: str, const_type: str | None = None) Constant[source]
class VariableFactory[source]

Bases: object

get(item: str, var_type: str | None = None) Variable[source]

neuralogic.core.constructs.function

class Aggregation[source]

Bases: object

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: object

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: object

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>
reshape: Reshape = <neuralogic.core.constructs.function.reshape.Reshape 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>
slice: Slice = <neuralogic.core.constructs.function.slice.Slice 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, function: Function)[source]

Bases: object

function
static get_flattened_nodes(nodes, function: Function)[source]
property name
nodes
to_function() Function[source]
to_str(parentheses_wrap: bool = False)[source]
class Function(name: str, *, namespace: str = '', operator: str | None = None, can_flatten: bool = False)[source]

Bases: object

can_flatten
get()[source]
is_parametrized() bool[source]
name: str
namespace
operator: str | None
pretty_str() str[source]
process_head(head) Function[source]
rule_head_dependant() bool[source]
wrap(content: str) str[source]
class Transformation[source]

Bases: 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>
NORM: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>
RELU: TransformationFunction = <neuralogic.core.constructs.function.function.TransformationFunction object>
RESHAPE: Reshape = <neuralogic.core.constructs.function.reshape.Reshape 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>
SLICE: Slice = <neuralogic.core.constructs.function.slice.Slice 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.java_objects

neuralogic.core.constructs.metadata

class Metadata(learnable: bool | None = None, transformation: str | TransformationFunction | CombinationFunction | None = None, combination: str | CombinationFunction | None = None, aggregation: str | AggregationFunction | None = None, duplicit_grounding: bool | None = None)[source]

Bases: object

aggregation
combination
combine(other: Metadata) Metadata[source]
copy() Metadata[source]
duplicit_grounding
static from_iterable(iterable: Iterable) Metadata[source]
learnable
transformation

neuralogic.core.constructs.predicate

class Predicate(name, arity, hidden=False, special=False)[source]

Bases: object

arity
hidden
name
set_arity(arity)[source]
special
to_str()[source]
class PredicateMetadata(predicate: Predicate, metadata: Metadata)[source]

Bases: object

metadata
predicate

neuralogic.core.constructs.relation

class BaseRelation(predicate: Predicate, terms=None, function: TransformationFunction | CombinationFunction = None, negated: bool = False)[source]

Bases: object

property T: BaseRelation
attach_activation_function(function: TransformationFunction | CombinationFunction)[source]
function
negated
predicate
terms
to_str(end=False) str[source]
class WeightedRelation(weight, predicate: Predicate, fixed=False, terms=None, function: TransformationFunction | CombinationFunction = None)[source]

Bases: BaseRelation

property T: WeightedRelation
attach_activation_function(function: Transformation | Combination)[source]
fixed() WeightedRelation[source]
is_fixed
to_str(end=False)[source]
weight
weight_name

neuralogic.core.constructs.rule

class Rule(head, body)[source]

Bases: object

body
head
metadata: Metadata | None
to_str(_: bool = False) str[source]
class RuleBody(lit1, lit2)[source]

Bases: object

literals
metadata