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 sys | |
sys.path.append('..') | |
import os | |
import json | |
from time import time | |
import numpy as np | |
from tqdm import tqdm | |
from matplotlib import pyplot as plt | |
from sklearn.externals import joblib |
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 matplotlib import pyplot as plt | |
from time import time | |
from foxhound import activations | |
from foxhound import updates | |
from foxhound import inits | |
from foxhound.theano_utils import floatX, sharedX |
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 json | |
import numpy as np | |
from time import time | |
from matplotlib import pyplot as plt | |
import random | |
from sklearn import metrics | |
from sklearn.linear_model import LogisticRegression as LR | |
from sklearn.feature_extraction.text import TfidfVectorizer |
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 pandas as pd | |
import numpy as np | |
from sklearn import metrics | |
from sklearn.linear_model import LogisticRegression as LR | |
from sklearn.feature_extraction.text import TfidfVectorizer | |
from time import time | |
def len_filter(text, max_len=1014): |
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 theano | |
import theano.tensor as T | |
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams | |
from theano.tensor.signal.downsample import max_pool_2d | |
from theano.tensor.extra_ops import repeat | |
from theano.sandbox.cuda.dnn import dnn_conv | |
from time import time | |
import numpy as np | |
from matplotlib import pyplot as plt |
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
""" | |
The MIT License (MIT) | |
Copyright (c) 2015 Alec Radford | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
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 pandas as pd | |
from lxml import html | |
from sklearn import metrics | |
from sklearn.cross_validation import train_test_split | |
from sklearn.linear_model import LogisticRegression as LR | |
from sklearn.feature_extraction.text import TfidfVectorizer | |
def clean(text): | |
return html.fromstring(text).text_content().lower().strip() |
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 | |
from scipy.spatial.distance import cdist | |
def nearest_neighbor(samples, targets, samples_to_classify, metric='euclidean'): | |
return targets[np.argmin(cdist(samples_to_classify, samples, metric=metric), axis=1)] |