Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ネットワークグラフを作成する
Search
kunou
July 06, 2018
Technology
0
47
ネットワークグラフを作成する
kunou
July 06, 2018
Tweet
Share
More Decks by kunou
See All by kunou
GANについて
kunou
0
420
AIか何かについて.pdf
kunou
0
30
Pythonを書いていておーマジかーと感じたあれこれ
kunou
1
720
Rubyで機械学習してみた
kunou
1
1.1k
ZIP!!
kunou
0
170
zip
kunou
0
500
Make Mouse
kunou
0
630
RubyのProcのあれをこうしました
kunou
0
92
esm lt Clojure like threading macro
kunou
0
420
Other Decks in Technology
See All in Technology
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
The Rise of LLMOps
asei
7
1.6k
社内で最大の技術的負債のリファクタリングに取り組んだお話し
kidooonn
1
550
第1回 国土交通省 データコンペ参加者向け勉強会③- Snowflake x estie編 -
estie
0
130
いざ、BSC討伐の旅
nikinusu
2
780
OS 標準のデザインシステムを超えて - より柔軟な Flutter テーマ管理 | FlutterKaigi 2024
ronnnnn
0
150
ドメインの本質を掴む / Get the essence of the domain
sinsoku
2
160
初心者向けAWS Securityの勉強会mini Security-JAWSを9ヶ月ぐらい実施してきての近況
cmusudakeisuke
0
130
OCI Security サービス 概要
oracle4engineer
PRO
0
6.5k
CysharpのOSS群から見るModern C#の現在地
neuecc
2
3.4k
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
210
サイバーセキュリティと認知バイアス:対策の隙を埋める心理学的アプローチ
shumei_ito
0
390
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
890
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Facilitating Awesome Meetings
lara
50
6.1k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
Gamification - CAS2011
davidbonilla
80
5k
Being A Developer After 40
akosma
87
590k
For a Future-Friendly Web
brad_frost
175
9.4k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Transcript
ωοτϫʔΫάϥϑΛੜ ͢Δ(ClojureͰ) 2018/6/15 ITS-training-camp
ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ) ͜͏͍͏ਤΛੜ͠·͢
ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ) ͜͏͍͏ਤΛੜ͠·͢
DEMO ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ίʔυશମ (ns gen-network.core) (import '(java.io BufferedReader FileReader)) (require '[clojure.string :as
str]) (require '[loom.graph :as lg]) (require '[loom.io :as lio]) (def data-text “data.txt") (def keywords ["a" "b" "c" "d"]) (def data-list (->> (FileReader. data-text) (BufferedReader.) (line-seq) (map #(str/split % #", ")))) (defn word-relation [key list] (->> list (filter (fn [words] (some #(= % key) words))) (map (fn [words] (remove #(= key %) words))) (flatten) (group-by #(identity %)) ((fn [group] (map #(vector key (first %) (count (second %))) group))))) (defn main [] (->> keywords (reduce (fn [accum keyword] (concat accum (word-relation keyword data-list))) []) )) ; (remove (fn [x] (<= (nth x 2) 4))) (apply lg/weighted-graph) ((fn [graph] (lio/view graph :alg :fdp))))) (main) ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ϑΝΠϧΛಡΈࠐΉ $ cat data.txt a, b c, d a, b
a, b a, b a, e c, d a, e a, d c, b e, d ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ϑΝΠϧΛಡΈࠐΉ (import '(java.io BufferedReader FileReader)) (require '[clojure.string :as str]) (def
data-text "data.txt") (def data-list (->> (FileReader. data-text) (BufferedReader.) (line-seq) (map #(str/split % #", ")))) ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ϑΝΠϧΛಡΈࠐΉ (import '(java.io BufferedReader FileReader)) (require '[clojure.string :as str]) (def
data-text "data.txt") (def data-list (->> (FileReader. data-text) (BufferedReader.) (line-seq) (map #(str/split % #", ")))) => ([“a” “b”] [“c” “d”] [“a” “b”] [“a” “b”] [“a” “b”] [“a” “e”] [“c” “d”] [“a” “e”] [“a” “d”] [“c” “b”] [“e" “d"]) ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ϑΝΠϧΛಡΈࠐΉ (import '(java.io BufferedReader FileReader)) (require '[clojure.string :as str]) (def
data-text "data.txt") (def data-list (->> (FileReader. data-text) (BufferedReader.) (line-seq) (map #(str/split % #", ")))) => ([“a” “b”] [“c” “d”] [“a” “b”] [“a” “b”] [“a” “b”] [“a” “e”] [“c” “d”] [“a” “e”] [“a” “d”] [“c” “b”] [“e" “d"]) ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ) JavaͷΫϥεΛΠϯϙʔτ
ϑΝΠϧΛಡΈࠐΉ (import '(java.io BufferedReader FileReader)) (require '[clojure.string :as str]) (def
data-text "data.txt") (def data-list (->> (FileReader. data-text) (BufferedReader.) (line-seq) (map #(str/split % #", ")))) => ([“a” “b”] [“c” “d”] [“a” “b”] [“a” “b”] [“a” “b”] [“a” “e”] [“c” “d”] [“a” “e”] [“a” “d”] [“c” “b”] [“e" “d"]) clojure.stringΛ͑ΔΑ͏ʹ͢Δ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ϑΝΠϧΛಡΈࠐΉ (import '(java.io BufferedReader FileReader)) (require '[clojure.string :as str]) (def
data-text "data.txt") (def data-list (->> (FileReader. data-text) (BufferedReader.) (line-seq) (map #(str/split % #", ")))) => ([“a” “b”] [“c” “d”] [“a” “b”] [“a” “b”] [“a” “b”] [“a” “e”] [“c” “d”] [“a” “e”] [“a” “d”] [“c” “b”] [“e" “d"]) FileReaderΛॳظԽ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ϑΝΠϧΛಡΈࠐΉ (import '(java.io BufferedReader FileReader)) (require '[clojure.string :as str]) (def
data-text "data.txt") (def data-list (->> (FileReader. data-text) (BufferedReader.) (line-seq) (map #(str/split % #", ")))) => ([“a” “b”] [“c” “d”] [“a” “b”] [“a” “b”] [“a” “b”] [“a” “e”] [“c” “d”] [“a” “e”] [“a” “d”] [“c” “b”] [“e" “d"]) BuffReaderΛॳظԽ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ϑΝΠϧΛಡΈࠐΉ (import '(java.io BufferedReader FileReader)) (require '[clojure.string :as str]) (def
data-text "data.txt") (def data-list (->> (FileReader. data-text) (BufferedReader.) (line-seq) (map #(str/split % #", ")))) => ([“a” “b”] [“c” “d”] [“a” “b”] [“a” “b”] [“a” “b”] [“a” “e”] [“c” “d”] [“a” “e”] [“a” “d”] [“c” “b”] [“e" “d"]) ߦ͝ͱʹ͚Δ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ϑΝΠϧΛಡΈࠐΉ (import '(java.io BufferedReader FileReader)) (require '[clojure.string :as str]) (def
data-text "data.txt") (def data-list (->> (FileReader. data-text) (BufferedReader.) (line-seq) (map #(str/split % #", ")))) => ([“a” “b”] [“c” “d”] [“a” “b”] [“a” “b”] [“a” “b”] [“a” “e”] [“c” “d”] [“a” “e”] [“a” “d”] [“c” “b”] [“e" “d"]) ߦΛ``,``Ͱ͚ͯVectorʹ͢Δ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ಡΈࠐΜͩ݁Ռ͔ΒΈ߹ΘͤճΛ͑Δ (defn word-relation [key list] (->> list (filter (fn [words]
(some #(= % key) words))) (map (fn [words] (remove #(= key %) words))) (flatten) (group-by #(identity %)) ((fn [group] (map #(vector key (first %) (count (second %))) group))))) ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ಡΈࠐΜͩ݁Ռ͔ΒΈ߹ΘͤճΛ͑Δ (defn word-relation [key list] (->> list (filter (fn [words]
(some #(= % key) words))) (map (fn [words] (remove #(= key %) words))) (flatten) (group-by #(identity %)) ((fn [group] (map #(vector key (first %) (count (second %))) group))))) (word-relation "a" data-list) => (["a" "b" 4] ["a" "e" 2] ["a" "d" 1]) ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ಡΈࠐΜͩ݁Ռ͔ΒΈ߹ΘͤճΛ͑Δ (defn word-relation [key list] (->> list (filter (fn [words]
(some #(= % key) words))) (map (fn [words] (remove #(= key %) words))) (flatten) (group-by #(identity %)) ((fn [group] (map #(vector key (first %) (count (second %))) group))))) => ([“a” “b”] [“c” “d”] [“a” “b”] [“a” “b”] [“a” “b”] [“a” “e”] [“c” “d”] [“a” “e”] [“a” “d”] [“c” “b”] [“e" “d"]) ͜͜·Ͱ࣮ߦ͢Δ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ಡΈࠐΜͩ݁Ռ͔ΒΈ߹ΘͤճΛ͑Δ (defn word-relation [key list] (->> list (filter (fn [words]
(some #(= % key) words))) (map (fn [words] (remove #(= key %) words))) (flatten) (group-by #(identity %)) ((fn [group] (map #(vector key (first %) (count (second %))) group))))) => (["a" "b"] ["a" "b"] ["a" "b"] ["a" "b"] ["a" "e"] ["a" "e"] ["a" "d"]) ͜͜·Ͱ࣮ߦ͢Δ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ಡΈࠐΜͩ݁Ռ͔ΒΈ߹ΘͤճΛ͑Δ (defn word-relation [key list] (->> list (filter (fn [words]
(some #(= % key) words))) (map (fn [words] (remove #(= key %) words))) (flatten) (group-by #(identity %)) ((fn [group] (map #(vector key (first %) (count (second %))) group))))) => (("b") ("b") ("b") ("b") ("e") ("e") ("d")) ͜͜·Ͱ࣮ߦ͢Δ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ಡΈࠐΜͩ݁Ռ͔ΒΈ߹ΘͤճΛ͑Δ (defn word-relation [key list] (->> list (filter (fn [words]
(some #(= % key) words))) (map (fn [words] (remove #(= key %) words))) (flatten) (group-by #(identity %)) ((fn [group] (map #(vector key (first %) (count (second %))) group))))) => ("b" "b" "b" "b" "e" "e" "d") ͜͜·Ͱ࣮ߦ͢Δ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ಡΈࠐΜͩ݁Ռ͔ΒΈ߹ΘͤճΛ͑Δ (defn word-relation [key list] (->> list (filter (fn [words]
(some #(= % key) words))) (map (fn [words] (remove #(= key %) words))) (flatten) (group-by #(identity %)) ((fn [group] (map #(vector key (first %) (count (second %))) group))))) => {"b" ["b" "b" "b" "b"], "e" ["e" "e"], "d" ["d"]} ͜͜·Ͱ࣮ߦ͢Δ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ಡΈࠐΜͩ݁Ռ͔ΒΈ߹ΘͤճΛ͑Δ (defn word-relation [key list] (->> list (filter (fn [words]
(some #(= % key) words))) (map (fn [words] (remove #(= key %) words))) (flatten) (group-by #(identity %)) ((fn [group] (map #(vector key (first %) (count (second %))) group))))) => (["a" "b" 4] ["a" "e" 2] ["a" "d" 1]) ͜͜·Ͱ࣮ߦ͢Δ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ޙϥΠϒϥϦͷྗͰ (defn main [] (->> keywords (reduce (fn [accum keyword]
(concat accum (word-relation keyword data-list))) []) ; (remove (fn [x] (<= (nth x 2) 4))) (apply lg/weighted-graph) ((fn [graph] (lio/view graph :alg :fdp))))) ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ޙϥΠϒϥϦͷྗͰ (defn main [] (->> keywords (reduce (fn [accum keyword]
(concat accum (word-relation keyword data-list))) []) ; (remove (fn [x] (<= (nth x 2) 4))) (apply lg/weighted-graph) ((fn [graph] (lio/view graph :alg :fdp))))) => (["a" "b" 4] ["a" "e" 2] ["a" "d" 1] [“b" "a" 4] ["b" "c" 1] ["c" "d" 2] ["c" "b" 1] [“d" "c" 2] ["d" "a" 1] ["d" "e" 1]) ͜͜·Ͱ࣮ߦ͢Δ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ޙϥΠϒϥϦͷྗͰ (defn main [] (->> keywords (reduce (fn [accum keyword]
(concat accum (word-relation keyword data-list))) []) ; (remove (fn [x] (<= (nth x 2) 4))) (apply lg/weighted-graph) ((fn [graph] (lio/view graph :alg :fdp))))) άϥϑσʔλΛ࡞ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ޙϥΠϒϥϦͷྗͰ (defn main [] (->> keywords (reduce (fn [accum keyword]
(concat accum (word-relation keyword data-list))) []) ; (remove (fn [x] (<= (nth x 2) 4))) (apply lg/weighted-graph) ((fn [graph] (lio/view graph :alg :fdp))))) ஔΛࢦఆͯ͠ඳը ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ίʔυશମ (ns gen-network.core) (import '(java.io BufferedReader FileReader)) (require '[clojure.string :as
str]) (require '[loom.graph :as lg]) (require '[loom.io :as lio]) (def data-text “data.txt") (def keywords ["a" "b" "c" "d"]) (def data-list (->> (FileReader. data-text) (BufferedReader.) (line-seq) (map #(str/split % #", ")))) (defn word-relation [key list] (->> list (filter (fn [words] (some #(= % key) words))) (map (fn [words] (remove #(= key %) words))) (flatten) (group-by #(identity %)) ((fn [group] (map #(vector key (first %) (count (second %))) group))))) (defn main [] (->> keywords (reduce (fn [accum keyword] (concat accum (word-relation keyword data-list))) []) )) ; (remove (fn [x] (<= (nth x 2) 4))) (apply lg/weighted-graph) ((fn [graph] (lio/view graph :alg :fdp))))) (main) ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
·ͱΊ ͪΐͬͱͨ͠πʔϧΛ࡞Δͱ͖ͳͲɺؔܕݴޠΛ͏ͱ͘εο ΩϦ͔͚·͢ɻ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
·ͱΊ ͪΐͬͱͨ͠πʔϧΛ࡞Δͱ͖ͳͲɺؔܕݴޠΛ͏ͱ͘εο ΩϦ͔͚·͢ɻ RubyPythonΛͬͯ͘ॻ͚·͚͢ͲͶɻ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)