Class: OpenTox::Crossvalidation
- Inherits:
-
Object
- Object
- OpenTox::Crossvalidation
- Includes:
- OpenTox
- Defined in:
- lib/validation.rb
Instance Attribute Summary collapse
-
#report ⇒ Object
readonly
Returns the value of attribute report.
Attributes included from OpenTox
Class Method Summary collapse
-
.create(params, subjectid = nil, waiting_task = nil) ⇒ OpenTox::Crossvalidation
creates a crossvalidations, waits until it finishes, may take some time.
-
.find(uri, subjectid = nil) ⇒ OpenTox::Crossvalidation
find crossvalidation, raises error if not found.
-
.list(params = {}) ⇒ Array
returns a filtered list of crossvalidation uris.
Instance Method Summary collapse
-
#find_or_create_report(subjectid = nil, waiting_task = nil) ⇒ String
looks for report for this crossvalidation, creates a report if no report is found.
-
#load_metadata(subjectid = nil) ⇒ Object
loads metadata via yaml from crossvalidation object fields (like for example the validations) can be acces via validation.metadata.
-
#probabilities(confidence, prediction, subjectid = nil) ⇒ Object
documentation see OpenTox::Validation.probabilities.
-
#statistics(subjectid = nil) ⇒ Object
returns a Validation object containing the statistics of the crossavlidation.
Methods included from OpenTox
#add_metadata, all, #delete, #initialize, sign_in, text_to_html, #to_rdfxml
Instance Attribute Details
#report ⇒ Object (readonly)
Returns the value of attribute report.
142 143 144 |
# File 'lib/validation.rb', line 142 def report @report end |
Class Method Details
.create(params, subjectid = nil, waiting_task = nil) ⇒ OpenTox::Crossvalidation
creates a crossvalidations, waits until it finishes, may take some time
172 173 174 175 176 177 |
# File 'lib/validation.rb', line 172 def self.create( params, subjectid=nil, waiting_task=nil ) params[:subjectid] = subjectid if subjectid uri = OpenTox::RestClientWrapper.post( File.join(CONFIG[:services]["opentox-validation"],"crossvalidation"), params,{:content_type => "text/uri-list"},waiting_task ) Crossvalidation.new(uri) end |
.find(uri, subjectid = nil) ⇒ OpenTox::Crossvalidation
find crossvalidation, raises error if not found
148 149 150 151 152 |
# File 'lib/validation.rb', line 148 def self.find( uri, subjectid=nil ) cv = Crossvalidation.new(uri) cv.( subjectid ) cv end |
.list(params = {}) ⇒ Array
returns a filtered list of crossvalidation uris
157 158 159 160 161 162 163 164 165 |
# File 'lib/validation.rb', line 157 def self.list( params={} ) filter_string = "" params.each do |k,v| filter_string += (filter_string.length==0 ? "?" : "&") v = v.to_s.gsub(/;/, "%3b") if v.to_s =~ /;/ filter_string += k.to_s+"="+v.to_s end (OpenTox::RestClientWrapper.get(File.join(CONFIG[:services]["opentox-validation"],"crossvalidation")+filter_string).split("\n")) end |
Instance Method Details
#find_or_create_report(subjectid = nil, waiting_task = nil) ⇒ String
looks for report for this crossvalidation, creates a report if no report is found
183 184 185 186 187 |
# File 'lib/validation.rb', line 183 def find_or_create_report( subjectid=nil, waiting_task=nil ) @report = CrossvalidationReport.find_for_crossvalidation(@uri, subjectid) unless @report @report = CrossvalidationReport.create(@uri, subjectid, waiting_task) unless @report @report.uri end |
#load_metadata(subjectid = nil) ⇒ Object
loads metadata via yaml from crossvalidation object fields (like for example the validations) can be acces via validation.metadata
191 192 193 |
# File 'lib/validation.rb', line 191 def ( subjectid=nil ) @metadata = YAML.load(OpenTox::RestClientWrapper.get(uri,{:subjectid => subjectid, :accept => "application/x-yaml"})) end |
#probabilities(confidence, prediction, subjectid = nil) ⇒ Object
documentation see OpenTox::Validation.probabilities
201 202 203 204 |
# File 'lib/validation.rb', line 201 def probabilities( confidence, prediction, subjectid=nil ) YAML.load(OpenTox::RestClientWrapper.get(@uri+"/statistics/probabilities?prediction="+prediction.to_s+"&confidence="+confidence.to_s, {:subjectid => subjectid, :accept => "application/x-yaml"})) end |
#statistics(subjectid = nil) ⇒ Object
returns a Validation object containing the statistics of the crossavlidation
196 197 198 |
# File 'lib/validation.rb', line 196 def statistics( subjectid=nil ) Validation.from_cv_statistics( @uri, subjectid ) end |