rrtucci / texnn

Python script that genetates LaTex code that draws a Neural Net as a causal DAG (Bayesian Network). Python wrapper for xy-pic LaTeX package.
MIT License
10 stars 1 forks source link

feature request: can mosaic handle nodes with uid's that are >1 character? #4

Closed murphyk closed 6 months ago

murphyk commented 6 months ago

I would like to write something like this, but obviously it is not parseable

mosaic = [
    "C1C2_C4",
    "X1X2X3X4",
...
]

Can you change the code so each line can have whitespace to separate entries, and where if an entry is _, it is a blank, eg.

mosaic = [
    "C1 C2 _   C4",
    "X1 X2 X3 X4",
...
]
rrtucci commented 6 months ago

Note that the name of a node can have any number of characters and can be a latex string. It's only the tile characters that need to be a single character.

At first I was going to use mosaic tiles with more than one character, but then I decided that tiles with more than one character would make the code unnecessarily complicated. 128 ansi characters should be enough for 128 different nodes. I've never drawn a DAG by hand with more than 50 nodes. Similarly, allowing white spaces between tiles would make coding unnecessarily difficult. Could be done, but would be a bit of a headache, and the output would still be the same.

An advantage of single character tiles is that you can convert the mosaic to a numpy array, and then use built in numpy methods to rotate the array by plus or minus 90 degrees. Sometimes I start drawing the DAG with time going from left to right, and then I decide that I want to rotate it so that time flows down, or up, or from right to left.

On Mon, Apr 15, 2024 at 2:20 PM Kevin P Murphy @.***> wrote:

I would like to write something like this, but obviously it is not parseable

mosaic = [ "C1C2_C4", "X1X2X3X4", ... ]

Can you change the code so each line can have whitespace to separate entries, and where if an entry is _, it is a blank, eg.

mosaic = [ "C1 C2 _ C4", "X1 X2 X3 X4", ... ]

— Reply to this email directly, view it on GitHub https://github.com/rrtucci/texnn/issues/4, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADZWTYMC2KLDHPG2MKBQVSLY5QK47AVCNFSM6AAAAABGH3L3FWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2DIMZSHEYTKOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

murphyk commented 6 months ago

Yes that makes sense.