Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

(Bill) Yuchen Lin yuchenlin

🎯
Focusing
Block or report user

Report or block yuchenlin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chuanconggao
chuanconggao / prefixspan.py
Last active Nov 5, 2018
The original minimal 15 lines implementation of PrefixSpan. Full library at https://github.com/chuanconggao/PrefixSpan-py.
View prefixspan.py
from collections import defaultdict
def frequent_rec(patt, mdb):
results.append((len(mdb), patt))
occurs = defaultdict(list)
for (i, startpos) in mdb:
seq = db[i]
for j in range(startpos + 1, len(seq)):
l = occurs[seq[j]]
@peterjc123
peterjc123 / build.ps1
Last active Nov 12, 2018
Setup script for Windows PyTorch
View build.ps1
# Prerequisites
# 1. MSVC 2017 C++ Build Tools
# 2. CMAKE 3.0 or up
# 3. 64 bits of Windows
# 4. Anaconda / MiniConda 64 bits
# Prerequisites for CUDA
# 1. CUDA 8.0 or up
# 2. NVTX( in CUDA as Visual Studio Integration. if fail to install, you can extract
# the CUDA installer exe and found the NVTX installer under the CUDAVisualStudioIntegration)
@lucaswiman
lucaswiman / foo.dot
Created May 31, 2016
networkx / graphviz example
View foo.dot
digraph {
0 -> "*" [key=0,
label="[b]"];
1 -> "*" [key=0,
label="[d]"];
enter -> "*" [key=0,
label=ε];
"*" -> 0 [key=0,
label="[a]"];
"*" -> 1 [key=0,
@tmdavid
tmdavid / word_embedding_vis.py
Last active Sep 20, 2019
Visualize word embeddings, using tsne.
View word_embedding_vis.py
"""
Visualize word embeddings, using tsne.
First computes cosine distance of the 100 closests words, and then shows a clustering graph
of the first 11 closest words (the first one is always the word)
IT REQUIRES GLOVE MODEL.txt
line 31: glove_file = '../TBIR/glove.840B.300d.txt' MODIFY with the appropiate path
To Use it, you can just type: python word_embedding_vis.py <list of words space separated>
e.g: python word_embedding_vis.py cake word embedding music
"""
@yuchenlin
yuchenlin / masked_word_prediction_bert.py
Last active Feb 17, 2020
A simple example script for predicting masked words in a sentence using BERT.
View masked_word_prediction_bert.py
import torch
from transformers import BertTokenizer, BertModel, BertForMaskedLM
import logging
logging.basicConfig(level=logging.INFO)# OPTIONAL
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
model = BertForMaskedLM.from_pretrained('bert-base-uncased')
model.eval()
@Tims101
Tims101 / Top 50 Universities List.md
Last active Mar 15, 2020
Top 50 Computer Science Universities
View Top 50 Universities List.md

Universities

Massachusetts Institute of Technology (MIT)

###phd###

  • MIT Graduate Admissions link
  • PhD Program - MIT Sloan School of Management link
  • MIT - Massachusetts Institute of Technology link
  • to view contact information for all departments. - MIT link
@nathanielove
nathanielove / how-to-setup-shadowsocks-on-your-ubuntu-server.md
Created Nov 1, 2016
How to setup Shadowsocks on your Ubuntu server
View how-to-setup-shadowsocks-on-your-ubuntu-server.md

How to setup Shadowsocks on your Ubuntu server

Your school or company network may block the access to a few specific websites. To solve this problem, I'd highly recommend Shadowsocks, since it is the easiest proxy tool I've ever found, and it's FREE (of course iff you have your own server running).

First, ssh to your server, and make sure you have Python and pip installed. If you have Python but not pip, install it using the following command

$ sudo apt-get install python3-pip
@WeiTang114
WeiTang114 / nvv.sh
Created Mar 13, 2017
Show username after each process in nvidia-smi.
View nvv.sh
#!/bin/bash
# Show username after each process in nvidia-smi
# like:
# ...
# +------------------------------------------------------+
# | Processes: GPU Memory |
# | GPU PID Type Process name Usage |
# |======================================================|
# | 0 150752 C python 830MiB | User: user1
# | 1 2185 C /usr/bin/python 1090MiB | User: user2
@mblondel
mblondel / letor_metrics.py
Last active Apr 16, 2020
Learning to rank metrics.
View letor_metrics.py
# (C) Mathieu Blondel, November 2013
# License: BSD 3 clause
import numpy as np
def ranking_precision_score(y_true, y_score, k=10):
"""Precision at rank k
Parameters
@bbengfort
bbengfort / jsonexplorer.py
Last active Apr 17, 2020
Interactive JSON explorer using Python's cmd module
View jsonexplorer.py
#!/usr/bin/env python
# jsonexplorer
# An interactive interface to explore JSON documents
#
# Author: Benjamin Bengfort <benjamin@bengfort.com>
# Created: Wed Jun 17 12:15:23 2015 -0400
#
# Copyright (C) 2015 Bengfort.com
# Licensed under the OSI Approved MIT License
#
You can’t perform that action at this time.