README.rdoc in davidrichards-just_enumerable_stats-0.0.11 vs README.rdoc in davidrichards-just_enumerable_stats-0.0.12
- old
+ new
@@ -21,59 +21,66 @@
=> 0.981980506061966
The list of methods are:
* average
-* avg (average)
+* avg
* cartesian_product
+* categories
+* category_values
* compliment
-* cor (correlation)
+* cor
* correlation
-* cp (cartesian_product)
-* cum_max (cumulative_max)
-* cum_min (cumulative_min)
-* cum_prod (cumulative_product)
-* cum_sum (cumulative_sum)
+* count_if
+* covariance
+* cum_max
+* cum_min
+* cum_prod
+* cum_sum
* cumulative_max
* cumulative_min
* cumulative_product
* cumulative_sum
* default_block
* default_block=
+* dichotomize
* euclidian_distance
* exclusive_not
* intersect
+* is_numeric?
* max
* max_index
* max_of_lists
-* mean (average)
+* mean
* median
* min
* min_index
* min_of_lists
* new_sort
* order
-* original_max
-* original_min
-* permutations (cartesian_product)
+* pearson_correlation
+* permutations
* product
* quantile
* rand_in_range
* range
* range_as_range
* range_class
-* range_class=
+* range_instance
* rank
+* set_range
+* set_range_class
* sigma_pairs
* standard_deviation
-* std (standard_deviation)
+* std
* sum
-* tanimoto_correlation (tanimoto_pairs)
+* tanimoto_correlation
* tanimoto_pairs
+* to_f!
* to_pairs
* union
-* var (variance)
+* var
* variance
* yield_transpose
One of the more interesting methods is yield_transpose:
@@ -95,10 +102,57 @@
a.default_block = lambda {|e| e * 2}
a.sum
# => [2,4,6]
a.std
# => 2.0 instead of 1.0
-
+
+== Scaling
+
+There are a few new features for scaling data:
+
+ >> a = [1,2,3]
+ => [1, 2, 3]
+ >> a.scale(2)
+ => [2, 4, 6]
+ >> a
+ => [1, 2, 3]
+ >> a.scale!(2)
+ => [2, 4, 6]
+ >> a
+ => [2, 4, 6]
+ >> a.scale {|e| e - 1}
+ => [1, 3, 5]
+ >> a
+ => [2, 4, 6]
+ >> a.scale! {|e| e - 1}
+ => [1, 3, 5]
+ >> a
+ => [1, 3, 5]
+ >> a.scale_between(3,4)
+ => [3.0, 3.5, 4.0]
+ >> a
+ => [1, 3, 5]
+ >> a.scale_between!(3,4)
+ => [3.0, 3.5, 4.0]
+ >> a
+ => [3.0, 3.5, 4.0]
+ >> a = [1,2,3]
+ => [1, 2, 3]
+ >> a.normalize
+ => [0.166666666666667, 0.333333333333333, 0.5]
+ >> a
+ => [1, 2, 3]
+ >> a.normalize!
+ => [0.166666666666667, 0.333333333333333, 0.5]
+ >> a
+ => [0.166666666666667, 0.333333333333333, 0.5]
+
+Basically:
+
+* scale can scale by a number or with a block. The block is a transformation for a single element.
+* scale_between sets the minimum and maximum values, and keeps each value proportionate to each other.
+* normalize calculates the percentage of an element to the whole.
+
== Categories
Once I started using this gem with my distribution table classes, I needed to have flexible categories on an enumerable. What that looks like is:
Loading Just Enumerable Stats version: 0.0.4