Questions tagged [hierarchical]

For issues relating to arranging data and/or resources in a hierarchy.

A hierarchy is an arrangement of items (objects, names, values, categories, resources, etc.) in which the items are represented as being "above," "below," or "at the same level as" one another. Abstractly, a hierarchy is simply an ordered set or an acyclic directed graph.

A hierarchy can link entities either directly or indirectly, and either vertically or horizontally. The only direct links in a hierarchy, insofar as they are hierarchical, are to one's immediate superior or to one of one's subordinates, although a system that is largely hierarchical can also incorporate alternative hierarchies. Indirect hierarchical links can extend "vertically" upwards or downwards via multiple links in the same direction, following a path. All parts of the hierarchy which are not linked vertically to one another nevertheless can be "horizontally" linked through a path by traveling up the hierarchy to find a common direct or indirect superior, and then down again.

568 questions
121
votes
3 answers

pandas dataframe select columns in multiindex

I have the following pd.DataFrame: Name 0 1 ... Col A B A B ... 0 0.409511 -0.537108 -0.355529 0.212134 ... 1 -0.332276 -1.087013 …
wfh
  • 1,553
  • 3
  • 12
  • 10
119
votes
3 answers

How to concatenate two layers in keras?

I have an example of a neural network with two layers. The first layer takes two arguments and has one output. The second should take one argument as result of the first layer and one additional argument. It should looks like this: x1 x2 x3 \ / …
rdo
  • 3,872
  • 6
  • 34
  • 51
66
votes
13 answers

Selecting columns from pandas MultiIndex

I have DataFrame with MultiIndex columns that looks like this: # sample data col = pd.MultiIndex.from_arrays([['one', 'one', 'one', 'two', 'two', 'two'], ['a', 'b', 'c', 'a', 'b', 'c']]) data =…
metakermit
  • 21,267
  • 15
  • 86
  • 95
21
votes
3 answers

php / Mysql best tree structure

I have to build a tree that will contain about 300 nodes inside it. The tree has no depth limitations. So it can have 3 or 15 levels. Each node can have an unlimited number of children. The priority is to get a complete tree / subtree the faster as…
Marm
  • 863
  • 2
  • 15
  • 30
19
votes
4 answers

How to get flat clustering corresponding to color clusters in the dendrogram created by scipy

Using the code posted here, I created a nice hierarchical clustering: Let's say the the dendrogram on the left was created by doing something like Y = sch.linkage(D, method='average') # D is a distance matrix cutoff = 0.5*max(Y[:,2]) Z =…
conradlee
  • 12,985
  • 17
  • 57
  • 93
18
votes
2 answers

Hierarchical enum in Java

Let's say I have a structure like this: Is it possible to create an enum that will return the string value of selected cell? For example: enum.GROUP_MAIN1.SUBGROUP1.COL1 will return value "COL1". I was looking for nested enums but didn't find the…
scof93
  • 359
  • 1
  • 4
  • 14
17
votes
1 answer

Create a spring boot application with multiple child contexts

I'm trying to create an application using spring boot with an hierarchical application context. My current main method looks like: public static void main(String[] args) { new SpringApplicationBuilder(TestApplication.class) …
16
votes
2 answers

Tensorflow: Hierarchical Softmax Implementation

I'm currently having text inputs represented by vector, and I want to classify their categories. Because they are multi-level categories, I meant to use Hierarchical Softmax. Example: - Computer Science - Machine Learning - NLP -…
Viet Phan
  • 1,999
  • 3
  • 23
  • 40
16
votes
1 answer

Hierarchical role/permissions based access

I want to build a Hierarchical Role Base access control. This is my current schema: Currently I have two options to build this system: Attach all required permission to a role (not-hierarchical) Attach only special "level" permissions and…
Cristian
  • 2,390
  • 6
  • 27
  • 40
15
votes
5 answers

Hierarchical json from flat with parent ID

http://jsfiddle.net/eYgGK/ I stole this script from a different post: function convertToHierarchy() { var arry = [ { "Id": "1", "Name": "abc", "Parent": "", "attr": "abc" }, { "Id": "2", "Name": "abc", "Parent": "1", "attr": "abc" }, {…
I Stand With Russia
  • 6,254
  • 8
  • 39
  • 67
12
votes
3 answers

Unable to set parent activity for new activities in Android Studio. Error: Hierarchical parent must already exist

I am starting to build my first app from developer.android.com. Recently switched to Android Studio and found that I can't set the hierarchical parent for the new activity (DisplayMessageActivity). It states "Hierarchical Parent must already exist".…
dknchris
  • 487
  • 9
  • 17
12
votes
1 answer

Assertion Error in columns in DataFrame with hierarchical indexing

Another pandas question: I have this table with hierarchical indexing: In [51]: from pandas import DataFrame f = DataFrame({'a': ['1','2','3'], 'b': ['2','3','4']}) f.columns = [['level1 item1', 'level1 item2'],['', 'level2 item2'], ['level3 item1',…
r_31415
  • 8,752
  • 17
  • 74
  • 121
11
votes
6 answers

Wordpress custom post type hierarchy and menu highlighting (current_page_parent)

I have created a custom post type of 'portfolio' and page with a template that retrieves all posts matching that custom post type. The problem is when I drill down into the actual post, the post seems to sit under 'blog' in the main menu…
Craig
  • 972
  • 3
  • 13
  • 38
11
votes
5 answers

How to select all parents of a node in a hierarchical mysql table?

I have a MySQL table that represents data for a tree GUI component, here's the structure of my table: treeTable ( id INT NOT NULL PRIMARY KEY, parentId INT, name VARCHAR(255) ); parentId is a self-referencing foreign key. Now I want to…
Ehsan Khodarahmi
  • 4,772
  • 10
  • 60
  • 87
11
votes
2 answers

Single mysql select on join tables to a json hierarchical fragment, how?

What would be the best and most elegant way to retrieve from a single MySQL select query all the information from two joined tables, but in a hierarchical way? I have those two tables: ----------------- ------------------ | Table COMPANY | …
1
2 3
37 38