rbbt-dm 1.3.0 → 1.3.1

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: f9b8071884e4e9d7a8c04f175fe262aad9e2b77911dca787a957a5c5f797fb9b
4
- data.tar.gz: 1c7334d62036d3ae07b7f625b310f401b5078022f909be34cd78bb66c5b2af06
3
+ metadata.gz: b6000c342688d159e651b0ad37f14890a859ea8a858f1e96a447ea4b059f9466
4
+ data.tar.gz: 7d7504d58ac03ef5c090cb9d3208e7998ce486a80712d0e88bf537b95c62753f
5
5
  SHA512:
6
- metadata.gz: 22c73d01543e93a2a7b10ecaa88db9a663b35c8264b6d0e5e9d4b00096f34955250105dec4787242529c594c1a959feb23a4b5cd46298850eee7a813dc551d0f
7
- data.tar.gz: 545663b2ee93dd0e6e6b54e353cb3bfafab9001c7031b42e7f895fb95ea85ffb6c1dcdb54bb671ee5cace49561cca018212e25ee43592b457e4e1abe83277076
6
+ metadata.gz: a9d76a1383e10a323d4c6f93f2224a68956d8d3a8738c34c7a52c96391a5f9c0b1ce5b849f0579f0c63551270e57190c23529d7e33ea8f9e991f42402a5ae072
7
+ data.tar.gz: c2d96d57dae1edb7afaeee0897898a36a439e1d00fa65742c0afeddfc933508d178f649f12c65599558817772507f4ad2172ce41e922fd90044419f7e0b67d60
@@ -2,6 +2,17 @@ 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
 
@@ -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.fields[0] = "text"
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)
@@ -2,7 +2,7 @@ require_relative 'python'
2
2
 
3
3
  class TorchModel < PythonModel
4
4
 
5
- attr_accessor :model, :criterion, :optimizer, :training_args
5
+ attr_accessor :criterion, :optimizer, :training_args
6
6
 
7
7
  def initialize(...)
8
8
  TorchModel.init_python
@@ -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
- self.reset_model if self.respond_to? :reset_model
486
- self.train unless folds == 1
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
- data <- data[-drop,]
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.3.0
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: 2023-12-21 00:00:00.000000000 Z
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.0.dev
177
+ rubygems_version: 3.5.9
178
178
  signing_key:
179
179
  specification_version: 4
180
180
  summary: Data-mining and statistics