rbbt-dm 1.1.50 → 1.1.51

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2efbfe29d382655f78a91a1e8e381a304f4610f2d13d6d7c5fae8be40a22aa29
4
- data.tar.gz: cee71dc48458dad863d6cc04bf8d1c113430e3f78309dac4cad1d575d9f4b198
3
+ metadata.gz: 5327d1c2a46283b95fa380a73be418cf7e5a3afd2aca6002bd9ca591ab3f6df8
4
+ data.tar.gz: 1066345322e342c8f642b89825c1a8555c6bfa1d09985705d1b382654d91653f
5
5
  SHA512:
6
- metadata.gz: 953cf89ffc4a04e38aff7020bd25d8ab8db5a6383db3a9a9fce5e7bab3bc668a763d660953bdbeedfc9d32beaacc6e83142c773dac6663b118c3a02c58405611
7
- data.tar.gz: c899b27449bb378c9c757438aed976d5375e8d49bb99edf80ff7dbf9f2b03adeac9ec2000aa35bed4206b13e399f025e326952e35acfaefe04d1e5612597367f
6
+ metadata.gz: c1a3cf2ec93909993b290c7c6cb0b6e9c6090155657403c705b93b74a538cbe91ff23dead14c33453dde0c31ba681099b3e5c93f2699a471c19c299b43d0f304
7
+ data.tar.gz: e5b456330625bb57a494fb9e5fc9757e96c134da8f410fabe8f7e9d06169d09f0c4fa3c7e5a375870e6f45b8f5ffdf7855b8260719fb1a32846a2f24c18e8853
@@ -51,7 +51,8 @@ class SpaCyModel < VectorModel
51
51
  doc_bin.to_disk(tmptrain)
52
52
  end
53
53
 
54
- CMD.cmd_log(:spacy, "train #{tmpconfig} --output #{file} --paths.train #{tmptrain} --paths.dev #{tmptrain}")
54
+ gpu = Rbbt::Config.get('gpu_id', :spacy, :spacy_train)
55
+ CMD.cmd_log(:spacy, "train #{tmpconfig} --output #{file} --paths.train #{tmptrain} --paths.dev #{tmptrain}", "--gpu-id" => gpu)
55
56
  end
56
57
 
57
58
  @eval_model = Proc.new do |file, features|
@@ -37,7 +37,7 @@ class TestSpaCyModel < Test::Unit::TestCase
37
37
  model.cross_validation
38
38
  end
39
39
 
40
- def _test_svm_spacy
40
+ def test_svm_spacy
41
41
 
42
42
  require 'rbbt/tsv/csv'
43
43
  url = "https://raw.githubusercontent.com/hanzhang0420/Women-Clothing-E-commerce/master/Womens%20Clothing%20E-Commerce%20Reviews.csv"
@@ -84,5 +84,38 @@ class TestSpaCyModel < Test::Unit::TestCase
84
84
  end
85
85
  end
86
86
 
87
+ def test_spyCy_trf
88
+ TmpFile.with_file() do |dir|
89
+ Log.severity = 0
90
+ FileUtils.mkdir_p dir
91
+
92
+ model = SpaCyModel.new(
93
+ dir,
94
+ "gpu/textcat_accuracy.conf"
95
+ )
96
+
97
+
98
+ require 'rbbt/tsv/csv'
99
+ url = "https://raw.githubusercontent.com/hanzhang0420/Women-Clothing-E-commerce/master/Womens%20Clothing%20E-Commerce%20Reviews.csv"
100
+ tsv = TSV.csv(Open.open(url))
101
+ tsv = tsv.reorder("Review Text", ["Recommended IND"]).to_single
102
+
103
+ good = tsv.select("Recommended IND" => '1')
104
+ bad = tsv.select("Recommended IND" => '0')
105
+
106
+ gsize = 2000
107
+ bsize = 500
108
+ good.keys[0..gsize-1].each do |text|
109
+ next if text.nil? || text.empty?
110
+ model.add text, '1'
111
+ end
112
+
113
+ bad.keys[0..bsize-1].each do |text|
114
+ model.add text, '0'
115
+ end
116
+
117
+ model.cross_validation
118
+ end
119
+ end
87
120
  end
88
121
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-dm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.50
4
+ version: 1.1.51
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-17 00:00:00.000000000 Z
11
+ date: 2021-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbbt-util