Skip to content

Instantly share code, notes, and snippets.

@satomacoto
satomacoto / create.py
Last active Apr 27, 2018
kNN on xvideos.com-db.csv
View create.py
# -*- coding:utf-8 -*-
from pymongo import MongoClient
client = MongoClient()
db = client.xvideos
def create_db():
f = open('xvideos.com-db.csv')
for line in f:
View README.md
curl -fsSL https://gist.githubusercontent.com/satomacoto/b27dc3f871938d2614819bba3c589b45/raw/setup1.sh | bash
curl -fsSL https://gist.githubusercontent.com/satomacoto/b27dc3f871938d2614819bba3c589b45/raw/setup2.sh | bash
@satomacoto
satomacoto / mparser.py
Created Apr 12, 2012
Parser with MeCab
View mparser.py
#! /usr/bin/python
# -*- encoding: utf-8 -*-
'''
Parser with MeCab
'''
import MeCab
import glob
import re
import os
View lda.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys,getopt
from numpy import array,matrix,diag
from scipy import sum,log,exp,mean,dot,ones,zeros
from scipy.special import polygamma
from scipy.linalg import norm
from random import random
View how-to-install-miniconda-with-pyenv-on-fish.sh
pyenv install miniconda3-latest
pyenv local miniconda3-latest
conda create -n myenv anaconda
source (conda info --root)/etc/fish/conf.d/conda.fish
conda activate myenv
View Twitter API with Curl
# create an account, create an app
# @see https://apps.twitter.com/
# retrieve the access tokens
# @see https://dev.twitter.com/oauth/reference/post/oauth2/token
# create the file ~/twitter_api
nano ~/twitter_api
Authorization: OAuth oauth_consumer_key="XXXXXX", oauth_nonce="11111111", oauth_signature="XXXXXX", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1450728725", oauth_token="99999-XXXXXX", oauth_version="1.0"
@satomacoto
satomacoto / labeledarrow.html
Created Aug 18, 2012
labeled arrow w/ D3.js
View labeledarrow.html
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script src="http://d3js.org/d3.v2.js"></script>
<style>
line.arrow {
stroke: #666;
@satomacoto
satomacoto / cooccur-top20.txt
Last active Mar 24, 2017
count tag occurrence and cooccurrence on xvideos.com-db.csv
View cooccur-top20.txt
('blowjob', 'hardcore') 594241
('blowjob', 'brunette') 336485
('blowjob', 'teen') 334746
('amateur', 'teen') 322670
('brunette', 'hardcore') 320892
('hardcore', 'teen') 302974
('blonde', 'brunette') 282348
('blonde', 'blowjob') 272567
('blowjob', 'oral') 269461
('blonde', 'hardcore') 252474
View pipeline_sample.py
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
from sklearn.datasets import load_digits
from sklearn import grid_search, metrics
from sklearn.pipeline import Pipeline, FeatureUnion
from sklearn.linear_model import LogisticRegression, RidgeClassifier, PassiveAggressiveRegressor, ElasticNet
from sklearn.ensemble import GradientBoostingRegressor, ExtraTreesRegressor, RandomForestRegressor
from sklearn.neighbors import KNeighborsClassifier, KNeighborsRegressor
@satomacoto
satomacoto / cca.py
Created Apr 7, 2013
正準相関分析(Canonical correlation analysis; cca)
View cca.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
'''
正準相関分析
cca.py
'''
import numpy as np
import scipy as sp
from scipy import linalg as LA
You can’t perform that action at this time.