Module: Delphin

Defined in:
lib/delphin.rb

Overview

Utilities for use with the DELPH-IN project.

Defined Under Namespace

Classes: EmptyDataFile, InvalidProfileException, InvalidRelationsFile, MissingDataFile, MissingRelationsFile, OutputProfileName, Profile, ProfileTable, ProfileTableSchema, RelationsFile

Constant Summary collapse

VERSION =
"0.0.1"
LOGGER =

Logger used by all objects in this module. This is initialized at module load time. The default log level is ERROR.

initialize_logger

Class Method Summary collapse

Class Method Details

.set_log_level(level) ⇒ Object

Set the logging level. For example:

> Delphin.set_log_level(Logger::DEBUG)


45
46
47
# File 'lib/delphin.rb', line 45

def Delphin.set_log_level(level)
  Delphin::LOGGER.level = level
end

.summarize_folds(glob) ⇒ Object

Given a file glob that picks out profiles, extract the specified numerical information, calculate statistics, and return a table sorted by mean.

glob

A file glob



101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/delphin.rb', line 101

def Delphin.summarize_folds(glob)
  Pathname.glob(glob).select {|d| d.directory?}.collect do |d|
    LOGGER.debug("Profile directory #{d}")
    begin
      s = Profile.new(d).statistics("fold", "f-accuracy")
    rescue InvalidProfileException => e
      LOGGER.error(e.message)
      next
    end
    [s.mean, s.sdev, s.range, d.to_s]
  # Filter out nils left in the list by handled exceptions.
  end.select{|r| not r.nil?}.sort_by {|r| -r.first}
end