Skip to content

Instantly share code, notes, and snippets.

View RoyZhengGao's full-sized avatar

Zheng Gao RoyZhengGao

View GitHub Profile
@RoyZhengGao
RoyZhengGao / graph_authority.py
Created January 8, 2020 19:46
Graph authority score
import argparse
import pandas as pd
import numpy as np
# import networkx as nx
import math
from tqdm import tqdm, trange
def parse_args():
parser = argparse.ArgumentParser(description="Authority Score Yearly Distribution")
parser.add_argument('-d','--data', default="judicial.csv",
@RoyZhengGao
RoyZhengGao / doc2vec.py
Last active April 19, 2019 20:41
doc2vec
# Import libraries
from gensim.models import doc2vec
from collections import namedtuple
# Load data
doc1 = ["This is a sentence", "This is another sentence"]
# Transform data (you can add more data preprocessing steps)
docs = []
@RoyZhengGao
RoyZhengGao / LoadingDataFromFile.java
Created June 1, 2017 22:55
LoadingDataFromFile.java
import java.io.File;
import weka.core.Instances;
import weka.core.converters.ArffLoader;
import weka.core.converters.ConverterUtils.DataSource;
public class LoadingDataFromFile {
public static void main(String[] args) throws Exception{
//read data directly without considering loader class
package weka;
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@RoyZhengGao
RoyZhengGao / yahoo.py
Created October 30, 2016 22:34
Yahoo_answer_crawler
# encoding=utf8
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
from datetime import datetime
import datetime as dt
import codecs
import os
import time,random,re
import urllib
@RoyZhengGao
RoyZhengGao / word2ve.java
Last active January 8, 2020 19:46
Word2Vec Java version to realize analogy and distance function in Word2vec
package word2vec;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;