Skip to content

Instantly share code, notes, and snippets.

View rajshah4's full-sized avatar

Rajiv Shah rajshah4

View GitHub Profile
@rajshah4
rajshah4 / ggplot.nba.halfcourt
Last active January 10, 2016 16:56
This code, forked from Ed Küpfer, creates a shot chart. Building from the work of Asteves, this code rotates the court 90 degrees.
#Forked from Ed Küpfer and Asteves
#https://gist.github.com/edkupfer
#https://gist.github.com/asteves/7266330
#Updated to rotate half court 90 degrees
#Generate Data for the 3 point line
# Define the circle; add a point at the center if the 'pie slice' if the shape is to be filled
circleFun <- function(center=c(0,5.25), diameter=20.9, npoints=20000, start=0, end=1, filled=TRUE){
tt <- seq(start*pi, end*pi, length.out=npoints)
@rajshah4
rajshah4 / App.js
Last active December 20, 2016 15:06
import 'babel-polyfill';
import React, {Component} from 'react';
import {render} from 'react-dom';
import DeckGL from 'deck.gl/react';
import {LineLayer} from 'deck.gl';
import {ArcLayer} from 'deck.gl';
import MapGL from 'react-map-gl';
const token = 'Add yours here';
"""classic Acrobot task"""
##Updated by Rajiv Shah to get the pendulum to balance for an extended time
from gym import core, spaces
from gym.utils import seeding
import numpy as np
from numpy import sin, cos, pi
import time
__copyright__ = "Copyright 2013, RLPy http://acl.mit.edu/RLPy"
__credits__ = ["Alborz Geramifard", "Robert H. Klein", "Christoph Dann",
@rajshah4
rajshah4 / RNN_Simple_Addition_Public.ipynb
Last active March 4, 2018 01:43
RNN_Addition_1stgrade
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rajshah4
rajshah4 / Quickdraw_to_MNISTformat.ipynb
Created July 14, 2017 20:28
Quickdraw npy files to MNIST test/train dataset with visualization
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import pandas as pd
from sklearn.ensemble import RandomForestRegressor
import pickle
import datetime
## load data
df = pd.read_csv('/content/odsc-ml-drum/data/boston_housing.csv')
df.head()
from pprint import pprint
def score(data, port = "6789"):
b_buf = BytesIO()
b_buf.write(data.to_csv(index=False).encode("utf-8"))
b_buf.seek(0)
url = "http://localhost:{}/predict/".format(port)
files = [
('X', b_buf)
]
@rajshah4
rajshah4 / to_formal_sheets
Last active November 16, 2022 01:33
to_formal formula to call Hugging Inference Endpoints
function to_formal(input="That was funny LOL") {
const endpointUrl = "https://qw2w1h.us-east-1.aws.endpoints.huggingface.cloud";
const options = {
"method" : "POST",
"contentType" : "application/json",
"payload" : JSON.stringify({"inputs": input}),
"headers" : {
"Authorization" : "Bearer api_org_TOKEN"
}
};