This file contains 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 torch | |
from datetime import datetime | |
if __name__ == '__main__': | |
num_dims = 3 | |
dim = 1024 | |
for _ in range(10): |
This file contains 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 torch | |
import torchvision | |
import torchvision.transforms as transforms | |
import torch.optim as optim | |
import torch.nn as nn | |
import umap | |
import matplotlib.pyplot as plt | |
import json | |
trinity_template = { |
This file contains 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 torch | |
import torchvision | |
import torchvision.transforms as transforms | |
import torch.optim as optim | |
import torch.nn as nn | |
import umap | |
import matplotlib.pyplot as plt | |
# Check whether GPU is available and define it as a device | |
is_gpu_available = torch.cuda.is_available() |
This file contains 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 torch | |
import matplotlib.pyplot as plt | |
def generate_basis(num_channels, height, width): | |
zero_tensor = torch.zeros((num_channels, height, width)) | |
for i in range(num_channels): | |
for j in range(height): | |
for k in range(width): | |
basis_element = torch.clone(zero_tensor) |
This file contains 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 | |
# Give me some random vectors | |
def random_vectors_generator(dimension=10, num_vectors=10): | |
for _ in range(num_vectors): | |
yield np.random.rand(dimension) | |
# Give me a random distance matrix |
This file contains 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 | |
from random import sample | |
# The Jaccard distance is truly a metric: https://arxiv.org/pdf/1612.02696.pdf | |
def jaccard_distance(set1: set, set2: set): | |
union_size = len(set1.union(set2)) | |
intersection_size = len(set1.intersection(set2)) | |
return 1 - (intersection_size / union_size) |
This file contains 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
hey look here's me writing something |
This file contains 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
# modified from this: | |
# https://github.com/iaciac/py-draw-simplicial-complex/blob/master/Draw%202d%20simplicial%20complex.ipynb | |
from copy import copy | |
import networkx as nx | |
import itertools | |
import matplotlib.pyplot as plt | |
import numpy as np |
This file contains 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
amount line = read (splitOn "from" ((splitOn "move" line)!!1)!!0) :: Int | |
src line = read (splitOn "to" ((splitOn "from" line)!!1)!!0) :: Int | |
dst line = read (splitOn "to" ((splitOn "from" line)!!1)!!1) :: Int |
This file contains 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
-- sexpr parsing in Haskell | |
import Data.SCargot | |
import Data.SCargot.Language.Basic | |
import Data.Text | |
main = do | |
print (decode basicParser (pack "(- (+ 1 2) 3)")) |