Like Two Pis in a Pod: Author Similarity Across Time in the Ancient Greek Corpus
GPT-2 Agents
illegal bishop move: {'from': 'e7', 'to': 'c6'} illegal knight move: {'from': 'c5', 'to': 'a8'} illegal queen move: {'from': 'f8', 'to': 'h4'} Dataframe: ../results/legal_1.xlsx/legal-table_moves illegal legal pawns 0 446 rooks 0 270 bishops 1 193 knights 1 266 queen 1 175 king 0 212 totals 3 1562 Dataframe: ../results/legal_1.xlsx/legal-table_actual illegal legal pawns 0 49386 rooks 0 31507 bishops 0 28263 knights 0 31493 queen 0 22818 king 0 23608 totals 0 188324
GOES
Waikato
DtZ
GPT-2 Agents
GOES
GPT-2 Agents
# print the first n rows of a dataframe using the specified columns. Use a -1 for printing all rows def print_df(df:pd.DataFrame, headers:List, num_rows:int = 4, max_chars:int = 80): s:pd.Series rows = 0 d:Dict = df.to_dict('index') rd:Dict for index, rd in d.items(): st = "" keys = rd.keys() for key in headers: if key in keys: val = rd[key] st += "{}: {}, ".format(key, val[:max_chars]) print(st) rows += 1 if num_rows != -1 and rows > num_rows: break
GOES
ML Seminar
GOES
I also want to search the db for the appropriate “from to” text snippet (e.g. “Black moves pawn from e2 to e3”), maybe with a count of the number of times this move was done using that piece
Also, I think it makes sense to have a “fewest hops” (A* – traditional network approach), closest (each step finds the closest node to the target) in addition to the line following algorithm. There will have to be some user testing to see what makes the most sense, if any
The map is based on the single jumps, and shows the big jumps as arcs
]]>Huggingface has a pipeline interface now that is pretty abstract. This works:
from transformers import pipeline translator = pipeline("translation_en_to_fr") print(translator("Hugging Face is a technology company based in New York and Paris", max_length=40))
DtZ is back up! Too many countries have the disease and the histories had to be cropped to stay under the data cap for the free service
GPT-2 Agents
#COVID
from transformers import MarianTokenizer, MarianMTModel from typing import List src = 'ar' # source language trg = 'en' # target language sample_text = "لم يسافر أبي إلى الخارج من قبل" sample_text2 = "الصحة_السعودية تعلن إصابة أربعيني بفيروس كورونا بالمدينة المنورة حيث صنفت عدواه بحالة أولية مخالطة الإبل مشيرة إلى أن حماية الفرد من(كورونا)تكون باتباع الإرشادات الوقائية والمحافظة على النظافة والتعامل مع #الإبل والمواشي بحرص شديد من خلال ارتداء الكمامة " mname = f'Helsinki-NLP/opus-mt-{src}-{trg}' model = MarianMTModel.from_pretrained(mname) tok = MarianTokenizer.from_pretrained(mname) batch = tok.prepare_translation_batch(src_texts=[sample_text2]) # don't need tgt_text for inference gen = model.generate(**batch) # for forward pass: model(**batch) words: List[str] = tok.batch_decode(gen, skip_special_tokens=True) print(words)
الصحة_السعودية تعلن إصابة أربعيني بفيروس كورونا بالمدينة المنورة حيث صنفت عدواه بحالة أولية مخالطة الإبل مشيرة إلى أن حماية الفرد من(كورونا)تكون باتباع الإرشادات الوقائية والمحافظة على النظافة والتعامل مع #الإبل والمواشي بحرص شديد من خلال ارتداء الكمامة
Saudi health announces a 40-year-old corona virus in the city of Manora, where his enemy was classified as a primary camel conglomerate, indicating that the protection of the individual from Corona would be through preventive guidance, hygiene, and careful handling of the Apple and the cattle by wearing the gag.
Book chat
DtZ has broken
GPT2-Agents
nlist = list(nx.all_neighbors(self.gml_model, cur_node)) print("\tneighbors = {}".format(nlist)) dist_dict = {} sx, sy = self.get_center(cur_node) for n in nlist: if n not in node_list: newx, newy = self.get_center(n) newa = [newx, newy] print("\tline dist checking {} at {}".format(n, newa)) x, y = self.point_to_line([l[0], l[1]], [l[2], l[3]], newa) ca = [x, y] ib = self.is_between([sx, sy], [l[2], l[3]], [x, y]) if ib: # option 1: Find the closest to the line dist = np.linalg.norm(np.array(newa)-np.array(ca)) dist_dict[n] = dist print("\tis BETWEEN = {}, dist = {}".format(ib, dist)) if len(dist_dict) == 0: ta = [self.get_center(self.target_node)] for n in nlist: if n not in node_list: newx, newy = self.get_center(n) newa = [newx, newy] print("\ttarget dist checking {} at {}".format(n, newa)) # option 2: Find the closest to the target node dist = np.linalg.norm(np.array(newa)-np.array(ta)) dist_dict[n] = dist print("\tis CLOSEST: dist = {}".format(dist))
GOES
#COVID19
GPT-2 Agents
# option 1: Find the closest to the line # dist = np.linalg.norm(np.array(na)-np.array(ca)) # option 2: Find the closest to the target node dist = np.linalg.norm(np.array(newa)-np.array(ta)) dist_dict[n] = dist
GOES
GPT-2 Agents
import numpy as np import math import matplotlib.pyplot as plt p1 = np.array([1.0, 1.0]) l1 = np.array([0.0, 1.0]) l2 = np.array([1.0, 0.0]) lvec = l2 - l1 lvec /= np.linalg.norm(lvec, 2) p2 = l1 + lvec * np.dot(p1 - l1, lvec) print("intesection = {}".format(p2)) #0.2 1. pvec = p2 - p1 dist = np.linalg.norm(pvec, 2) pvec /= dist det = np.linalg.det([lvec, pvec]) dot = np.dot(lvec, pvec) rads = math.atan2(det, dot) print("distance = {}, angle = {}".format(dist, math.degrees(rads))) plt.plot([l1[0], l2[0]],[l1[1], l2[1]]) plt.plot([p1[0], p2[0]],[p1[1], p2[1]]) plt.show()
def is_between(self, l1:[int, int], l2:[int, int], p1:[int, int], epsilon:float = .1) -> bool: p1 = np.array(p1).astype(np.float) l1 = np.array(l1).astype(np.float) l2 = np.array(l2).astype(np.float) s1 = np.linalg.norm(l1-p1) s2 = np.linalg.norm(l2-p1) d = np.linalg.norm(l2-l1) # print("d = {}, s1 + s2 = {}".format(d, s1+s2)) if abs(d - (s1+s2)) < epsilon: return True return False
Proposal
GOES
ML Seminar
GOES:
Proposal
GPT-2 Agents