Skip to content

Instantly share code, notes, and snippets.

View sujee's full-sized avatar

Sujee Maniyam sujee

View GitHub Profile
@sujee
sujee / cnn-mnist-1-train-gpu-minimal.py
Last active April 2, 2023 13:20
CNN model for mnist prediciton -- tweaked for Tensorflow2 GPU edition
#!/usr/bin/env python
## This CNN network to identify MNIST dataset
import time
import random
import numpy as np
from pprint import pprint
import os, sys
@sujee
sujee / spark-one-hot.py
Last active February 1, 2021 19:16
Spark one hot encoding sample
## Step 3 : encode the indexes into a vector
from pyspark.ml.feature import OneHotEncoder
encoder = OneHotEncoder(inputCols=["statusIndex"], outputCols=["statusVector"], dropLast=False)
encoded = encoder.fit(indexed).transform(indexed)
encoded.show()
# View dense vectors in pandas
encoded_pd = encoded.toPandas()
print(encoded_pd)
@sujee
sujee / output
Created December 25, 2020 23:42
qa-allen-nlp.py
Loading models...
Loaded model 'transformer-qa' in 31,693.4 milli seconds
Loaded model 'bidaf-model' in 1,633.8 milli seconds
/Users/sujee/opt/anaconda3/envs/teachbot-nlp/lib/python3.7/site-packages/torch/nn/modules/container.py:435: UserWarning: Setting attributes on ParameterList is not supported.
warnings.warn("Setting attributes on ParameterList is not supported.")
Loaded model 'bidaf-elmo-model' in 13,811.0 milli seconds
quesion: Who stars in The Matrix?
model transformer-qa predicted in 794.4 milli seconds
answer: Keanu Reeves, Laurence Fishburne, Carrie-Anne Moss, Hugo Weaving, and Joe Pantoliano
@sujee
sujee / cnn-mnist-1-train.ipynb
Created May 21, 2020 07:13
CNN for Mnist, tweaked for Tensorflow v2 GPU
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sujee
sujee / run-reveal-in-docker.sh
Last active December 3, 2019 21:04
run-reveal-in-docker.sh
#!/bin/bash
## invoke with '-d' for dev mode
## this will mount utils directory from host for live debugging
port=2000
while getopts 'dp:' OPTION; do
case "$OPTION" in
d)
#!/bin/bash
if [ -z "$1" ] ; then
echo "Usage: $0 <image name> [optional args for docker image]"
echo "Missing Docker image id. exiting"
exit 1
fi
#image_id="$1"
#shift
@sujee
sujee / mapred-site.xml
Created January 22, 2014 00:23
hadoop2 mapred-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
@sujee
sujee / yarn-site.xml
Created January 22, 2014 00:08
hadoop2 yarn-site.xml
<?xml version="1.0"?>
<configuration>
<property>
<name>yarn.resourcemanager.hostname</name>
<value>localhost</value>
</property>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
@sujee
sujee / hdfs-site.xml
Created January 21, 2014 21:47
hadoop 2 single node : hdfs-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
<description>single node, 1 copy</description>
</property>
</configuration>
@sujee
sujee / core-site.xml
Last active January 4, 2016 01:19
hadoop2 core-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:8020</value>
<description>
this replaces Hadoop 1 property : fs.default.name
</description>
</property>