Skip to content

Instantly share code, notes, and snippets.

View nicknytko's full-sized avatar

Nicolas Nytko nicknytko

View GitHub Profile
import numpy as np
import numpy.linalg as la
import plotly.graph_objects as go
def loss(x):
# put your loss function here
return x@x
def plot_loss_landscape(loss, directions, steps, res=25, scale=None):
assert(directions.shape[0] == 2)
@nicknytko
nicknytko / loss_plot.py
Created April 11, 2024 15:37
Plot loss landscape
import plotly.graph_objects as go
import torch
import torch.autograd.functional as autofun
import numpy as np
def loss(x):
return ...
def plot_loss_landscape(loss, directions, steps, res=25, scale=None):
assert(directions.shape[0] == 2)
@nicknytko
nicknytko / Sympy.ipynb
Created November 13, 2023 21:56
Sympy jupyter scribble
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nicknytko
nicknytko / graph.py
Last active March 9, 2020 17:49
helper function for drawing graphs (edges/vertices) in IPython notebooks
# https://gist.github.com/nicknytko/1dd749e5e3e3620ec0cc0aa8f2b70779
import numpy as np
import pygraphviz
import IPython.display as ipd
def _render_graph(graph, layout='dot'):
class TempFile:
def __init__(self):
self.data = b''
#include <iostream>
class OneTwoSixMonsters {
private:
int x, y, z;
public:
/* Declare these friend operator overloads. They are function that are not part of the class,
but we declare them to be friends so that they can access private variables/methods */
@nicknytko
nicknytko / main.lua
Created September 23, 2015 04:03
Grid-based raycasting based on http://lodev.org/cgtutor/raycasting.html
function love.load()
love.graphics.setBackgroundColor( 255, 255, 255 )
gridSize = 32
gridWidth = math.floor( love.window.getWidth( ) / gridSize )
gridHeight = math.floor( love.window.getHeight( ) / gridSize )
grid = { }
for x=0, gridWidth do