Sha256: 583cd958238069d4c725e9a7a5eb115fbf738e396533537edec46cf1525b514c
Contents?: true
Size: 1.04 KB
Versions: 11
Compression:
Stored size: 1.04 KB
Contents
require 'spout/helpers/array_statistics' require 'spout/helpers/json_loader' module Spout module Models class OutlierResult attr_reader :csv_files, :method, :major_outliers, :minor_outliers, :outliers, :weight, :units, :display_name, :median def initialize(subjects, method, csv_files) @values = subjects.collect(&method.to_sym) @csv_files = csv_files @method = method calculate_outliers! @weight = if @major_outliers.count > 0 0 elsif @minor_outliers.count > 0 1 else 2 end variable = Spout::Helpers::JsonLoader::get_variable(method) @units = (variable.kind_of?(Hash) ? variable['units'] : nil) @display_name = (variable.kind_of?(Hash) ? variable['display_name'] : nil) @median = @values.median end def calculate_outliers! @major_outliers = @values.major_outliers.uniq @minor_outliers = @values.minor_outliers.uniq @outliers = @values.outliers.uniq end end end end
Version data entries
11 entries across 11 versions & 1 rubygems