rbbt-dm 1.2.10 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/vector/model/huggingface.rb +13 -0
- data/lib/rbbt/vector/model/torch/dataloader.rb +3 -4
- data/lib/rbbt/vector/model/torch.rb +1 -1
- data/lib/rbbt/vector/model.rb +5 -2
- data/share/R/MA.R +3 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6000c342688d159e651b0ad37f14890a859ea8a858f1e96a447ea4b059f9466
|
4
|
+
data.tar.gz: 7d7504d58ac03ef5c090cb9d3208e7998ce486a80712d0e88bf537b95c62753f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9d76a1383e10a323d4c6f93f2224a68956d8d3a8738c34c7a52c96391a5f9c0b1ce5b849f0579f0c63551270e57190c23529d7e33ea8f9e991f42402a5ae072
|
7
|
+
data.tar.gz: c2d96d57dae1edb7afaeee0897898a36a439e1d00fa65742c0afeddfc933508d178f649f12c65599558817772507f4ad2172ce41e922fd90044419f7e0b67d60
|
@@ -2,9 +2,22 @@ require 'rbbt/vector/model/torch'
|
|
2
2
|
|
3
3
|
class HuggingfaceModel < TorchModel
|
4
4
|
|
5
|
+
attr_accessor :tokenizer
|
6
|
+
def init
|
7
|
+
@model, @tokenizer = self.instance_exec(&@init_model) if @model.nil?
|
8
|
+
[@model, @tokenizer]
|
9
|
+
end
|
10
|
+
|
11
|
+
def tokenizer
|
12
|
+
init
|
13
|
+
@tokenizer
|
14
|
+
end
|
15
|
+
|
5
16
|
def initialize(task, checkpoint, dir = nil, model_options = {})
|
6
17
|
super(dir, nil, model_options)
|
7
18
|
|
19
|
+
checkpoint = checkpoint.find if Path === checkpoint
|
20
|
+
|
8
21
|
@model_options = Misc.add_defaults @model_options, :task => task, :checkpoint => checkpoint
|
9
22
|
|
10
23
|
init_model do
|
@@ -42,13 +42,12 @@ class TorchModel
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def self.text_dataset(tsv_dataset_file, elements, labels = nil, class_labels = nil)
|
45
|
-
elements = elements.collect{|e| e.gsub("\n", ' ') }
|
45
|
+
elements = elements.compact.collect{|e| e.gsub("\n", ' ') }
|
46
46
|
tsv = feature_tsv(elements, labels, class_labels)
|
47
|
+
tsv.fields[0] = "text"
|
47
48
|
if labels.nil?
|
48
|
-
tsv
|
49
|
-
tsv.type = :single
|
49
|
+
tsv = tsv.to_single
|
50
50
|
else
|
51
|
-
tsv.fields[0] = "text"
|
52
51
|
tsv.type = :list
|
53
52
|
end
|
54
53
|
Open.write(tsv_dataset_file, tsv.to_s)
|
data/lib/rbbt/vector/model.rb
CHANGED
@@ -482,8 +482,11 @@ cat(paste(label, sep="\\n", collapse="\\n"));
|
|
482
482
|
@labels = orig_labels
|
483
483
|
end unless folds == -1
|
484
484
|
|
485
|
-
|
486
|
-
|
485
|
+
if folds != 1
|
486
|
+
self.reset_model if self.respond_to? :reset_model
|
487
|
+
self.train
|
488
|
+
end
|
489
|
+
|
487
490
|
res
|
488
491
|
end
|
489
492
|
end
|
data/share/R/MA.R
CHANGED
@@ -106,7 +106,8 @@ rbbt.dm.matrix.differential.limma <- function(data, main, contrast=NULL, log2=NU
|
|
106
106
|
data <- DGEList(data)
|
107
107
|
data <- calcNormFactors(data)
|
108
108
|
data = cpm(data, log=TRUE, prior.count=3)
|
109
|
-
|
109
|
+
if (length(drop) > 0)
|
110
|
+
data <- data[-drop,]
|
110
111
|
}else{
|
111
112
|
data[data == 0] = NA
|
112
113
|
good.rows = apply(is.na(data),1,sum) != dim(data)[2]
|
@@ -181,7 +182,7 @@ rbbt.dm.matrix.differential <- function(file, main, contrast = NULL, type = 'lim
|
|
181
182
|
contrast <- make.names(contrast);
|
182
183
|
}
|
183
184
|
|
184
|
-
if (type == 'limma')
|
185
|
+
if (is.null(type) || type == 'limma')
|
185
186
|
result = rbbt.dm.matrix.differential.limma(data, main, contrast, log2, two.channel, eBayes.trend)
|
186
187
|
else
|
187
188
|
result = rbbt.dm.matrix.differential.DESeq(data, main, contrast)
|
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.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbbt-util
|
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
174
|
- !ruby/object:Gem::Version
|
175
175
|
version: '0'
|
176
176
|
requirements: []
|
177
|
-
rubygems_version: 3.5.
|
177
|
+
rubygems_version: 3.5.9
|
178
178
|
signing_key:
|
179
179
|
specification_version: 4
|
180
180
|
summary: Data-mining and statistics
|