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
#! /bin/bash | |
# DL, ML, NLP | |
sudo apt-get update | |
# scipy, matplotlib | |
sudo apt-get install python-dev python-pip python-matplotlib python-scipy | |
#tensorflow | |
sudo pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl |
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
""" | |
Andrej Karpathy's code compatible in python3 | |
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
BSD License | |
""" | |
import numpy as np | |
# data I/O | |
data = open('input.txt', 'r').read() # should be simple plain text file | |
chars = list(set(data)) |
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
def load_dataset(): | |
"Load the sample dataset. must be numbered from 1" | |
return [[1, 3, 4], [2, 3, 5], [1, 2, 3, 5], [2, 5]] | |
def createC1(dataset): | |
"Create a list of candidate item sets of size one." | |
c1 = [] | |
for transaction in dataset: | |
for item in transaction: |
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 bs4 import BeautifulSoup | |
import requests | |
data_list = [] | |
link = "https://wiki.metakgp.org/w/Special:ContributionScores" | |
response = requests.get(link) | |
html = response.content | |
source = BeautifulSoup(html, "lxml") | |
trs = source.findAll("tr") | |
run = False |
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 | |
y = np.array([[1.0, 7.0, 1.0],[3.0, 4.0, 2], [1, 7, 1]]) | |
x = torch.from_numpy(y) | |
x = Variable(x) | |
x = x.resize(1, 3, 3) | |
stride = 2 | |
new_var = Variable(torch.zeros([x.shape[0], x.shape[1]//stride, x.shape[2]//stride])) | |
new_var2 = Variable(torch.zeros([x.shape[0], x.shape[1]//stride, x.shape[2]//stride])) | |
for dim1 in range(x.shape[0]): | |
tmp = Variable(torch.zeros([x.shape[1]//stride, x.shape[2]//stride, 1])) |
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 keras.preprocessing import sequence | |
from keras.models import Sequential | |
from keras.datasets import imdb | |
import torch | |
import torch.autograd as autograd | |
import torch.nn as nn | |
import torch.nn.functional as F | |
import torch.optim as optim |
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
var val = "3" | |
var radio_buttons = document.querySelectorAll('input[value="' + val +'"]'); | |
var i = 0; | |
for (i=0; i<radio_buttons.length ; i++){ | |
radio_buttons[i].checked = true; | |
} | |
var radio_buttons = document.querySelectorAll('input[value="5' + val +'"]'); | |
var i = 0; | |
for (i=0; i<radio_buttons.length ; i++){ | |
radio_buttons[i].checked = true; |
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
cat crowds_zara01_train.txt | awk -F ' ' '{print $3}' | sort -n | sed -n '1p;$p' |
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
// ==UserScript== | |
// @name Change filename for arxiv downloads | |
// @namespace https://arxiv.org/ | |
// @version 1.0 | |
// @description Changes filename for the PDF link, so that once you open it in pdf js it downloads as "paper_name.pdf" instead of "year_month.identifier.pdf" | |
// @author Nishant Nikhil | |
// @match https://*.arxiv.org/abs/* | |
// @grant none | |
// ==/UserScript== |
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
stride = 3 | |
new_var = Variable(torch.zeros([x.shape[0], x.shape[1]//stride, x.shape[2]//stride])) | |
for dim1 in range(x.shape[0]): | |
tmp = Variable(torch.zeros([x.shape[1]//stride, x.shape[2]//stride, 1])) | |
for i in range(0, x.shape[1], stride): | |
for j in range(0, x.shape[2], stride): | |
tmp_max = x[dim1][i][j] | |
for k in range(stride): | |
for m in range(stride): | |
tmp_max = torch.max(tmp_max, x[dim1][i+k][j+m]) |
OlderNewer