Skip to content

Instantly share code, notes, and snippets.

View andreasgrv's full-sized avatar

Andreas Grivas andreasgrv

View GitHub Profile
@andreasgrv
andreasgrv / softmax-permutohedron.ipynb
Created October 30, 2024 15:48
Softmax-Permutohedron.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andreasgrv
andreasgrv / look-at-cube.ipynb
Last active October 14, 2024 14:58
What do we get if we look at a cube from the direction of one of the vertices?
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andreasgrv
andreasgrv / bool-arrangement.tex
Last active July 14, 2024 11:56
Boolean Hyperplane Arrangement in TikZ
% Built based on https://tikz.net/3d-plane-and-normal-vector/
\documentclass[crop,tikz]{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{matrix,math,tikzmark,intersections,through,backgrounds,shadows,scopes,fit,calc,patterns,quotes,arrows.meta,positioning, shapes.geometric}
\definecolor{clr1}{RGB}{228,26,28}
\definecolor{clr2}{RGB}{55,126,184}
\definecolor{clr3}{RGB}{77,175,74}
@andreasgrv
andreasgrv / hotstarting.ipynb
Last active July 4, 2024 13:03
HiGHS LP halfspace intersections + hotstarting
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andreasgrv
andreasgrv / zonotope-hyperplane-intersection.ipynb
Last active March 25, 2022 23:06
Visualisation of zonotope / hyperplane intersection
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andreasgrv
andreasgrv / out.txt
Last active November 28, 2017 13:34
Approximation of samples from a normal by summing samples of uniform.How close to the max value of the Box Muller transform (https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform clamp at 6.66 standard deviations when using float32) can we get when using a sum of iid uniform samples ?
Got absmax : 2.6663 after 100 iters and 0.00 secs
Got absmax : 2.8621 after 200 iters and 0.00 secs
Got absmax : 3.0409 after 600 iters and 0.00 secs
Got absmax : 3.3918 after 700 iters and 0.00 secs
Got absmax : 3.3950 after 1000 iters and 0.00 secs
Got absmax : 3.6232 after 1100 iters and 0.00 secs
Got absmax : 3.7237 after 2900 iters and 0.01 secs
Got absmax : 3.8769 after 4200 iters and 0.01 secs
Got absmax : 4.0837 after 13400 iters and 0.04 secs
Got absmax : 4.1979 after 71500 iters and 0.17 secs
@andreasgrv
andreasgrv / dotpath.py
Created May 13, 2016 18:42
Python metaclass experimentation (python 2.7) applied on creating paths
""" experiment on whether we can make a more intuitive interface
for paths by (ab)using metaclasses :D
result :
s = DotPath.myfolder
versus:
s = os.path.join('home','user','myfolder')"""
import os
import codecs
@andreasgrv
andreasgrv / command_version.sh
Created November 19, 2015 11:32
Check which flag is used more to get the version of the command ( -version or --version ). Began this after being totally annoyed that java --version doesn't work.
#!/bin/bash
total_commands=0
count_one_dash=0
count_two_dash=0
commands_only_one_dash=0
for command in bash gcc java python perl gunzip unzip less cat vi nano pico ls who find locate rm cp
do
((total_commands++))
eval "$command -version" > /dev/null 2>&1
ret_code=$?
@andreasgrv
andreasgrv / Makefile
Last active July 7, 2019 19:33
An example of python boost use for a python - C++ interface utilizing python lists as arguments
drow.so:
g++ -Wall -shared -fPIC -o drow.so drow.cpp -std=c++0x -lboost_python -I/usr/include/python2.7
@andreasgrv
andreasgrv / dataset.py
Created January 19, 2015 07:31
RobinCould
""" module for dataset stuff """
import pandas as pd
def text_counts(filename, label_col):
"""Get counts for how many texts there are for each type of author
:labels: The different classes the data belongs to
:returns: list of numbers of counts
"""