nysol-take 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e30036a31f3107df33aae6da18928c97c03ce52d
4
- data.tar.gz: b2bc758258baffa71e8a76c75299e24458357d44
3
+ metadata.gz: bf638296f1c835d6aec7d5b8636ab9fad33cd30e
4
+ data.tar.gz: 5c01613d4e66b3f62498dc8d8d5b909c12177dcb
5
5
  SHA512:
6
- metadata.gz: e1d5c04b64285de5052506231838b388a83e5258b9d015e28beece15c7129e044aefc910ffe80ec9b09c98462077e331aa36ac9dcd437c1b86e7ecf21fbda861
7
- data.tar.gz: 3bb9949747aa25c85c272347bf3d84ab1d25f03b8410ba5417d97e9e288e7eb3d35eabc550ece20182e6e3dd9e51e81286d9c55b01751b12cb90c74a18d1801d
6
+ metadata.gz: 037fb1e858907bdf772554f3f24afd96e1440999bd143726c0c116dd7351796acb73843b5e7a3be3f98ce4843641de784ce8343f1be3b50f738aadc738fd8196
7
+ data.tar.gz: 1fa831a85396c424abfa2eed15e0f0c509cb43920ff353d374fe2e8ff58a841a8f7db5bdb5ffa9f0b8b5547cb23d4cc88d6615260c0a93715e1755072266c5e6
data/bin/mbiclique.rb CHANGED
@@ -229,7 +229,6 @@ pair2tra(ei,ef1,ef2,xxtra,xxmap1,xxmap2)
229
229
 
230
230
  # 利用コマンドファイル名
231
231
  #CMD="lcm_20140215"
232
- #{TAKE::LcmIs::CMD}
233
232
 
234
233
  run=""
235
234
  run << "#{type}If"
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
@@ -5,9 +5,9 @@
5
5
  #include <sys/stat.h>
6
6
  #include <string>
7
7
  #include <ruby.h>
8
-
8
+ namespace {
9
9
  #include "src/lcm.c"
10
-
10
+ }
11
11
 
12
12
  #include <kgMethod.h>
13
13
 
@@ -5,9 +5,9 @@
5
5
  #include <sys/stat.h>
6
6
  #include <string>
7
7
  #include <ruby.h>
8
-
8
+ namespace {
9
9
  #include "src/lcm_seq_zero.c"
10
-
10
+ }
11
11
 
12
12
  #include <kgMethod.h>
13
13
 
@@ -5,9 +5,9 @@
5
5
  #include <sys/stat.h>
6
6
  #include <string>
7
7
  #include <ruby.h>
8
-
8
+ namespace {
9
9
  #include "src/lcm_seq.c"
10
-
10
+ }
11
11
 
12
12
  #include <kgMethod.h>
13
13
 
@@ -6,8 +6,9 @@
6
6
  #include <string>
7
7
  #include <ruby.h>
8
8
 
9
+ namespace {
9
10
  #include "src/mace.c"
10
-
11
+ }
11
12
 
12
13
  #include <kgMethod.h>
13
14
 
@@ -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
- extern "C" {
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
  // -----------------------------------------------------------------------------
@@ -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
- MCMD::msgLog("output tid-patterns ...")
224
- tFiles << @temp.file
225
-
226
- xxw= tf.file
227
- f=""
228
- f << "mcut f=#{@db.idFN} i=#{@db.file} |"
229
- f << "muniq k=#{@db.idFN} |"
230
- f << "mnumber S=0 a=__tid -q |"
231
- f << "msortf f=__tid o=#{xxw};"
232
- system(f)
233
-
234
- translt = @temp.file
235
- TAKE::run_lcmtrans(lcmout,"t",translt)
236
-
237
- f=""
238
- #f << "lcm_trans #{lcmout} t |" #__tid,pid
239
- f << "msortf f=__tid i=#{translt} |"
240
- f << "mjoin k=__tid m=#{xxw} f=#{@db.idFN} |"
241
- f << "msetstr v=#{cName} a=class |"
242
- f << "mcut f=#{@db.idFN},class,pid o=#{tFiles.last}"
243
- system(f)
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
- # tid-pidファイル計算
318
- f=""
319
- f << "mcat i=#{tFiles.join(",")} |"
320
- f << "msortf f=class,pid |"
321
- f << "mjoin k=class,pid m=#{xxpCat} f=ppid |" # 全クラス統一pid(ppid)結合
322
- f << "msortf f=class,ppid |"
323
- f << "mcommon k=class,ppid K=class,pid m=#{xxp4} |" # 列挙されたパターンの選択
324
- f << "mcut f=#{@db.idFN},class,ppid:pid |"
325
- f << "msortf f=#{@db.idFN},class,pid o=#{@tFile}"
326
- system(f)
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
 
@@ -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
- MCMD::msgLog("output tid-patterns ...")
200
- tFiles << @temp.file
201
-
202
- xxw= tf.file
203
- f=""
204
- f << "mcut f=#{@db.idFN} i=#{@db.file} |"
205
- f << "muniq k=#{@db.idFN} |"
206
- f << "mnumber S=0 a=__tid -q|"
207
- f << "msortf f=__tid o=#{xxw}"
208
- system(f)
209
- translt = @temp.file
210
- TAKE::run_lcmtrans(lcmout,"t",translt)
211
-
212
- f=""
213
- #f << "lcm_trans #{lcmout} t |" #__tid,pid
214
- f << "msortf f=__tid i=#{translt} |"
215
- f << "mjoin k=__tid m=#{xxw} f=#{@db.idFN} |"
216
- f << "msetstr v=#{cName} a=class |"
217
- f << "mcut f=#{@db.idFN},class,pid o=#{tFiles.last}"
218
- system(f)
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
- # tid-pidファイル計算
262
- f=""
263
- f << "mcat i=#{tFiles.join(",")} |"
264
- f << "msortf f=class,pid |"
265
- f << "mjoin k=class,pid m=#{xxpCat} f=ppid |" # 全クラス統一pid(ppid)結合
266
- f << "msortf f=class,ppid |"
267
- f << "mcommon k=class,ppid K=class,pid m=#{xxp4} |" # 列挙されたパターンの選択
268
- f << "mcut f=#{@db.idFN},class,ppid:pid |"
269
- f << "msortf f=#{@db.idFN},class,pid o=#{@tFile}"
270
- system(f)
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
 
@@ -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
- MCMD::msgLog("output tid-patterns ...")
240
- @tFile = @temp.file
232
+ if @outtf then
233
+ # トランザクション毎に出現するシーケンスを書き出す
234
+ MCMD::msgLog("output tid-patterns ...")
235
+ @tFile = @temp.file
241
236
 
242
- xxw1= tf.file
243
- f=""
244
- f << "mcut f=#{@db.idFN} i=#{@db.file} |"
245
- f << "muniq k=#{@db.idFN} |"
246
- f << "mnumber S=0 a=__tid -q |"
247
- f << "msortf f=__tid o=#{xxw1}"
248
- system(f)
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
- xxw2= tf.file
251
- f=""
252
- f << "mcut f=pid i=#{@pFile} |"
253
- f << "msortf f=pid o=#{xxw2}"
254
- system(f)
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
- xxw3 = tf.file
257
- TAKE::run_lcmtrans(lcmout,"t",xxw3)
258
- f=""
259
- # f << "lcm_trans #{lcmout} t |" #__tid,pid
260
- f << "msortf f=pid i=#{xxw3} |"
261
- f << "mcommon k=pid m=#{xxw2} |"
262
- f << "msortf f=__tid |"
263
- f << "mjoin k=__tid m=#{xxw1} f=#{@db.idFN} |"
264
- f << "mcut f=#{@db.idFN},pid o=#{@tFile}"
265
- system(f)
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
 
@@ -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
- MCMD::msgLog("output tid-patterns ...")
112
- @tFile = @temp.file
113
-
114
- xxw = tf.file #Mtemp.new.name
115
- f=""
116
- f << "mcut f=#{@db.idFN} i=#{@db.file} |"
117
- f << "muniq k=#{@db.idFN} |"
118
- f << "mnumber S=0 a=__tid -q |"
119
- f << "msortf f=__tid o=#{xxw}"
120
- system(f)
121
-
122
- translt = @temp.file
123
- TAKE::run_lcmtrans(lcmout,"t",translt)
124
-
125
- f=""
126
- # f << "lcm_trans #{lcmout} t |" #__tid,pid
127
- f << "msortf f=__tid i=#{translt} |"
128
- f << "mjoin k=__tid m=#{xxw} f=#{@db.idFN} |"
129
- f << "mcut f=#{@db.idFN},pid |"
130
- f << "msortf f=#{@db.idFN},pid o=#{@tFile}"
131
- system(f)
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.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-07-06 00:00:00.000000000 Z
11
+ date: 2017-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nysol