nysol-take 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/mbiclique.rb +0 -1
- data/bin/mtra2g.rb +3 -3
- data/ext/lcmrun/lcmrun.cpp +2 -2
- data/ext/lcmseq0run/lcmseq0run.cpp +2 -2
- data/ext/lcmseqrun/lcmseqrun.cpp +2 -2
- data/ext/macerun/macerun.cpp +2 -1
- data/ext/sspcrun/sspcrun.cpp +8 -3
- data/lib/nysol/enumLcmEp.rb +39 -35
- data/lib/nysol/enumLcmEsp.rb +38 -33
- data/lib/nysol/enumLcmIs.rb +30 -34
- data/lib/nysol/enumLcmSeq.rb +27 -24
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf638296f1c835d6aec7d5b8636ab9fad33cd30e
|
4
|
+
data.tar.gz: 5c01613d4e66b3f62498dc8d8d5b909c12177dcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 037fb1e858907bdf772554f3f24afd96e1440999bd143726c0c116dd7351796acb73843b5e7a3be3f98ce4843641de784ce8343f1be3b50f738aadc738fd8196
|
7
|
+
data.tar.gz: 1fa831a85396c424abfa2eed15e0f0c509cb43920ff353d374fe2e8ff58a841a8f7db5bdb5ffa9f0b8b5547cb23d4cc88d6615260c0a93715e1755072266c5e6
|
data/bin/mbiclique.rb
CHANGED
data/bin/mtra2g.rb
CHANGED
@@ -340,7 +340,7 @@ eArgs["nomodel"] = true
|
|
340
340
|
# クラスありパターン列挙
|
341
341
|
if clsFN then
|
342
342
|
# ノードはクラス関係なく全体でfrequentな2アイテムセットを求める
|
343
|
-
lcm=TAKE::LcmIs.new(db);
|
343
|
+
lcm=TAKE::LcmIs.new(db,false);
|
344
344
|
eArgs["minLen"] = 1
|
345
345
|
eArgs["maxLen"] = 1
|
346
346
|
if node_support
|
@@ -371,7 +371,7 @@ if clsFN then
|
|
371
371
|
eArgs["minSup"] = minSup
|
372
372
|
eArgs["minCnt"] = minCnt
|
373
373
|
|
374
|
-
lcm=TAKE::LcmEp.new(db);
|
374
|
+
lcm=TAKE::LcmEp.new(db,false);
|
375
375
|
lcm.enumerate(eArgs)
|
376
376
|
# system "head #{lcm.pFile}"
|
377
377
|
# class%0nr,pid,pattern,size,pos%2nr,neg,posTotal,negTotal,total,support,growthRate,postProb%1nr
|
@@ -410,7 +410,7 @@ if clsFN then
|
|
410
410
|
|
411
411
|
# クラスなしパターン列挙
|
412
412
|
else
|
413
|
-
lcm=TAKE::LcmIs.new(db);
|
413
|
+
lcm=TAKE::LcmIs.new(db,false);
|
414
414
|
# 1 itemset
|
415
415
|
eArgs["minLen" ] = 1
|
416
416
|
eArgs["maxLen" ] = 1
|
data/ext/lcmrun/lcmrun.cpp
CHANGED
data/ext/lcmseqrun/lcmseqrun.cpp
CHANGED
data/ext/macerun/macerun.cpp
CHANGED
data/ext/sspcrun/sspcrun.cpp
CHANGED
@@ -5,12 +5,13 @@
|
|
5
5
|
#include <sys/stat.h>
|
6
6
|
#include <string>
|
7
7
|
#include <ruby.h>
|
8
|
+
// sspc Core
|
9
|
+
namespace{
|
8
10
|
#include "src/sspc.c"
|
11
|
+
}
|
9
12
|
#include <kgMethod.h>
|
10
13
|
|
11
|
-
|
12
|
-
void Init_sspcrun(void);
|
13
|
-
}
|
14
|
+
|
14
15
|
|
15
16
|
VALUE sspcrun(VALUE self,VALUE argvV){
|
16
17
|
|
@@ -41,6 +42,10 @@ VALUE sspcrun(VALUE self,VALUE argvV){
|
|
41
42
|
}
|
42
43
|
|
43
44
|
|
45
|
+
extern "C" {
|
46
|
+
void Init_sspcrun(void);
|
47
|
+
}
|
48
|
+
|
44
49
|
// -----------------------------------------------------------------------------
|
45
50
|
// ruby Mcsvin クラス init
|
46
51
|
// -----------------------------------------------------------------------------
|
data/lib/nysol/enumLcmEp.rb
CHANGED
@@ -76,11 +76,12 @@ class LcmEp
|
|
76
76
|
return pat
|
77
77
|
end
|
78
78
|
|
79
|
-
def initialize(db)
|
79
|
+
def initialize(db,outtf=true)
|
80
80
|
@temp=MCMD::Mtemp.new
|
81
81
|
@db = db # 入力データベース
|
82
82
|
@file=@temp.file
|
83
83
|
items=@db.items
|
84
|
+
@outtf = outtf
|
84
85
|
|
85
86
|
# 重みファイルの作成
|
86
87
|
# pos,negのTransactionオブジェクトに対してLCMが扱う整数アイテムによるトランザクションファイルを生成する。
|
@@ -196,7 +197,6 @@ class LcmEp
|
|
196
197
|
#system("cp #{@file} xxtra_#{cName}")
|
197
198
|
#system("cp #{@weightFile[cName]} xxw_#{cName}")
|
198
199
|
#system("echo '#{run}' >xxscp_#{cName}")
|
199
|
-
|
200
200
|
# パターンのサポートを計算しCSV出力する
|
201
201
|
MCMD::msgLog("output patterns to CSV file ...")
|
202
202
|
pFiles << @temp.file
|
@@ -219,28 +219,30 @@ class LcmEp
|
|
219
219
|
s = MCMD::mrecount("i=#{pFiles.last}") # 列挙されたパターンの数
|
220
220
|
MCMD::msgLog("the number of contrast patterns on class `#{cName}' enumerated is #{s}")
|
221
221
|
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
222
|
+
if @outtf then
|
223
|
+
# トランザクション毎に出現するパターンを書き出す
|
224
|
+
MCMD::msgLog("output tid-patterns ...")
|
225
|
+
tFiles << @temp.file
|
226
|
+
|
227
|
+
xxw= tf.file
|
228
|
+
f=""
|
229
|
+
f << "mcut f=#{@db.idFN} i=#{@db.file} |"
|
230
|
+
f << "muniq k=#{@db.idFN} |"
|
231
|
+
f << "mnumber S=0 a=__tid -q |"
|
232
|
+
f << "msortf f=__tid o=#{xxw};"
|
233
|
+
system(f)
|
234
|
+
|
235
|
+
translt = @temp.file
|
236
|
+
TAKE::run_lcmtrans(lcmout,"t",translt)
|
237
|
+
|
238
|
+
f=""
|
239
|
+
#f << "lcm_trans #{lcmout} t |" #__tid,pid
|
240
|
+
f << "msortf f=__tid i=#{translt} |"
|
241
|
+
f << "mjoin k=__tid m=#{xxw} f=#{@db.idFN} |"
|
242
|
+
f << "msetstr v=#{cName} a=class |"
|
243
|
+
f << "mcut f=#{@db.idFN},class,pid o=#{tFiles.last}"
|
244
|
+
system(f)
|
245
|
+
end
|
244
246
|
}
|
245
247
|
|
246
248
|
# クラス別のパターンとtid-pidファイルを統合して最終出力
|
@@ -314,16 +316,18 @@ class LcmEp
|
|
314
316
|
f << "msortf f=class,pid o=#{xxp4}"
|
315
317
|
system(f)
|
316
318
|
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
319
|
+
if @outtf then
|
320
|
+
# tid-pidファイル計算
|
321
|
+
f=""
|
322
|
+
f << "mcat i=#{tFiles.join(",")} |"
|
323
|
+
f << "msortf f=class,pid |"
|
324
|
+
f << "mjoin k=class,pid m=#{xxpCat} f=ppid |" # 全クラス統一pid(ppid)結合
|
325
|
+
f << "msortf f=class,ppid |"
|
326
|
+
f << "mcommon k=class,ppid K=class,pid m=#{xxp4} |" # 列挙されたパターンの選択
|
327
|
+
f << "mcut f=#{@db.idFN},class,ppid:pid |"
|
328
|
+
f << "msortf f=#{@db.idFN},class,pid o=#{@tFile}"
|
329
|
+
system(f)
|
330
|
+
end
|
327
331
|
|
328
332
|
@size = MCMD::mrecount("i=#{@pFile}") # 列挙されたパターンの数
|
329
333
|
MCMD::msgLog("the number of emerging patterns enumerated is #{@size}")
|
@@ -331,7 +335,7 @@ class LcmEp
|
|
331
335
|
|
332
336
|
def output(outpath)
|
333
337
|
system "mv #{@pFile} #{outpath}/patterns.csv"
|
334
|
-
system "mv #{@tFile} #{outpath}/tid_pats.csv"
|
338
|
+
system "mv #{@tFile} #{outpath}/tid_pats.csv" if @outtf
|
335
339
|
end
|
336
340
|
end
|
337
341
|
|
data/lib/nysol/enumLcmEsp.rb
CHANGED
@@ -49,11 +49,12 @@ class LcmEsp
|
|
49
49
|
# return lcmq*minSup.to_f*negCnt.to_f/minGR.to_f/(1-lcmq)
|
50
50
|
#end
|
51
51
|
|
52
|
-
def initialize(db)
|
52
|
+
def initialize(db,outtf=true)
|
53
53
|
@temp=MCMD::Mtemp.new
|
54
54
|
@db = db # 入力データベース
|
55
55
|
@file=@temp.file
|
56
56
|
items=@db.items
|
57
|
+
@outtf = outtf
|
57
58
|
|
58
59
|
# 重みファイルの作成
|
59
60
|
# pos,negのTransactionオブジェクトに対してLCMが扱う整数アイテムによるトランザクションファイルを生成する。
|
@@ -195,27 +196,29 @@ class LcmEsp
|
|
195
196
|
s = MCMD::mrecount("i=#{pFiles.last}") # 列挙されたパターンの数
|
196
197
|
MCMD::msgLog("the number of contrast patterns on class `#{cName}' enumerated is #{s}")
|
197
198
|
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
199
|
+
if @outtf then
|
200
|
+
# トランザクション毎に出現するシーケンスを書き出す
|
201
|
+
MCMD::msgLog("output tid-patterns ...")
|
202
|
+
tFiles << @temp.file
|
203
|
+
|
204
|
+
xxw= tf.file
|
205
|
+
f=""
|
206
|
+
f << "mcut f=#{@db.idFN} i=#{@db.file} |"
|
207
|
+
f << "muniq k=#{@db.idFN} |"
|
208
|
+
f << "mnumber S=0 a=__tid -q|"
|
209
|
+
f << "msortf f=__tid o=#{xxw}"
|
210
|
+
system(f)
|
211
|
+
translt = @temp.file
|
212
|
+
TAKE::run_lcmtrans(lcmout,"t",translt)
|
213
|
+
|
214
|
+
f=""
|
215
|
+
#f << "lcm_trans #{lcmout} t |" #__tid,pid
|
216
|
+
f << "msortf f=__tid i=#{translt} |"
|
217
|
+
f << "mjoin k=__tid m=#{xxw} f=#{@db.idFN} |"
|
218
|
+
f << "msetstr v=#{cName} a=class |"
|
219
|
+
f << "mcut f=#{@db.idFN},class,pid o=#{tFiles.last}"
|
220
|
+
system(f)
|
221
|
+
end
|
219
222
|
}
|
220
223
|
|
221
224
|
# クラス別のパターンとtid-pidファイルを統合して最終出力
|
@@ -258,16 +261,18 @@ class LcmEsp
|
|
258
261
|
f << "msortf f=class,pid o=#{xxp4}"
|
259
262
|
system(f)
|
260
263
|
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
264
|
+
if @outtf then
|
265
|
+
# tid-pidファイル計算
|
266
|
+
f=""
|
267
|
+
f << "mcat i=#{tFiles.join(",")} |"
|
268
|
+
f << "msortf f=class,pid |"
|
269
|
+
f << "mjoin k=class,pid m=#{xxpCat} f=ppid |" # 全クラス統一pid(ppid)結合
|
270
|
+
f << "msortf f=class,ppid |"
|
271
|
+
f << "mcommon k=class,ppid K=class,pid m=#{xxp4} |" # 列挙されたパターンの選択
|
272
|
+
f << "mcut f=#{@db.idFN},class,ppid:pid |"
|
273
|
+
f << "msortf f=#{@db.idFN},class,pid o=#{@tFile}"
|
274
|
+
system(f)
|
275
|
+
end
|
271
276
|
|
272
277
|
@size = MCMD::mrecount("i=#{@pFile}") # 列挙されたパターンの数
|
273
278
|
MCMD::msgLog("the number of emerging sequence patterns enumerated is #{@size}")
|
@@ -275,7 +280,7 @@ class LcmEsp
|
|
275
280
|
|
276
281
|
def output(outpath)
|
277
282
|
system "mv #{@pFile} #{outpath}/patterns.csv"
|
278
|
-
system "mv #{@tFile} #{outpath}/tid_pats.csv"
|
283
|
+
system "mv #{@tFile} #{outpath}/tid_pats.csv" if @outtf
|
279
284
|
end
|
280
285
|
end
|
281
286
|
|
data/lib/nysol/enumLcmIs.rb
CHANGED
@@ -53,11 +53,12 @@ class LcmIs
|
|
53
53
|
return pat
|
54
54
|
end
|
55
55
|
|
56
|
-
def initialize(db)
|
56
|
+
def initialize(db,outtf=true)
|
57
57
|
@temp=MCMD::Mtemp.new
|
58
58
|
@db = db # 入力データベース
|
59
59
|
@file=@temp.file
|
60
60
|
items=@db.items
|
61
|
+
@outtf = outtf
|
61
62
|
|
62
63
|
# アイテムをシンボルから番号に変換する。
|
63
64
|
f=""
|
@@ -96,13 +97,6 @@ class LcmIs
|
|
96
97
|
end
|
97
98
|
end
|
98
99
|
|
99
|
-
# lcmのパラメータ設定と実行
|
100
|
-
#run=""
|
101
|
-
#run << "#{CMD} #{@type}If"
|
102
|
-
#run << " -U #{@maxCnt}" if @maxCnt # windowサイズ上限
|
103
|
-
#run << " -l #{eArgs['minLen']}" if eArgs["minLen"] # パターンサイズ下限
|
104
|
-
#run << " -u #{eArgs['maxLen']}" if eArgs['maxLen'] # パターンサイズ上限
|
105
|
-
|
106
100
|
run=""
|
107
101
|
run << "#{@type}If"
|
108
102
|
run << " -U #{@maxCnt}" if @maxCnt # windowサイズ上限
|
@@ -235,39 +229,41 @@ class LcmIs
|
|
235
229
|
@size = MCMD::mrecount("i=#{@pFile}") # 列挙されたパターンの数
|
236
230
|
MCMD::msgLog("the number of patterns enumerated is #{@size}")
|
237
231
|
|
238
|
-
|
239
|
-
|
240
|
-
|
232
|
+
if @outtf then
|
233
|
+
# トランザクション毎に出現するシーケンスを書き出す
|
234
|
+
MCMD::msgLog("output tid-patterns ...")
|
235
|
+
@tFile = @temp.file
|
241
236
|
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
237
|
+
xxw1= tf.file
|
238
|
+
f=""
|
239
|
+
f << "mcut f=#{@db.idFN} i=#{@db.file} |"
|
240
|
+
f << "muniq k=#{@db.idFN} |"
|
241
|
+
f << "mnumber S=0 a=__tid -q |"
|
242
|
+
f << "msortf f=__tid o=#{xxw1}"
|
243
|
+
system(f)
|
249
244
|
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
245
|
+
xxw2= tf.file
|
246
|
+
f=""
|
247
|
+
f << "mcut f=pid i=#{@pFile} |"
|
248
|
+
f << "msortf f=pid o=#{xxw2}"
|
249
|
+
system(f)
|
255
250
|
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
#
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
251
|
+
xxw3 = tf.file
|
252
|
+
TAKE::run_lcmtrans(lcmout,"t",xxw3)
|
253
|
+
f=""
|
254
|
+
#f << "lcm_trans #{lcmout} t |" #__tid,pid
|
255
|
+
f << "msortf f=pid i=#{xxw3} |"
|
256
|
+
f << "mcommon k=pid m=#{xxw2} |"
|
257
|
+
f << "msortf f=__tid |"
|
258
|
+
f << "mjoin k=__tid m=#{xxw1} f=#{@db.idFN} |"
|
259
|
+
f << "mcut f=#{@db.idFN},pid o=#{@tFile}"
|
260
|
+
system(f)
|
261
|
+
end
|
266
262
|
end
|
267
263
|
|
268
264
|
def output(outpath)
|
269
265
|
system "mv #{@pFile} #{outpath}/patterns.csv"
|
270
|
-
system "mv #{@tFile} #{outpath}/tid_pats.csv"
|
266
|
+
system "mv #{@tFile} #{outpath}/tid_pats.csv" if @outtf
|
271
267
|
end
|
272
268
|
end
|
273
269
|
|
data/lib/nysol/enumLcmSeq.rb
CHANGED
@@ -13,11 +13,12 @@ module TAKE
|
|
13
13
|
class LcmSeq
|
14
14
|
attr_reader :size # 列挙されたパターン数
|
15
15
|
|
16
|
-
def initialize(db)
|
16
|
+
def initialize(db,outtf=true)
|
17
17
|
@temp=MCMD::Mtemp.new
|
18
18
|
@db = db # 入力データベース
|
19
19
|
@file=@temp.file
|
20
20
|
items=@db.items
|
21
|
+
@outtf = outtf
|
21
22
|
|
22
23
|
# アイテムをシンボルから番号に変換する。
|
23
24
|
f=""
|
@@ -107,28 +108,30 @@ class LcmSeq
|
|
107
108
|
f << "msortf f=support%nr o=#{@pFile}"
|
108
109
|
system(f)
|
109
110
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
f << "
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
111
|
+
if @outtf then
|
112
|
+
# トランザクション毎に出現するシーケンスを書き出す
|
113
|
+
MCMD::msgLog("output tid-patterns ...")
|
114
|
+
@tFile = @temp.file
|
115
|
+
|
116
|
+
xxw = tf.file #Mtemp.new.name
|
117
|
+
f=""
|
118
|
+
f << "mcut f=#{@db.idFN} i=#{@db.file} |"
|
119
|
+
f << "muniq k=#{@db.idFN} |"
|
120
|
+
f << "mnumber S=0 a=__tid -q |"
|
121
|
+
f << "msortf f=__tid o=#{xxw}"
|
122
|
+
system(f)
|
123
|
+
|
124
|
+
translt = @temp.file
|
125
|
+
TAKE::run_lcmtrans(lcmout,"t",translt)
|
126
|
+
|
127
|
+
f=""
|
128
|
+
# f << "lcm_trans #{lcmout} t |" #__tid,pid
|
129
|
+
f << "msortf f=__tid i=#{translt} |"
|
130
|
+
f << "mjoin k=__tid m=#{xxw} f=#{@db.idFN} |"
|
131
|
+
f << "mcut f=#{@db.idFN},pid |"
|
132
|
+
f << "msortf f=#{@db.idFN},pid o=#{@tFile}"
|
133
|
+
system(f)
|
134
|
+
end
|
132
135
|
|
133
136
|
@size = MCMD::mrecount("i=#{@pFile}") # 列挙されたパターンの数
|
134
137
|
MCMD::msgLog("the number of contrast patterns enumerated is #{@size}")
|
@@ -136,7 +139,7 @@ class LcmSeq
|
|
136
139
|
|
137
140
|
def output(outpath)
|
138
141
|
system "mv #{@pFile} #{outpath}/patterns.csv"
|
139
|
-
system "mv #{@tFile} #{outpath}/tid_pats.csv"
|
142
|
+
system "mv #{@tFile} #{outpath}/tid_pats.csv" if @outtf
|
140
143
|
end
|
141
144
|
end
|
142
145
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nysol-take
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NYSOL
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nysol
|