What do input layers represent in a Hierarchical Attention Network

I’m trying to grasp the idea of a Hierarchical Attention Network (HAN), most of the code i find online is more or less similar to the one here: https://medium.com/jatana/report-on-text-classification-using-cnn-rnn-han-f0e887214d5f :

embedding_layer=Embedding(len(word_index)+1,EMBEDDING_DIM,weights=[embedding_matrix], input_length=MAX_SENT_LENGTH,trainable=True) sentence_input = Input(shape=(MAX_SENT_LENGTH,), dtype='int32', name='input1') embedded_sequences = embedding_layer(sentence_input) l_lstm = Bidirectional(LSTM(100))(embedded_sequences) sentEncoder = Model(sentence_input, l_lstm)  review_input = Input(shape=(MAX_SENTS,MAX_SENT_LENGTH), dtype='int32',  name='input2') review_encoder = TimeDistributed(sentEncoder)(review_input) l_lstm_sent = Bidirectional(LSTM(100))(review_encoder) preds = Dense(len(macronum), activation='softmax')(l_lstm_sent) model = Model(review_input, preds) 

My question is: What do the input layers here represent? I’m guessing that input1 represents the sentences wrapped with the embedding layer, but in that case what is input2? Is it the output of the sentEncoder? In that case it should be a float, or if it’s another layer of embedded words, then it should be wrapped with an embedding layer as well.

Question about adding dropdown item through Hierarchical Select

I have added a dropwown item through Hierarchical Select. enter image description hereenter image description here The newly added item can be displayed properly on the client end. However, when a client selects the item and submits it, the system report an error”Plese select a campus”.error. I checked up the system log, got the following messages. Log Messages May I ask your help to fix it? Thank you!

Design patterns for hierarchical multiple selection

Given the hypothetical structure:

enter image description here

Representing a group of items that can be classified as type A or B, and each subtype can be classified as type C or D, and within D can be classified type E or F.

Where the user can choose to display All items, All items of type A or type B, any combination of C-F from A + any combination of C-F from B

This will be used as a filter where there are mutually exclusive states (e.g. you can’t select ALL and A at the same time, or select A and A/C at the same time) and also non-mutually exclusive states (e.g. you can select A/C and B/C). I want to implement this as a ‘toggle map’ where if the user selects ALL then every square will be selected (or unselected depending on the existing state). This then also allows users to select different combinations to analyze different subsets of data.

Is this type of user interaction too complex? Is there an alternate design pattern that allowing users to make multiple selections from a hierarchical structure while still able to show the relationship between each of the categories?

Efficiently listing all last-level descendants of each root in a proper hierarchical graph (bipartite DAG)

Let G = (V, E) be a graph which is hierarchical in the sense that its vertices are arranged in levels/layers (say 1 to k) and an edge can only be from a vertex at level i to a vertex at level i+1. Vertices at level 1 and k are called the roots and the leaves, respectively. The problem is to find all descendant leaves of each root. For instance, for the following graph, enter image description here

the answer would be: 1: 12, 13 2: 12, 13 3: 12, 13, 14, 15, 16 4: 14, 15, 16

A naive solution can be to run a DFS for each root which will take O(r(n+m)) time where r is #roots, n is #vertices and m is #edges.

Can we do better? Another way to see the same graph is that it is a bipartite DAG.

Nested (hierarchical) list needs solution for multi-select functionality

Our app requires us to allow users to created their own hierarchical groups, then associate documents with those groups.

In my opinion the biggest usability concern is that users also need to be able to select a parent node without necessarily selecting the child nodes.

Here’s an example. You’ve created a group, “United States” added a bunch of US employees. You’ve now created a subgroup for “Vampires.” You want to upload a sunlight policy for your US employees, but do NOT want it associated with the “vampires.”

Below is the best solution we have so far, but it seems inelegant. I’m not sure that if a user was uploading something they wanted to go to ALL US employees (vampires included) they’d know they had to select all United States options.

We tried making a duplicate option for parent nodes (so if there are children there is suddenly a US GROUP node and a US FOLDER node), but it was even more confusing – why were there TWO US’s

Thanks so much for your UX guru wisdom.

nested multi-select menu

Show parent items in hierarchical facet display

Taxonomy terms are configured as such:

Parent category 1 - Child category 1 - Child category 2  Parent category 2 - Child category 3 - Child category 4 

“Empty facet behaviour” is set to “Do not display facet”.

“Flatten hierarchy” is turned off.

“Treat parent items as individual facet items” is turned off.

But the facet display doesn’t show the parent items. How do I configure it properly to do so?

enter image description here enter image description here

Hierarchical / tree data – which type of database to use & design?

For querying (and writing to) a hierarchical structure (like a folder containing files and other folders, up to n levels deep, where n is pretty small, probably around 10, and there would be lots of files… I’m totally guessing but there might be like 85% reads, 15% writes when restructuring or adding files), what would be a good database / schema to use? SQL with ..? NoSQL? GraphDB: OrientDB / Neo4j? I have a bit of experience with simple SQL using Postgres or MySQL (insert, select a from b where c, join / right outer join, etc) and otherwise generally have experience at application-level programming and with JSON.

If it matters, I plan on storing file paths to photos / videos and also storing related photo data (EXIF, etc) in either this database or a combo of databases (if that’s a thing, like querying all photo paths from one db and then querying all data related to each of the files represented by those file paths in another db?)… I also was thinking I’d just use the underlying filesystem to read/write to/from photo/video files.

This is more of a personal project and I don’t plan on scaling with distributed systems, etc. The actual photo / video storage space would probably span across several TiB of disk over time.

(Sorry if this seems vague. I’m just starting out and realized that my application suddenly seems a bit more complex since I feel the need to properly record my photo/video files and their place in the filesystem hierarchy in order to search over them and provide an API to my application to read/write from/to them (and to be able to re-order their positions in the filesystem hierarchy/tree).)

Display hierarchical structure and corresponding reference data

Do any of you have any suggestion on how to design view for reference data and make it easy to navigate and understand. We are developing a web application and have this hierarchical setup:

  • 1 corporation that can have X numbers of large teams below
  • Each large team can have X number of small teams below
  • A small team can belong to several larger teams (Z belongs to both A and B in the image below)
  • Each level in this hierarchy can have X numbers of accounts and GUI-users

enter image description here

We need to have a view (or perhaps views) where it’s possible to find all entities and view a details “page” with more information for each entity.

It should be possible to

  • query and find all larger and/or smaller teams
  • find all accounts a specific team owns
  • a user from a smaller team should be able to find all larger teams he belongs to
  • Given an account, find the smaller team that owns it and what larger teams it belongs to

We are considering a combinations of list structures, where the first one more or less acts as a tree structure and displays the hierarchal team structure. enter image description here

When selecting a team all users below that team are displayed as well as the details for the specific team. If/when selecting a user the details to the right is replaced with the user details. For a team you can in the details view see all teams that it belongs to/are below. The downside with this solution is that a smaller team will be duplicated in the tree structure under all larger teams it belongs to.


  • Anyone that has tried a similar solution?
  • Is it obvious that the users are only the ones that are on the specific node/entity you are viewing, so if you have selected Corporation you get only the users for that level, NOT all users (e.g all users below)?
    • Where/how should the accounts be displayed?

If anyone has a better solution I’m up for anything 🙂

What database would be ideal for storing hierarchical data, calculating rollups and paginating through them?

I’m working on the data model for a project that needs to store hierarchical data (similar to employee-supervisor relationship). The depth of the tree is unknown but usually less than 15.

The two primary use-cases are:

  1. Count the number of children (direct and indirect) under a node in real-time. Also needs the ability to filter the count based on additional criteria.
  2. Paginate through the actual records that make up the count. Also needs the ability to filter the results.

The size of the dataset is millions of records, but will never grow to billions of records.

What we’ve looked at:

Graph DB:

  • Since the data is essentially a tree.
  • It works pretty well for the 1st use-case. Latency is in milliseconds for almost the entire tree (except the root and one level below, which is in seconds).
  • Not sure how efficient pagination would be for a graph DB.


  • Postgres offers pretty similar performance to the graph DB with its recursive queries.
  • Works well for the second use-case too.
  • Not sure about scalability. Trend within company is to move away from Relational DB.


  • Won’t work for the first use-case (unless I use a materialized path, which may not work here since the hierarchy may change)
  • Works for the second use-case


  • For the first case, I could enable streaming and pre-calculate the counts, but I lose the filtering ability.

Am I missing out on any good candidates? Also, would it be better to use two separate solutions for the two use-cases?