This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import inspect # for line number | |
| import re # for extracting debug information | |
| _check_expr_regex = re.compile('THEANO_CHECK_EXPR\(.+\)') | |
| def THEANO_CHECK_EXPR( expr, verbose = False ): | |
| """ | |
| Check the expression | |
| Limited resolution at the line level | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Do not use ax.set_xticks([]), instead | |
| ax.get_xaxis().set_visible(False); | |
| # When having a bunch of plots in a grid (via subplots or gridspec), | |
| # we can plot the title as the ylabel of the left-most plot. | |
| # http://matplotlib.org/users/text_props.html | |
| ax.set_ylabel('<text_of_the_title>', rotation = 'horizontal', horizontalalignment = 'right'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % Some useful tips | |
| % Ref: http://emacsclub.github.io/html/matlab.html | |
| % There are some other http://emacsclub.github.io/html/index.html | |
| % http://ubcmatlabguide.github.io/html/gettingStarted.html | |
| % Check if a parameter called 'arg1' of a function exists | |
| if ~exist('arg1','var') || isempty(arg1) | |
| disp(arg1) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import networkx as nx | |
| import matplotlib.pyplot as plt | |
| #embedding_coords = nx.spring_layout(G) | |
| embedding_coords = nx.graphviz_layout(G) | |
| #embedding_coords = nx.spectral_layout(G) | |
| #embedding_coords = nx.random_layout(G) | |
| # stored_coords = nx.get_node_aattributes(G, 'embedding') | |
| # for k,v in stored_coords.iteritems(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <meta charset="utf-8"> | |
| <title>Votre Titre</title> | |
| <style> | |
| .node circle { | |
| fill: #fff; | |
| stroke: steelblue; | |
| stroke-width: 1.5px; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Recursively reload depedencies | |
| # Ref: https://ipython.org/ipython-doc/dev/interactive/reference.html#dreload | |
| from IPython.lib.deepreload import reload as dreload | |
| # %load_ext autoreload | |
| # %autoreload 2 | |
| import numpy as np | |
| import scipy.io as sio | |
| import json # export data for d3 visualization | |
| from mlearn_hclust import hierarchical_clustering |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json # export data for d3 visualization | |
| import numpy as np | |
| import scipy.cluster.hierarchy as hclust | |
| ## Compute histogram based on the Wasserstein distance matrix | |
| def build_json_tree(node, parent): | |
| """ | |
| Build a tree for the json format | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached 2>/dev/null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Find an optimal way to explore the Olympic Park west of Seattle | |
| Ref: http://www.nps.gov/olym/planyourvisit/gettingaround.htm | |
| """ | |
| import z3 | |
| # import matplotlib.pyplot as plt | |
| # import seaborn as sns | |
| # sns.set_context("paper") # also: talk, poster, etc. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import OpenEXR, Imath | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| def exr_split_channels(exr_fname): | |
| """ | |
| Load a Mitsuba render generated multi-channel OpenEXR file. | |
| Split the channels according to the information stored. | |
| """ | |
| ## Load all images |
OlderNewer