This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime, timedelta | |
import time | |
import random | |
from airflow import DAG | |
from airflow.operators.python_operator import PythonOperator | |
from pprint import pprint | |
default_args = { | |
"owner": "airflow", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for batch in dp(train_data).preprocess().iterate(batch_size=32, epoch=10): | |
model.train_on_batch(batch["review"], batch["polarity"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from chariot.dataset_preprocessor import DatasetPreprocessor | |
from chariot.transformer.formatter import Padding | |
dp = DatasetPreprocessor() | |
dp.process("review")\ | |
.by(ct.text.UnicodeNormalizer())\ | |
.by(ct.Tokenizer("en"))\ | |
.by(ct.token.StopwordFilter("en"))\ | |
.by(ct.Vocabulary(min_df=5, max_df=0.5))\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import chariot.transformer as ct | |
from chariot.preprocessor import Preprocessor | |
preprocessor = Preprocessor() | |
preprocessor\ | |
.stack(ct.text.UnicodeNormalizer())\ | |
.stack(ct.Tokenizer("en"))\ | |
.stack(ct.token.StopwordFilter("en"))\ | |
.stack(ct.Vocabulary(min_df=5, max_df=0.5))\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import numpy as np | |
from sklearn.metrics.pairwise import cosine_similarity | |
from chariot.storage import Storage | |
class SimilarityGraph(): | |
def __init__(self, vocabulary, nearest_neighbor=4, mode="connectivity", | |
representation="GloVe.6B.200d", root=""): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import spacy | |
class DependencyGraph(): | |
def __init__(self, lang, vocabulary): | |
self.lang = lang | |
self._parser = spacy.load(lang, disable=["ner", "textcat"]) | |
self.vocabulary = vocabulary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import argparse | |
import random | |
import numpy as np | |
from sklearn.preprocessing import StandardScaler | |
from sklearn.externals import joblib | |
import tensorflow as tf | |
from tensorflow.python import keras as K | |
import gym | |
from fn_framework import FNAgent, Trainer, Observer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gym | |
import itertools | |
import matplotlib | |
import numpy as np | |
import sys | |
import tensorflow as tf | |
import collections | |
import sklearn.pipeline | |
import sklearn.preprocessing | |
from sklearn.kernel_approximation import RBFSampler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gym | |
import numpy as np | |
from tensorflow.python import keras as K | |
import tensorflow as tf | |
import random | |
from collections import deque | |
class ActorCritic: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import requests | |
ISSUES_URL = "https://api.github.com/repos/arXivTimes/arXivTimes/issues?page=1&per_page=100" | |
def write_issues(response): | |
"output a list of issues to csv" | |
if not r.status_code == 200: |