Skip to content

Instantly share code, notes, and snippets.

Avatar

Tal Perry talolard

View GitHub Profile
@talolard
talolard / ltsession.py
Last active Oct 17, 2019
Wrapper for working with LightTag API using the requests library
View ltsession.py
import requests
from functools import partial
class LTSession(requests.Session):
def __init__(self, workspace:str,user:str,pwd:str,host:str=None):
"""[summary]
Initializes a LightTag API session object
Arguments:
workspace {str} -- [The name of your workspace]
user {str} -- [Your LightTag Username]
pwd {str} -- [Your LightTag password]
View LIGHTTAG_CITATION
@unpublished{LightTag,
AUTHOR = {Perry, Tal },
TITLE = {{LightTag}: A platform for managing text annotation projects
YEAR = {2018},
Note = {To appear}
}
@talolard
talolard / install-docker-compose.sh
Last active Sep 19, 2019 — forked from benfogel/install-docker-compose.sh
Installing docker-compose on Amazon Linux AMI
View install-docker-compose.sh
sudo yum update -y
sudo yum install -y docker
sudo usermod -a -G docker ec2-user
sudo curl -L https://github.com/docker/compose/releases/download/1.21.0/docker-compose-`uname -s`-`uname -m` | sudo tee /usr/local/bin/docker-compose > /dev/null
sudo chmod +x /usr/local/bin/docker-compose
sudo service docker start
sudo chkconfig docker on
sudo systemctl enable docker
@talolard
talolard / replacingWordsWithTags.ipynb
Last active Feb 28, 2019
replacingWordsWithTags.ipynb
View replacingWordsWithTags.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@talolard
talolard / al.ipynb
Created Jan 17, 2019
Notebok showing active learning is dumb
View al.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@talolard
talolard / dirichlet.py
Created Jan 14, 2019
Sampling a portfolio from a dirichlet distribution
View dirichlet.py
self.alphas= tf.contrib.layers.fully_connected(
inputs=l2,
num_outputs=num_stocks+1,
activation_fn=tf.nn.relu,
weights_initializer=tf.initializers.glorot_uniform)
self.alphas +=1
self.dirichlet = tfp.distributions.Dirichlet(self.alphas)
self.action = self.dirichlet._sample_n(1)
@talolard
talolard / crappy_env.py
Created Jan 14, 2019
A crappy environemtn for RL on a portfolio of stocks
View crappy_env.py
import numpy as np
from collections import defaultdict
from env.priceGenerator import make_stock
costPerShare = 0 # 0.01
class Env:
'''
A simple environemnt for our agent,
the action our agent gives is weighting over the stocks + cash
@talolard
talolard / magic_market.py
Created Jan 14, 2019
How to make a market that is complex but learnable
View magic_market.py
import numpy as np
def make_stock(length=100, num_stocks=2):
alpha = 0.9
k = 2
cov = np.random.normal(0, 5, [num_stocks, num_stocks])
cov = cov.dot(cov.T) # This is a positive semidefinite matrix, e.g. a covariance matrix
A = np.random.multivariate_normal(np.zeros(num_stocks), cov, size=[length]) # sample noise, with covariance
B = np.random.multivariate_normal(np.zeros(num_stocks), cov, size=[length]) # sample another noise, with covariance
bs = [np.zeros(shape=num_stocks)] #
ps = [np.zeros(shape=num_stocks)] # The prices
@talolard
talolard / last_semver.py
Created Jun 5, 2018
Get the most recent semver tag for an ECR repo
View last_semver.py
import pprint
import boto3
import sys
repo_name = sys.argv[1]
print(repo_name)
client = boto3.client('ecr')
response = client.list_images(
repositoryName=repo_name,
filter={
'tagStatus': 'TAGGED'
@talolard
talolard / convert_to_json.py
Created Mar 23, 2018
Converting csv to json
View convert_to_json.py
import pandas as pd
D = pd.read_csv('./my_csv_file.csv')
D.to_json('./my_new_json_file.json',orient="records")
You can’t perform that action at this time.