Giter VIP home page Giter VIP logo

Comments (3)

xflr6 avatar xflr6 commented on July 19, 2024
import concepts

SRC = ''',does_carry_transport,has_wheels,does_drive_is_driven,has_a_seat_seats,made_of_metal
bus0,X,X,X,,
bus1,,X,X,X,
bus2,X,X,X,,
bus3,X,,X,X,
bus4,,X,X,X,
bus5,X,,X,X,
bus6,,X,,X,X
bus7,,X,X,,X
bus8,,X,X,,X
bus9,X,X,,,X
bus10,X,X,X,,
bus11,X,,,X,X
bus12,,X,,X,X
bus13,X,X,X,,
bus14,X,X,,X,
bus15,,X,X,X,
bus16,X,X,,,X
bus17,,X,X,X,
bus18,X,X,,,X
bus19,X,X,,X,'''

c = concepts.make_context(SRC, frmat='csv')
c.lattice.graphviz()

spam

All labels of the properties are in the topmost layer (below the supremum concept node). This is indeed expected here. The property labels are attached to the most general (highest) concept that has the property, while the object labels are attached to the most specific (lowest) concept that has the object. You can go up/down the graph collecting property/object labels to read the intent/extent of a concept (i.e. node). See an FCA itroduction for details, e.g. https://www.springer.com/de/book/9783540627715

print(c)
<Context object mapping 20 objects to 5 properties at 0x55f1a20>
         |does_carry_transport|has_wheels|does_drive_is_driven|has_a_seat_seats|made_of_metal|
    bus0 |X                   |X         |X                   |                |             |
    bus1 |                    |X         |X                   |X               |             |
    bus2 |X                   |X         |X                   |                |             |
    bus3 |X                   |          |X                   |X               |             |
    bus4 |                    |X         |X                   |X               |             |
    bus5 |X                   |          |X                   |X               |             |
    bus6 |                    |X         |                    |X               |X            |
    bus7 |                    |X         |X                   |                |X            |
    bus8 |                    |X         |X                   |                |X            |
    bus9 |X                   |X         |                    |                |X            |
    bus10|X                   |X         |X                   |                |             |
    bus11|X                   |          |                    |X               |X            |
    bus12|                    |X         |                    |X               |X            |
    bus13|X                   |X         |X                   |                |             |
    bus14|X                   |X         |                    |X               |             |
    bus15|                    |X         |X                   |X               |             |
    bus16|X                   |X         |                    |                |X            |
    bus17|                    |X         |X                   |X               |             |
    bus18|X                   |X         |                    |                |X            |
    bus19|X                   |X         |                    |X               |             |

Note that from this follows that one property label can only be on a path below another one, if the higher one subsumes the lower one (equivalently, the lower property implies the higher) within the context (i.e. all objects having the lower one also have the higher one), which is not the case for the properties in this case (the properties are almost all completely orthogonal):

print(c.relations())
does_carry_transport subcontrary  has_wheels
has_wheels           subcontrary  has_a_seat_seats

Compare this with relations.csv you cite:

import concepts

SRC = '''name,relation,transitive,symmetric,antisymmetric,reflexive,irreflexive,asymmetric,neg. trans.,connected,total,trichotomous
irrefl.,X,,,,,X,,,,,
tolerance,X,,X,,X,,,,,,
equivalence,X,X,X,,X,,,,,,
preorder,X,X,,,X,,,,,,
partial order,X,X,,X,X,,,,,,
total order,X,X,,X,X,,,X,X,X,
strict partial order,X,X,,X,,X,X,,,,
strict weak order,X,X,,X,,X,X,X,,,
strict total order,X,X,,X,,X,X,X,X,,X
R = X = {},X,X,X,X,X,X,X,X,X,X,X'''

c = concepts.make_context(SRC, frmat='csv')
print(c)
<Context object mapping 10 objects to 11 properties at 0x55dba58>
                        |relation|transitive|symmetric|antisymmetric|reflexive|irreflexive|asymmetric|neg. trans.|connected|total|trichotomous|
    irrefl.             |X       |          |         |             |         |X          |          |           |         |     |            |
    tolerance           |X       |          |X        |             |X        |           |          |           |         |     |            |
    equivalence         |X       |X         |X        |             |X        |           |          |           |         |     |            |
    preorder            |X       |X         |         |             |X        |           |          |           |         |     |            |
    partial order       |X       |X         |         |X            |X        |           |          |           |         |     |            |
    total order         |X       |X         |         |X            |X        |           |          |X          |X        |X    |            |
    strict partial order|X       |X         |         |X            |         |X          |X         |           |         |     |            |
    strict weak order   |X       |X         |         |X            |         |X          |X         |X          |         |     |            |
    strict total order  |X       |X         |         |X            |         |X          |X         |X          |X        |     |X           |
    R = X = {}          |X       |X         |X        |X            |X        |X          |X         |X          |X        |X    |X           |

E.g. all transitive relations in the context are also antisymmetric (we are still missing some relation kinds so that the graph would only show us implications that are inhertently true for all relations, but it also contains this kind such as asymmetric -> antisymmetric).

print(c.relations())
antisymmetric implication  transitive
asymmetric    implication  transitive
neg. trans.   implication  transitive
connected     implication  transitive
total         implication  transitive
trichotomous  implication  transitive
symmetric     implication  reflexive
asymmetric    implication  antisymmetric
neg. trans.   implication  antisymmetric
connected     implication  antisymmetric
total         implication  antisymmetric
trichotomous  implication  antisymmetric
total         implication  reflexive
asymmetric    implication  irreflexive
trichotomous  implication  irreflexive
trichotomous  implication  asymmetric
connected     implication  neg. trans.
total         implication  neg. trans.
trichotomous  implication  neg. trans.
total         implication  connected
trichotomous  implication  connected
reflexive     subcontrary  irreflexive

from concepts.

vsraptor avatar vsraptor commented on July 19, 2024

I see. I seem to get confused because all the diagrams in papers on the subject use pair of SETS as a labels i.e. have a label/value for every point of the diagram

from concepts.

xflr6 avatar xflr6 commented on July 19, 2024

Yeah, it saves some space. AFAIK, this is the canonical way of drawing the concept graphs, see e.g. https://en.wikipedia.org/wiki/Formal_concept_analysis#/media/File:FCA_body_of_water.svg or http://www.upriss.org.uk/fca/examples.html

from concepts.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.