Skip to content

Instantly share code, notes, and snippets.

@samithaj
samithaj / hyperband.py
Created November 26, 2019 11:48 — forked from PetrochukM/hyperband.py
Here we implement hyperband and successive halving adaptions. We found that the original hyperband implementation was messy and not tested. We also wanted to adapt it to include model reuse.
"""
We implement additional hyperparameter optimization methods not present in
https://scikit-optimize.github.io/.
Gist: https://gist.github.com/Deepblue129/2c5fae9daf0529ed589018c6353c9f7b
"""
import math
import logging
import random
@samithaj
samithaj / mem-ts-RNN.py
Created June 16, 2018 17:36 — forked from lukovkin/mem-ts-RNN.py
Memory-efficient training of RNNs (modified example) - see https://groups.google.com/forum/#!topic/keras-users/vnGMtKPu1Xc for the discussion
# Code for Jupyter/IPython Notebook environment
from keras.models import Sequential
from keras.layers.core import TimeDistributedDense, Activation, Dropout
from keras.layers.recurrent import GRU
import numpy as np
from keras.utils.layer_utils import print_layer_shapes
%matplotlib inline
import matplotlib.pyplot as plt
@samithaj
samithaj / tf_seq2seq_single_str_inference.py
Created January 20, 2018 06:27 — forked from noname01/tf_seq2seq_single_str_inference.py
Quick hack for loading seq2seq model and inference via feed_dict.
from pydoc import locate
import tensorflow as tf
import numpy as np
from seq2seq import tasks, models
from seq2seq.training import utils as training_utils
from seq2seq.tasks.inference_task import InferenceTask, unbatch_dict
class DecodeOnce(InferenceTask):
'''
@samithaj
samithaj / seq2seq.py
Created September 10, 2017 04:00 — forked from ilblackdragon/seq2seq.py
Example of Seq2Seq with Attention using all the latest APIs
import logging
import numpy as np
import tensorflow as tf
from tensorflow.contrib import layers
GO_TOKEN = 0
END_TOKEN = 1
UNK_TOKEN = 2

TensorFlow Serving in 10 minutes!

TensorFlow SERVING is Googles' recommended way to deploy TensorFlow models. Without proper computer engineering background, it can be quite intimidating, even for people who feel comfortable with TensorFlow itself. Few things that I've found particularly hard were:

  • Tutorial examples have C++ code (which I don't know)
  • Tutorials have Kubernetes, gRPG, Bezel (some of which I saw for the first time)
  • It needs to be compiled. That process takes forever!

After all, it worked just fine. Here I present an easiest possible way to deploy your models with TensorFlow Serving. You will have your self-built model running inside TF-Serving by the end of this tutorial. It will be scalable, and you will be able to query it via REST.

@samithaj
samithaj / radialBasis.scala
Created December 14, 2016 03:44 — forked from micrypt/radialBasis.scala
Radial Basis Function
import scala.math.{E, pow}
// Vector length
def vecLength(implicit values: List[Double]) = pow(values.sum, .5)
// Radial basis function
def rbf(v1: List[Double], v2: List[Double], gamma:Int = 20) = {
val dv = { for(i <- (0 to v1.length)) yield (v1(i)-v2(i)) }.toList
val l = vecLength(dv)
pow(E, (-gamma*l))
@samithaj
samithaj / .bash_profile
Created May 23, 2016 21:00 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@samithaj
samithaj / lastexport.py
Created April 28, 2016 16:00 — forked from bitmorse/lastexport.py
lastfm scrobble exporter (from https://gitorious.org/fmthings/lasttolibre/blobs/master/lastexport.py // changed the script to try more often on failure )
#!/usr/bin/env python
#-*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@samithaj
samithaj / Subreddit-to-YouTube-Source-Bookmarklet.md
Created October 19, 2015 14:28 — forked from akaleeroy/Subreddit-to-YouTube-Source-Bookmarklet.md
Subreddit to YouTube Source Bookmarklet - Play YouTube music from subreddits in Foobar with foo_youtube

Subreddit to YouTube Source Bookmarklet

Generates .M3U playlist of all YouTube videos in current subreddit listing for use in foobar2000 with the foo_youtube component.

First off, foo_youtube is awesome! It enables you to listen to YouTube songs in Foobar, which opens up possibilities like making playlists, enqueuing tracks, remembering playback state, quickly mixing in a song you don't have in your library, using DSPs like Channel Mixer (surround sound up-mixing from stereo works wonders!). You're also free to restart the browser, and you don't have to wonder which of the hundred tabs the sound is coming from, LOL.

How to install

  1. Copy the contents of the second file Subreddit-to-YouTubeSource.min.js

  2. Add a new bookmark

@samithaj
samithaj / Biography Photos.txt
Last active August 29, 2015 14:27 — forked from mire777/Biography Photos.txt
Biography Photos
// ==PREPROCESSOR==
// @name "Biography Photos"
// @author "Mire777"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==
// Paths
var fbfolder = (fb.ProfilePath + "Artist_info");
var lfm_folder = window.GetProperty("Custom folder", fbfolder);