In [1]:
from IPython.display import HTML

HTML('''<script>
code_show=true; 
function code_toggle() {
 if (code_show){
 $('div.input').hide();
 } else {
 $('div.input').show();
 }
 code_show = !code_show
} 
$( document ).ready(code_toggle);
</script>
The raw code for this Jupyter notebook is by default hidden for easier reading. To toggle on/off the raw code, click <a href="javascript:code_toggle()">here</a>.''')
Out[1]:
The raw code for this Jupyter notebook is by default hidden for easier reading. To toggle on/off the raw code, click here.
In [2]:
import matplotlib as mpl
import networkx as nx
import visJS2jupyter.visJS_module
import visJS2jupyter.visualizations as visualizations

G = nx.Graph()
In [3]:
# nodes

# topics
topics = ["Approximation Theory",
          "Harmonic Analysis",
          "Neuroscience",
          "Statistics/Machine Learning",
          "Optimization"]
G.add_nodes_from(topics)

# questions
questions = ["Overfitting",
             "Regularization",
             "Implicit regularization",
             "Generalization",
             "Curse of dimensionality",
             "Deep versus shallow",
             "Landscape of loss",
             "Biological plausibility",
             "Robustness to noise",
             "Stability to deformations",
             "Energy propagation",
             "Translation invariance",
             "Invariance to intraclass variability",
             "Generative modeling",
             "Architectures as inference algorithms",
             "Interpretation of tricks",
             "Sparse coding",
             "Network design"]
G.add_nodes_from(questions)

# lectures in the stats385 course
lectures = ["Lecture 3:\nHelmut Bolcskei",
            "Lecture 4:\nAnkit Patel",
            "Lecture 5:\nTomaso Poggio"]
G.add_nodes_from(lectures)

nodes = G.nodes()

nodes_shape = []
node_shape = ['square' if (node in topics) else ('dot' if (node in questions) else 'star') for node in G.nodes()]
node_to_shape = dict(zip(G.nodes(),node_shape))

nodes_size = []
node_size = [5 if (node in topics) else (4 if (node in questions) else 3) for node in G.nodes()]
node_to_size = dict(zip(G.nodes(),node_size))

node_to_color = []
node_color = ['#800080' if (node in topics) else ('#C70039' if (node in questions) else '#FFC300') for node in G.nodes()]
node_to_color = dict(zip(G.nodes(),node_color))
In [4]:
# edges

# topics and questions
topics_questions = [("Approximation Theory","Curse of dimensionality",{'title':"How does deep learning overcome the curse of dimensionality?"}),
                    ("Approximation Theory","Deep versus shallow",{'title':"When and why are deep networks better than shallow networks?"}),
                    ("Harmonic Analysis","Translation invariance",{'title':"Are the features computed by deep architectures translation invariant or covariant?"}),
                    ("Harmonic Analysis","Stability to deformations",{'title':"Are the features stable to deformations?"}),
                    ("Harmonic Analysis","Energy propagation",{'title':"How does the energy of the features behave as function of the layer and can we tune it?"}),
                    ("Harmonic Analysis","Robustness to noise",{'title':"If noise is added to the input of the architecture, do the estimated feature representations remain stable?"}),
                    ("Harmonic Analysis","Invariance to intraclass variability",{'title':"Is the network learning invariance to certain variabilities?"}),
                    ("Harmonic Analysis","Network design",{'title':"How should we design the architecture?"}),
                    ("Neuroscience","Biological plausibility",{'title':"Are modern architectures biologically plausible?"}),
                    ("Statistics/Machine Learning","Overfitting",{'title':"How can deep learning not overfit?"}),
                    ("Statistics/Machine Learning","Regularization",{'title':"How does the network manage to generalize without regularization despite the large number of parameters?"}),
                    ("Statistics/Machine Learning","Implicit regularization",{'title':"Is there any implicit regularization in the network?"}),
                    ("Statistics/Machine Learning","Generalization",{'title':"What does the generalization capability of a network rely on?"}),
                    ("Statistics/Machine Learning","Generative modeling",{'title':"Is there a generative model behind deep learning architectures and if so what is it?"}),
                    ("Statistics/Machine Learning","Architectures as inference algorithms",{'title':"Can we interpret certain networks as an inference algorithm under a generative model?"}),
                    ("Statistics/Machine Learning","Interpretation of tricks",{'title':"What is the importance of different tricks?"}),
                    ("Statistics/Machine Learning","Sparse coding",{'title':"Why do the filters trained in the first layer resemble those obtained from sparse coding?"}),
                    ("Optimization","Landscape of loss",{'title':"What is the landscape of the objective function being minimized?"})]
G.add_edges_from(topics_questions)

# lectures and questions
lectures_questions = [("Lecture 3:\nHelmut Bolcskei","Translation invariance",{'title':"Features become more translation invariant with increasing network depth."}),
                      ("Lecture 3:\nHelmut Bolcskei","Stability to deformations",{'title':"For certain classes of signals, the features are stable to deformations."}),
                      ("Lecture 3:\nHelmut Bolcskei","Energy propagation",{'title':"The energy of the features decays exponentially or polynomially, depending on the assumptions on the filters."}),
                      ("Lecture 3:\nHelmut Bolcskei","Network design",{'title':"Filters or number of layers can be designed for energy preservation."}),
                      ("Lecture 3:\nHelmut Bolcskei","Deep versus shallow",{'title':"Depth width tradeoff for networks with wavelet filters."}),
                      ("Lecture 4:\nAnkit Patel","Generative modeling",{'title':"NN-DRMM: a heirarchical generative deep sparse coding model."}),
                      ("Lecture 4:\nAnkit Patel","Architectures as inference algorithms",{'title':"Convnets are a max-sum-product message passing bottom-up inference algorithm."}),
                      ("Lecture 4:\nAnkit Patel","Interpretation of tricks",{'title':"ReLU and max pooling as max-marginalization."}),
                      ("Lecture 4:\nAnkit Patel","Sparse coding",{'title':"Only the sparse set of active paths matter for the final decision of the convnet."}),
                      ("Lecture 5:\nTomaso Poggio","Deep versus shallow",{'title':"For compositional functions deep networks avoid the curse of dimensionality because of locality of constituent functions."}),
                      ("Lecture 5:\nTomaso Poggio","Landscape of loss",{'title':"Many global minima that are found by SGD with high probability."}),
                      ("Lecture 5:\nTomaso Poggio","Overfitting",{'title':"Gradient descent avoids overfitting without explicit regularization, despite overparametrization."}),
                      ("Lecture 5:\nTomaso Poggio","Implicit regularization",{'title':"Gradient descent results in implicit regularization in deep linear networks."})]
G.add_edges_from(lectures_questions)

edges = G.edges(data=True)

edge_to_color = []
edge_color = ['gray' if (edge in topics_questions) else 'gray' for edge in G.edges()]
edge_to_color = dict(zip(G.edges(),edge_color))
In [5]:
# set node initial positions using networkx's spring_layout function
pos = nx.spring_layout(G)

nodes_dict = [{"id":n,
               "color":node_to_color[n],
               "node_shape":node_to_shape[n],
               "degree":node_to_size[n],
               "x":pos[n][0]*1000,
               "y":pos[n][1]*1000} for n in nodes]
node_map = dict(zip(nodes,range(len(nodes))))  # map to indices for source/target in edges
edges_dict = [{"source":node_map[edges[i][0]], "target":node_map[edges[i][1]], 
              "color":"gray",
              "title":edges[i][2]['title']} for i in range(len(edges))]

# set some network-wide styles
visJS2jupyter.visJS_module.visjs_network(nodes_dict,edges_dict,
                          node_size_multiplier=10,
                          node_size_transform = '',
                          node_color_highlight_border='black',
                          node_color_highlight_background='#8BADD3',
                          node_color_hover_border='blue',
                          node_color_hover_background='#8BADD3',
                          node_font_size=20,
                          edge_arrow_to=False,
                          physics_enabled=True,
                          edge_color_highlight='#8BADD3',
                          edge_color_hover='#8BADD3',
                          edge_width=3,
                          edge_title_field='title',
                          max_velocity=15,
                          min_velocity=1)
Out[5]:
Network | Basic usage