Structural hierarchical learning for energy networks