Skip to content

Instantly share code, notes, and snippets.

# Filename: test_autograd.py
# Description: Test autograd's limits.
# Author: Pushpendre Rastogi
# Created: Mon Apr 13 18:36:26 2015 (-0400)
# Last-Updated:
# By:
# Update #: 42
import autograd.numpy as np
from autograd import grad
from autograd.util import quick_grad_check
# Filename: decomouse.py
# Description: Test all ways of creating python decorators.
# Author: Pushpendre Rastogi
# Created: Wed Apr 15 00:26:57 2015 (-0400)
# Last-Updated:
# By:
# Update #: 14
'''
A post by [Bruce Eckel at Artima]()
described all the ways of defining decorators.
# Filename: automouse.py
# Description: Pedagogical implementations of Auto diff algorithm
# Author: Pushpendre Rastogi
# Created: Tue Apr 14 22:29:14 2015 (-0400)
# Last-Updated:
# By:
# Update #: 94
'''
Section 1 and 2 of [0] presents the clearest explanation of AD I have ever read. The other explanations I have read were [1],[2]. I found [1] confusing and would suggest skipping it, [2] was better but [0] was the best. Actually see the bibliography at the end of [2] which I have also copied at the end for fear of losing it.
'''
| Filename : HMMGibbs.py
| Description : Gibbs sampling based learning for HMM models.
| Author : Pushpendre Rastogi
| Created : Thu Sep 3 02:22:31 2015 (-0400)
| Last-Updated: Thu Sep 3 11:38:18 2015 (-0400)
| By: Pushpendre Rastogi
| Update #: 15
'''
import numpy as np
@se4u
se4u / shift-reduce-ppda.py
Last active September 9, 2015 03:09
A shift reduce probabilistic PDA
'''
| Filename : shift-reduce-ppda.py
| Description : A shift Reduce PPDA generator
| Author : Pushpendre Rastogi
| Created : Tue Sep 8 20:42:22 2015 (-0400)
| Last-Updated: Tue Sep 8 23:09:28 2015 (-0400)
| By: Pushpendre Rastogi
| Update #: 33
The paper "Relating Probabilistic Grammar and Automata" compare PCFGs and PPDAs.
They also explain how a PPDA produces a sentence. This class implements a PPDA
@se4u
se4u / adaptive_inference.py
Last active September 17, 2015 07:21
A skeletal implementation of Adaptive value of information which attempts to intelligently use features during inference.
# -*- coding: utf-8 -*-
'''
| Filename : adaptive_inference.py
| Description : Implementation of core concepts from "Learning Adaptive Value of Information for Structured Prediction"
| Author : Pushpendre Rastogi
| Created : Wed Sep 16 12:29:09 2015 (-0400)
| Last-Updated: Thu Sep 17 03:13:58 2015 (-0400)
| By: Pushpendre Rastogi
| Update #: 73
'''
@se4u
se4u / rank_metrics.py
Created February 22, 2016 05:31 — forked from bwhite/rank_metrics.py
Ranking Metrics
"""Information Retrieval metrics
Useful Resources:
http://www.cs.utexas.edu/~mooney/ir-course/slides/Evaluation.ppt
http://www.nii.ac.jp/TechReports/05-014E.pdf
http://www.stanford.edu/class/cs276/handouts/EvaluationNew-handout-6-per.pdf
http://hal.archives-ouvertes.fr/docs/00/72/67/60/PDF/07-busa-fekete.pdf
Learning to Rank for Information Retrieval (Tie-Yan Liu)
"""
import numpy as np
@se4u
se4u / comcast_negotation
Created September 27, 2016 13:11
Comcast Customer Service Chat Log
COMCAST: Thank you for patiently waiting. I can certainly understand your
concern regarding the price increase in monthly statement. The promotional price
of service has ended and now you are paying regular charges for the current
services. I have checked that you are currently paying $49.99 + taxes.
_Customer_: Yes, that is correct
COMCAST: I have a wonderful deal for you where you will be getting 20 + cable
channels . Along with this , you will be getting 25 MBPS of internet speed along
with one cable box (at no monthly rental ). By bundling the deal you will get
@se4u
se4u / randn_dtype.patch
Last active January 1, 2017 18:25
Add support for float data type to numpy.random.randn call
diff --git a/mtrand/mtrand.pyx b/mtrand/mtrand.pyx
index 65c1954..79d0d70 100755
--- a/mtrand/mtrand.pyx
+++ b/mtrand/mtrand.pyx
@@ -71,6 +71,7 @@ cdef extern from "randomkit.h":
rk_error rk_altfill(void *buffer, size_t size, int strong,
rk_state *state) nogil
double rk_gauss(rk_state *state) nogil
+ float rk_gauss_32bit(rk_state *state) nogil
void rk_random_uint64(npy_uint64 off, npy_uint64 rng, npy_intp cnt,
-- Usecase for a script runner.
-- Author: Pushpendre Rastogi
-- Date: 8 July 2017
-- Multiple small changes in code are a norm when developing machine learning software
-- in dynamic languages, such as lua, python, because of a large number of hyper-parameters
-- in machine learning code, and large number of typos because of lack of compile time
-- type checking. For example, lua does not even enforce the number of arguments to a
-- function to be the same as its signature. Because of this ML code typically needs to be
-- run multiple times during development with small changes/fixes.
-- ML code also commonly has costly processing that must be done on a dataset.