Skip to content

Instantly share code, notes, and snippets.

```
for each epochs:
* divide the training data into minibatches
for each minibatch:
* backpropagate and update weights
```
@jaidevd
jaidevd / test.py
Created May 9, 2018 07:36
inheritance in tests
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# JSM product code
#
# (C) Copyright 2018 Juxt SmartMandate Pvt Ltd
# All right reserved.
#
# This file is confidential and NOT open source. Do not distribute.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
from __future__ import print_function
for i in range(1, 10):
print(i)
if i % 2 == 0:
exit
@jaidevd
jaidevd / w2v_keras_functional.py
Created March 22, 2018 14:37
Sample W2V script in keras
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
"""
Training Word embeddings on the MTsamples dataset.
"""
from keras.models import Model
from keras.layers import Dense, Embedding, Input, Reshape, Dot
@jaidevd
jaidevd / pycon-india-code-of-conduct-addenda.md
Last active March 18, 2017 07:33
A rant disguised as a code of conduct

Things that the regular code of conduct missed out

  1. Thou shalt not slam the door when thou leaveth the auditorium.
  2. Thou shalt take care not to kick the seat in front of you in the auditorium.
  3. Thou shalt make sure that thy phone is silenced.
  4. Thou shalt not jump the queue for lunch or tea.
  5. Thou shalt speak only in whispers if a session is in progress.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jaidevd
jaidevd / .vimrc
Last active March 23, 2017 15:23
" Powerline stuff
set rtp+=/Users/jaidevd/src/powerline/powerline/bindings/vim
set laststatus=2
execute pathogen#infect()
" Python stuff
syntax enable
filetype on
Title Author Genre Height Publisher
Fundamentals of Wavelets Goswami, Jaideva signal_processing 228 Wiley
Data Smart Foreman, John data_science 235 Wiley
God Created the Integers Hawking, Stephen mathematics 197 Penguin
Superfreakonomics Dubner, Stephen economics 179 HarperCollins
Orientalism Said, Edward history 197 Penguin
Nature of Statistical Learning Theory, The Vapnik, Vladimir data_science 230 Springer
Integration of the Indian States Menon, V P history 217 Orient Blackswan
Drunkard's Walk, The Mlodinow, Leonard science 197 Penguin
Image Processing & Mathematical Morphology Shih, Frank signal_processing 241 CRC
from traits.api import HasTraits, Property, Dict, cached_property, Any, Str, Int
class MyTraits(HasTraits):
a = Any
b = Property(Dict(key_trait=Str, value_trait=Int), depends_on=['a'])
@cached_property
@jaidevd
jaidevd / cossim.py
Created June 5, 2015 11:40
Make sklearn.metrics.pairwise.cosine_similarity optionally return sparse output.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the MIT license.
from sklearn.metrics.pairwise import check_pairwise_arrays
from sklearn.preprocessing import normalize