Skip to content

Instantly share code, notes, and snippets.

@jgomezdans
jgomezdans / run_me.py
Last active December 29, 2023 21:03
testing_frameworks
import numpy as np
import numba
import jax.numpy as jnp
import jax
import time
import torch
import pandas as pd
from functools import partial
@GEOFBOT
GEOFBOT / Setting up a Flink cluster.md
Last active July 17, 2016 20:06
Guide to setting up a BlueData CentOS 6.7 / AWS Ubuntu 14.04 cluster for running Flink jobs
@karpathy
karpathy / min-char-rnn.py
Last active September 18, 2024 06:45
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@karpathy
karpathy / gist:587454dc0146a6ae21fc
Last active July 11, 2024 10:36
An efficient, batched LSTM.
"""
This is a batched LSTM forward and backward pass
"""
import numpy as np
import code
class LSTM:
@staticmethod
def init(input_size, hidden_size, fancy_forget_bias_init = 3):
@mblondel
mblondel / nmf_cd.py
Last active June 12, 2019 20:00
NMF by coordinate descent
"""
NMF by coordinate descent, designed for sparse data (without missing values)
"""
# Author: Mathieu Blondel <mathieu@mblondel.org>
# License: BSD 3 clause
import numpy as np
import scipy.sparse as sp
import numba
@vrilleup
vrilleup / spark-svd.scala
Last active July 22, 2024 11:10
Spark/mllib SVD example
import org.apache.spark.mllib.linalg.distributed.RowMatrix
import org.apache.spark.mllib.linalg._
import org.apache.spark.{SparkConf, SparkContext}
// To use the latest sparse SVD implementation, please build your spark-assembly after this
// change: https://github.com/apache/spark/pull/1378
// Input tsv with 3 fields: rowIndex(Long), columnIndex(Long), weight(Double), indices start with 0
// Assume the number of rows is larger than the number of columns, and the number of columns is
// smaller than Int.MaxValue
package com.etsy.scalding.jobs
import com.twitter.scalding._
class TouchTheVoid(args : Args) extends Job(args) {
// 25M (Long, Double) pairs.
val scores = SequenceFile("stuff", ('id, 'score, 'stuff))
.project('id, 'score)
@aras-p
aras-p / preprocessor_fun.h
Last active September 8, 2024 07:43
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@rjhall
rjhall / SVD.scala
Last active December 20, 2015 22:08
import org.apache.commons.math3.linear._
import com.twitter.algebird.Operators._
import com.twitter.scalding._
import cascading.pipe.Pipe
import cascading.pipe.joiner.InnerJoin
import cascading.tuple.Fields
object SVD extends Serializable {