Skip to content

Instantly share code, notes, and snippets.

View Nithanaroy's full-sized avatar
🎯
Focusing

Nitin Pasumarthy Nithanaroy

🎯
Focusing
View GitHub Profile
@Nithanaroy
Nithanaroy / deepEqual.js
Created February 22, 2017 00:56
Deeply compare two JavaScript objects
function deepEqual ( a, b ) {
let equalCount = Object.keys( a ).length === Object.keys( b ).length;
if ( equalCount ){
for ( let key in a ){
if ( typeof a[key] === typeof b[key] ){
if ( typeof a[key] !== "object" ){
if ( a[key] !== b[key] ){
return false;
}
} else {
@Nithanaroy
Nithanaroy / .gitconfig
Created November 21, 2017 22:35
Git Global Config
[alias]
co = checkout
c = commit
s = status
b = branch
hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
type = cat-file -t
dump = cat-file -p
d = diff
a = add
@Nithanaroy
Nithanaroy / costly_functional.js
Last active November 24, 2017 21:55
Performant chaining ops in JavaScript
/** Double all the even numbers in the given array **/
const isEven = (n) => n % 2 === 0;
const doubleIt = (n) => n * 2;
const finalAnswer = [1, 2, 3, 4]
.filter(isEven)
.map(doubleIt)
@Nithanaroy
Nithanaroy / running-example-data.csv
Last active June 6, 2018 22:09
Encoding-Medium-Post-running-example-data
ID IP Address: String Browser: String Duration: Number
0 86.98.19.228 Chrome 40
1 95.255.60.157 Firefox 50
2 213.194.42.105 Chrome 207
3 51.52.146.6 Edge 7
4 42.111.129.57 Safari 141
@Nithanaroy
Nithanaroy / data-after-encoding.csv
Created June 6, 2018 22:13
Encoding-Medium-Post-data-after-encoding
ID IP Address: String ChromeBrowser: Number FirefoxBrowser: Number EdgeBrowser: Number SafariBrowser: Number Duration: Number
0 86.98.19.228 1 0 0 0 40
1 95.255.60.157 0 1 0 0 50
2 213.194.42.105 1 0 0 0 207
3 51.52.146.6 0 0 1 0 7
4 42.111.129.57 0 0 0 1 141
@Nithanaroy
Nithanaroy / char-encoding-versus-others.csv
Last active September 9, 2018 20:52
Comparison of Character One-Hot Encoding with Embedding + Hashing encoding schemes
Character one-hot encoding Embedding or Bucketing
fixed length inputs variable and long inputs
low character cardinality chracter cardinality is not an issue
new values are frequent best to have visibility of entire population of inputs at design phase
@Nithanaroy
Nithanaroy / using-screen-command.csv
Last active September 11, 2018 22:54
Useful options with screen command
Operation Keycodes
Start a screen session `screen -a`
Detach from current screen session `Ctrl + Shift + D A`
Reattach to a recent detached session `screen -r`
List of screens `screen -ls`
Attach to screen with name `screen -xS name`
Name a screen `Ctrl+a :sessionname name Enter`
@Nithanaroy
Nithanaroy / merged-percentile-buckets-acc-tf-custom-metrics.py
Last active July 4, 2019 17:13
Calculate the accuracy of merged percentile buckets
# Credits: https://stackoverflow.com/a/52127761/1585523
import tensorflow as tf
from tensorflow.keras import backend as K
# Define the custom accuracy tensorflow metric
def three_class_acc(y_true, y_pred):
tr = tf.floor(tf.to_float(K.argmax(y_true, axis=-1) / 3))
pr = tf.floor(tf.to_float(K.argmax(y_pred, axis=-1) / 3))
return K.cast(K.equal(tr, pr), K.floatx())
@Nithanaroy
Nithanaroy / hierarchy-classes.ipynb
Last active December 27, 2019 12:30
Desktop/blog/hierarchy/hierarchy-classes.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Nithanaroy
Nithanaroy / balanced-clusters.ipynb
Last active December 27, 2019 12:36
Desktop/blog/clustering/balanced-clusters.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.