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
# -*- coding: utf8 | |
from collections import defaultdict | |
import gzip | |
def get_graph_stamps(path, top=None): | |
count = defaultdict(int) | |
srcs = set() | |
with gzip.open(path, 'r') as in_file: |
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
#-*- coding: utf8 | |
from hyperopt import fmin | |
from hyperopt import hp | |
from hyperopt import tpe | |
from tick.hawkes import HawkesADM4 | |
from tick.hawkes import HawkesCumulantMatching | |
from tick.hawkes import HawkesSumGaussians |
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
#-*- coding: utf8 | |
from hyperopt import fmin | |
from hyperopt import hp | |
from hyperopt import tpe | |
from tick.hawkes import HawkesADM4 | |
from tick.hawkes import HawkesCumulantMatching | |
from tick.hawkes import HawkesSumGaussians |
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 precision10(A_true, A_pred, k=10): | |
res = 0.0 | |
tmp = 0 | |
for i in range(A_true.shape[0]): | |
x = set(A_true[i].argsort()[::-1][:k]) | |
y = set(A_pred[i].argsort()[::-1][:k]) | |
res += len(x.intersection(y)) / len(x) | |
tmp += 1 | |
return res / tmp |
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
du -h --summarize .[!.]* * | sort -h |
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
### MATPLOTLIBRC FORMAT | |
# This is a sample matplotlib configuration file - you can find a copy | |
# of it on your system in | |
# site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it | |
# there, please note that it will be overridden in your next install. | |
# If you want to keep a permanent local copy that will not be | |
# over-written, place it in HOME/.matplotlib/matplotlibrc (unix/linux | |
# like systems) and C:\Documents and Settings\yourname\.matplotlib | |
# (win32 systems). |
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 sklearn import grid_search | |
from sklearn import metrics | |
from sklearn import tree | |
import numpy as np | |
def create_sample_decimal(num_rows, max_val): | |
X = np.random.randint(0, max_val, size=(num_rows, 2)) | |
y = (X[:, 0] + X[:, 1]) % 2 |
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
#recommend running on source folders and not project folder. | |
find ./ -type f \( ! -regex '.*/\..*' \) -exec sed -i 's/\t/ /g' {} \; |
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
sudo tshark -i eth0 -f 'port 80 or 443' -R 'http.host matches ".*?youtube\.com.*"' -S -V -l -T fields -e ip.src -e ip.src_host -e ip.dst -e ip.dst_host -e http.accept -e http.accept_encoding -e http.accept_language -e http.authbasic -e http.authorization -e http.cache_control -e http.connection -e http.content_encoding -e http.content_length -e http.content_length_header -e http.content_type -e http.cookie -e http.date -e http.host -e http.last_modified -e http.location -e http.notification -e http.proxy_authenticate -e http.proxy_authorization -e http.proxy_connect_host -e http.proxy_connect_port -e http.referer -e http.request -e http.request.full_uri -e http.request.method -e http.request.uri -e http.request.version -e http.response -e http.response.code -e http.response.phrase -e http.sec_websocket_accept -e http.sec_websocket_extensions -e http.sec_websocket_key -e http.sec_websocket_protocol -e http.sec_websocket_version -e http.server -e http.set_cookie -e http.transfer_encoding -e http.upgrade -e http |
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
# -*- coding: utf8 | |
'''This module contains the code used for data conversion''' | |
from __future__ import division, print_function | |
from collections import defaultdict | |
from scipy import sparse | |
from sklearn.base import BaseEstimator | |
from sklearn.feature_extraction.text import Vectorizer |
NewerOlder