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
require 'pp' | |
def ngram(n = 1, text) | |
data = [] | |
0.upto(text.size-n) do |i| | |
data << text[i..i+n-1] | |
end | |
data | |
end |
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
import java.io.BufferedReader; | |
import java.io.FileReader; | |
import java.io.IOException; | |
import java.util.List; | |
import java.util.Arrays; | |
import java.util.HashSet; | |
import java.util.Set; | |
import com.google.common.primitives.Ints; | |
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
import fileinput | |
import networkx as nx | |
g = nx.Graph() # 無向グラフ | |
file = "sample.txt" | |
# file = "facebook_combined.txt" | |
for line in fileinput.input(file): | |
edge = list(map(int, line.split())) | |
g.add_edge(edge[0], edge[1]) |
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: utf-8 | |
import numpy as np | |
import sys | |
from sklearn.feature_extraction.text import CountVectorizer | |
def logistic_function(mat): | |
return 1/(1+np.exp(-mat)) |
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: utf-8 | |
import numpy as np | |
import sys | |
from sklearn.feature_extraction.text import CountVectorizer | |
from sklearn.cross_validation import train_test_split | |
def logistic_function(mat): | |
return 1/(1+np.exp(-mat)) |
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: utf-8 | |
import sys | |
import math | |
import numpy as np | |
from sklearn.feature_extraction.text import CountVectorizer | |
from sklearn import preprocessing | |
import scipy.special | |
fname = sys.argv[1] |
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
*.aux | |
*.bbl | |
*.dvi | |
*.blg | |
*.fdb_latexmk | |
*.fls | |
*.log | |
*.synctex.gz | |
*.toc | |
*.lot |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer