Skip to content

Instantly share code, notes, and snippets.

View bxshi's full-sized avatar

Dash Shi bxshi

  • University of Notre Dame
  • South Bend, Indiana
View GitHub Profile
@bxshi
bxshi / DeltaCon.R
Last active March 22, 2024 19:02
R port of graph similarity algorithm DeltaCon
####### Please Check github.com/bxshi/rdsg for new updates, this gist will not be change in the future #######
## However, you can still use this since it is correct so far ##
# Port of original DeltaCon to R
# Baoxu(Dash) Shi
# Data Sciense Group
# University of Notre Dame
#
# Citation
# D. Koutra, J. T. Vogelstein, and C. Faloutsos:
@bxshi
bxshi / tmux_local_install.sh
Last active December 3, 2021 15:17 — forked from smsharma/ tmux_local_install.sh
Install tmux locally without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $INSTALL_DIR/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=2.3
@bxshi
bxshi / Hits_at_K_TensorFlow.py
Created January 12, 2017 21:34
Implement Hits@K evaluation metric for Knowledge Graph Completion tasks.
import tensorflow as tf
with tf.Session() as sess:
"""
idx (h,r) top_3
[ [
[0,1], [0,8,3],
[1,3], [7,2,1],
[2,4], [4,3,9],
] ]
@bxshi
bxshi / d-3stocks9908.txt
Created August 27, 2017 06:26
Cleaned up version of d-3stocks9908.txt.
date axp cat sbux
19990104 -0.009756 0.029891 -0.040089
19990105 -0.019089 -0.002639 -0.034803
19990106 0.043063 0.026455 -0.008413
19990107 0.012063 0.009021 0.003636
19990108 0.030393 0.042146 0.021739
19990111 -0.016773 0.039216 0.002364
19990112 -0.036471 -0.044811 0.003538
19990113 -0.03602 -0.050617 -0.008813
19990114 -0.027232 -0.027308 0.000593
@bxshi
bxshi / mac_ssh_vpn.md
Created August 1, 2012 03:32
Mac SSH or VPN 设置教程
@bxshi
bxshi / mr_hits.py
Created January 19, 2017 18:36
Calculate MeanRank and Hits@K using TensorFlow. From github.com/nddsg/ProjC (private repo right now)
def create_eval_ops(model_input, pred_y, all_triples, eval_triples, n_entity,
top_k, idx_1=0, idx_2=1, idx_3=2):
""" Evaluation operations for any model.
For given <h,r> predict t, idx_1 = 0, idx_2 = 1, idx_3 = 2
For given <t,r> predict h, idx_1 = 2, idx_2 = 1, idx_3 = 0
:param model_input: N by 3 matrix, each row is a h,r,t pair
:param pred_y: N by ENTITY_VOCAB matrix
:param all_triples: M by 3 matrix, contains all triples in the KG
@bxshi
bxshi / sys_usage.c
Created April 9, 2012 09:03
Get CPU usage by precentage
/*
* =====================================================================================
*
* Filename: sys_usage.c
*
* Description: get usage of CPU and I/O
*
* Version: 1.0
* Created: 04/09/2012 02:23:08 PM
* Revision: none
i
me
my
myself
we
our
ours
ourselves
you
your
@bxshi
bxshi / d-cat0716-3dx.txt
Created September 25, 2017 00:04
Business 41202 Homework01 processed dataset. This could be loaded by pandas.
PERMNO date VOL RET vwretd ewretd sprtrn
18542 20070103 6138900 -0.002772 -0.001347 -0.000159 -0.001199
18542 20070104 4060000 -0.002616 0.000547 0.000591 0.001228
18542 20070105 6267100 -0.012787 -0.007288 -0.009809 -0.006085
18542 20070108 3977500 0.001162 0.002567 0.001731 0.002220
18542 20070109 3929100 0.005474 -0.000001 0.000262 -0.000517
18542 20070110 6825100 -0.004949 0.002096 0.001338 0.001940
18542 20070111 7440900 -0.005305 0.007322 0.007760 0.006340
18542 20070112 6560800 -0.004333 0.006142 0.006821 0.004853
18542 20070116 6842100 -0.008370 0.000314 0.000561 0.000818
@bxshi
bxshi / test
Created April 14, 2012 11:52
CareerCup 150 test
test