Skip to content

Instantly share code, notes, and snippets.

View fedelebron's full-sized avatar

Federico Lebrón fedelebron

View GitHub Profile
@fedelebron
fedelebron / dog-classifier-part-2-colab-edition.ipynb
Last active September 28, 2021 00:29
Dog Classifier, part 2 - Colab edition
Sorry, this is too big to display.
@fedelebron
fedelebron / dog-classifier.ipynb
Last active September 17, 2021 18:29
Transfer learning CNNs with JAX, part 1
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fedelebron
fedelebron / dog-classifier-colab-edition.ipynb
Created September 17, 2021 04:34
Dog Classifier - Colab Edition
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fedelebron
fedelebron / dog-classifier-colab-edition.ipynb
Created September 17, 2021 04:31
Dog Classifier - Colab Edition
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fedelebron
fedelebron / dog-classifier-colab-edition.ipynb
Created September 17, 2021 04:27
Dog Classifier - Colab Edition
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fedelebron
fedelebron / dog-classifier-colab-edition.ipynb
Created September 17, 2021 03:39
Dog Classifier - Colab Edition
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fedelebron
fedelebron / rho-property
Last active November 5, 2019 09:45
Short demo of a lambda calculus curiosity, from Mirai Ikebuchi, Keisuke Nakano "On repetitive right application of B-terms" 2018
{-# LANGUAGE OverloadedStrings #-}
import qualified Data.Set as S
import Data.String
import Data.List
type Var = String
data Expr = V Var | Ap Expr Expr | Lambda Var Expr
deriving Eq
@fedelebron
fedelebron / Permanent.hs
Created August 19, 2013 01:21
A function to compute the permanent of a matrix in Haskell. The algorithm is not as efficient as it could be - it is using the Ryser formula for an O(n^2 * 2^n) runtime, where a O(n * 2^n) algorithm exists, which uses the same idea but adds Gray codes to compute the subsets in a better order, allowing a reuse of computations.
{-# LANGUAGE FlexibleContexts #-}
import Data.Array.IArray (IArray, bounds)
import Data.Array.Unboxed (UArray)
import Data.Array.Base (unsafeAt)
import Data.Bits (popCount, testBit)
permanent :: (Integral a, IArray UArray a) => UArray (Int, Int) a -> a
permanent arr | n == m = (if even n then negate else id) (sum entries)
where
((0, 0), (n, m)) = bounds arr
@fedelebron
fedelebron / eratosthenes.cpp
Last active December 16, 2015 04:09
A small implementation of Eratosthenes' sieve.
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<bool> composite(n);
composite[0] = true; // Technically a zero divisor
composite[1] = true;
for (int i = 2; i*i < n; ++i) {
@fedelebron
fedelebron / MillerRabin.cpp
Created April 7, 2013 03:17
A small implementation of the Miller-Rabin primality test. This version is deterministic and correct for numbers up to 2,152,302,898,747.
typedef long long tint;
tint powmod(tint a, tint k, tint n) {
tint b = 1;
while (k) {
if (k & 1) {
--k;
b = (b * a) % n;
} else {
k >>= 1;