Skip to content

Instantly share code, notes, and snippets.

View joelthe1's full-sized avatar

Joel Mathew joelthe1

  • Information Sciences Institute
  • Los Angeles, USA
View GitHub Profile
@joelthe1
joelthe1 / bert-scorer.py
Created October 28, 2019 18:36
A script to generate precision scoring for ranked embedding matches from BioBert.
import pickle
ref = pickle.load(open('/path/to/biobert_results/gold-reference.pkl', 'rb'))
res = pickle.load(open('/path/to/biobert_results/results.pkl', 'rb'))
scores = []
for res_key in res.keys():
if res_key == 'text':
continue
precisions = []
@joelthe1
joelthe1 / bert-embedding.py
Created October 28, 2019 18:32
A script to create a ranked embedding pickle with BioBert.
from bert_serving.client import BertClient
from scipy import spatial
import pickle
bc = BertClient()
# load embeddings of the human subset of the UniProt entries
with open('/path/to/uniprot/protiens-/prots_human.tsv') as ref_file:
ref_rows = ref_file.read().splitlines()[1:]
print(ref_rows[:10])
@joelthe1
joelthe1 / mancala.py
Created January 26, 2016 09:23
Mancala Game-bot
import operator
import sys
def alphabeta(state):
global path
moves = []
paths = []
alpha = float('-inf')
beta = float('inf')
max_root = float('-inf')