Skip to content

Instantly share code, notes, and snippets.

View floringogianu's full-sized avatar
🐳
Chasing Moby-Dick

Florin Gogianu floringogianu

🐳
Chasing Moby-Dick
View GitHub Profile
@nmwsharp
nmwsharp / printarr
Last active August 15, 2024 01:43
Pretty print tables summarizing properties of tensor arrays in numpy, pytorch, jax, etc. --- now on pip: `pip install arrgh`
Pretty print tables summarizing properties of tensor arrays in numpy, pytorch, jax, etc.
Now on pip! `pip install arrgh` https://github.com/nmwsharp/arrgh
@antoinebrl
antoinebrl / README.md
Last active November 8, 2024 03:09
Prepare ImageNet

Preparation of ImageNet (ILSVRC2012)

The dataset can be found on the official website if you are affiliated with a research organization. It is also available on Academic torrents.

This script extracts all the images and group them so that folders contain images that belong to the same class.

  1. Download the ILSVRC2012_img_train.tar and ILSVRC2012_img_val.tar
  2. Download the script wget https://gist.githubusercontent.com/antoinebrl/7d00d5cb6c95ef194c737392ef7e476a/raw/dc53ad5fcb69dcde2b3e0b9d6f8f99d000ead696/prepare.sh
  3. Run it ./prepare.sh
@aisu-wata0
aisu-wata0 / ParamRepeatPruner.py
Last active November 5, 2024 12:15
For optuna/optuna#2021. Class that prunes trials with the same parameters as past trials. You also can allow repeats if you want, and get the average of these past trials instead of pruning.
import optuna
from optuna.trial import TrialState
import numpy as np
from typing import Dict, List, Optional
from collections import defaultdict
class ParamRepeatPruner:
"""Prunes reapeated trials, which means trials with the same paramters won't waste time/resources."""
@alonsosilvaallende
alonsosilvaallende / inset_axes.ipynb
Created August 21, 2020 12:44
inset_axes.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pierrelux
pierrelux / exact_pg.py
Created July 17, 2019 21:28
Exact Policy Gradient in jax, demonstrated in figure 2d of Dadashi et al. (2019)
import jax
import jax.numpy as np
from jax import grad, jit
from jax.scipy.special import logsumexp
def dadashi_fig2d():
""" Figure 2 d) of
''The Value Function Polytope in Reinforcement Learning''
by Dadashi et al. (2019) https://arxiv.org/abs/1901.11524
@floringogianu
floringogianu / null.py
Created December 8, 2017 15:53 — forked from fish830617/null.py
Calculate the null space of a matrix by QR factorization.
# null.py
import numpy as np
from scipy.linalg import qr
def qr_null(A, tol=None):
Q, R, P = qr(A.T, mode='full', pivoting=True)
tol = np.max(A) * np.finfo(R.dtype).eps if tol is None else tol
rnk = min(A.shape) - np.abs(np.diag(R))[::-1].searchsorted(tol)
return Q[:, rnk:].conj()
@max-mapper
max-mapper / bibtex.png
Last active November 6, 2024 09:03
How to make a scientific looking PDF from markdown (with bibliography)
bibtex.png
@kylemcdonald
kylemcdonald / matplotlib Border Removal.ipynb
Last active August 7, 2024 22:00
How to (mostly) remove all borders and padding with matplotlib.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@awjuliani
awjuliani / Deep-Recurrent-Q-Network.ipynb
Last active July 18, 2023 19:18
An implementation of a Deep Recurrent Q-Network in Tensorflow.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.