Implicational systemΒΆ
[1]:
from galactic.rules import \
HasseDiagramOrderedBasis, \
CanonicalDirectBasis
from galactic.rules import Table
from galactic.population import Population
from galactic.characteristics import Key
from galactic.examples.arithmetic.strategies import \
MultipleStrategy, DivisorStrategy
individuals = [
{"x": 48, "y": 15},
{"x": 36, "y": 3},
{"x": 64, "y": 10}
]
population = Population(individuals)
strategies = [
MultipleStrategy(Key(name="x")),
DivisorStrategy(Key(name="x")),
MultipleStrategy(Key(name="y")),
DivisorStrategy(Key(name="y")),
]
[2]:
from galactic.algebras.poset.collections import HasseDiagram
from galactic.concepts.lattice import Lattice
lattice = Lattice(
population=population,
strategies=strategies
)
[3]:
HasseDiagram(lattice)
[3]:
[4]:
display(*lattice)
Predicates:
M(x,4)
D(x,576)
M(y,1)
D(y,30)
Individuals:
0
1
2
Predicates:
M(x,16)
D(x,192)
M(y,5)
D(y,30)
Individuals:
0
2
Predicates:
M(x,12)
D(x,144)
M(y,3)
D(y,15)
Individuals:
0
1
Predicates:
M(x,64)
D(x,64)
M(y,10)
D(y,10)
Individuals:
2
Predicates:
M(x,48)
D(x,48)
M(y,15)
D(y,15)
Individuals:
0
Predicates:
M(x,36)
D(x,36)
M(y,3)
D(y,3)
Individuals:
1
Predicates:
M(x,0)
D(x,1)
M(y,0)
D(y,1)
Individuals:
[5]:
Table(HasseDiagramOrderedBasis(lattice=lattice), support=0.0)
[5]:
Premises |
Conclusions |
Support |
Confidence |
---|---|---|---|
|
1 |
1 |
|
|
|
1 |
1 |
|
|
0.666667 |
1 |
|
|
0.666667 |
1 |
|
|
0.666667 |
1 |
|
|
0.666667 |
1 |
|
|
0.666667 |
1 |
|
|
0.666667 |
1 |
|
|
0.666667 |
1 |
|
|
0.666667 |
1 |
|
|
0.666667 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
[6]:
Table(CanonicalDirectBasis(lattice=lattice), support=0.0)
[6]:
Premises |
Conclusions |
Support |
Confidence |
---|---|---|---|
|
1 |
1 |
|
|
|
0.666667 |
1 |
|
|
0.666667 |
1 |
|
|
0.666667 |
1 |
|
|
0.666667 |
1 |
|
|
0.666667 |
1 |
|
|
0.666667 |
1 |
|
|
0.666667 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |
|
|
0.333333 |
1 |