davidrichards-just_enumerable_stats 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -23,55 +23,62 @@ Looking at the library through jes, you can see that we have all the usual goodi
23
23
  The list of methods are:
24
24
 
25
25
  * average
26
- * avg (average)
26
+ * avg
27
27
  * cartesian_product
28
+ * categories
29
+ * category_values
28
30
  * compliment
29
- * cor (correlation)
31
+ * cor
30
32
  * correlation
31
- * cp (cartesian_product)
32
- * cum_max (cumulative_max)
33
- * cum_min (cumulative_min)
34
- * cum_prod (cumulative_product)
35
- * cum_sum (cumulative_sum)
33
+ * count_if
34
+ * covariance
35
+ * cum_max
36
+ * cum_min
37
+ * cum_prod
38
+ * cum_sum
36
39
  * cumulative_max
37
40
  * cumulative_min
38
41
  * cumulative_product
39
42
  * cumulative_sum
40
43
  * default_block
41
44
  * default_block=
45
+ * dichotomize
42
46
  * euclidian_distance
43
47
  * exclusive_not
44
48
  * intersect
49
+ * is_numeric?
45
50
  * max
46
51
  * max_index
47
52
  * max_of_lists
48
- * mean (average)
53
+ * mean
49
54
  * median
50
55
  * min
51
56
  * min_index
52
57
  * min_of_lists
53
58
  * new_sort
54
59
  * order
55
- * original_max
56
- * original_min
57
- * permutations (cartesian_product)
60
+ * pearson_correlation
61
+ * permutations
58
62
  * product
59
63
  * quantile
60
64
  * rand_in_range
61
65
  * range
62
66
  * range_as_range
63
67
  * range_class
64
- * range_class=
68
+ * range_instance
65
69
  * rank
70
+ * set_range
71
+ * set_range_class
66
72
  * sigma_pairs
67
73
  * standard_deviation
68
- * std (standard_deviation)
74
+ * std
69
75
  * sum
70
- * tanimoto_correlation (tanimoto_pairs)
76
+ * tanimoto_correlation
71
77
  * tanimoto_pairs
78
+ * to_f!
72
79
  * to_pairs
73
80
  * union
74
- * var (variance)
81
+ * var
75
82
  * variance
76
83
  * yield_transpose
77
84
 
@@ -97,7 +104,54 @@ Another interesting feature is the default block getter and setter. Sometimes I
97
104
  # => [2,4,6]
98
105
  a.std
99
106
  # => 2.0 instead of 1.0
100
-
107
+
108
+ == Scaling
109
+
110
+ There are a few new features for scaling data:
111
+
112
+ >> a = [1,2,3]
113
+ => [1, 2, 3]
114
+ >> a.scale(2)
115
+ => [2, 4, 6]
116
+ >> a
117
+ => [1, 2, 3]
118
+ >> a.scale!(2)
119
+ => [2, 4, 6]
120
+ >> a
121
+ => [2, 4, 6]
122
+ >> a.scale {|e| e - 1}
123
+ => [1, 3, 5]
124
+ >> a
125
+ => [2, 4, 6]
126
+ >> a.scale! {|e| e - 1}
127
+ => [1, 3, 5]
128
+ >> a
129
+ => [1, 3, 5]
130
+ >> a.scale_between(3,4)
131
+ => [3.0, 3.5, 4.0]
132
+ >> a
133
+ => [1, 3, 5]
134
+ >> a.scale_between!(3,4)
135
+ => [3.0, 3.5, 4.0]
136
+ >> a
137
+ => [3.0, 3.5, 4.0]
138
+ >> a = [1,2,3]
139
+ => [1, 2, 3]
140
+ >> a.normalize
141
+ => [0.166666666666667, 0.333333333333333, 0.5]
142
+ >> a
143
+ => [1, 2, 3]
144
+ >> a.normalize!
145
+ => [0.166666666666667, 0.333333333333333, 0.5]
146
+ >> a
147
+ => [0.166666666666667, 0.333333333333333, 0.5]
148
+
149
+ Basically:
150
+
151
+ * scale can scale by a number or with a block. The block is a transformation for a single element.
152
+ * scale_between sets the minimum and maximum values, and keeps each value proportionate to each other.
153
+ * normalize calculates the percentage of an element to the whole.
154
+
101
155
  == Categories
102
156
 
103
157
  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:
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 0
4
- :patch: 11
4
+ :patch: 12
@@ -400,6 +400,8 @@ module Enumerable
400
400
 
401
401
  end
402
402
  safe_alias :_jes_rank
403
+ safe_alias :_jes_ordinalize, :_jes_rank
404
+ safe_alias :ordinalize, :_jes_rank
403
405
 
404
406
  # Given values like [10,5,5,1]
405
407
  # Rank should produce something like [4,2,2,1]
@@ -696,8 +698,69 @@ module Enumerable
696
698
  return true if @_jes_to_f
697
699
  @_jes_to_f = self.map! {|e| e.to_f}
698
700
  end
701
+
702
+ # Scale a list by a number. The implementation of this can be self-referential.
703
+ # Example: a.scale!(a.standard_deviation)
699
704
  safe_alias :_jes_to_f!
705
+
706
+ def _jes_scale(val=nil, &block)
707
+ if block
708
+ self.map{|e| block.call(e)}
709
+ else
710
+ self.map{|e| e * val}
711
+ end
712
+ end
713
+ safe_alias :_jes_scale
714
+
715
+ def _jes_scale!(val=nil, &block)
716
+ if block
717
+ self.map!{|e| block.call(e)}
718
+ else
719
+ self.map!{|e| e * val}
720
+ end
721
+ end
722
+ safe_alias :_jes_scale!
700
723
 
724
+ def _jes_scale_to_sigmoid!
725
+ self._jes_scale! { |e| 1 / (1 + Math.exp( -1 * (e))) }
726
+ end
727
+ safe_alias :_jes_scale_to_sigmoid!
728
+
729
+ def _jes_normalize
730
+ self.map {|e| e.to_f / self._jes_sum }
731
+ end
732
+ safe_alias :_jes_normalize
733
+
734
+ def _jes_normalize!
735
+ sum = self._jes_sum
736
+ self.map! {|e| e.to_f / sum }
737
+ end
738
+ safe_alias :_jes_normalize!
739
+
740
+ def _jes_scale_between(*values)
741
+ raise ArgumentError, "Must provide two values" unless values.size == 2
742
+ values.sort!
743
+ min = values[0]
744
+ max = values[1]
745
+ orig_min = self._jes_min
746
+ scalar = (max - min) / (self._jes_max - orig_min).to_f
747
+ shift = min - (orig_min * scalar)
748
+ self._jes_scale{|e| (e * scalar) + shift}
749
+ end
750
+ safe_alias :_jes_scale_between
751
+
752
+ def _jes_scale_between!(*values)
753
+ raise ArgumentError, "Must provide two values" unless values.size == 2
754
+ values.sort!
755
+ min = values[0]
756
+ max = values[1]
757
+ orig_min = self._jes_min
758
+ scalar = (max - min) / (self._jes_max - orig_min).to_f
759
+ shift = min - (orig_min * scalar)
760
+ self._jes_scale!{|e| (e * scalar) + shift}
761
+ end
762
+ safe_alias :_jes_scale_between!
763
+
701
764
  end
702
765
 
703
766
  @a = [1,2,3]
@@ -527,200 +527,68 @@ describe "JustEnumerableStats" do
527
527
  [1,2,3].to_f!.should eql([1.0, 2.0, 3.0])
528
528
  end
529
529
 
530
- context "unobstrusive" do
531
- before do
532
- @a = BusyClass.new(1,2,3)
533
- @b = [2,3,1]
534
- end
535
-
536
- it "should not use the native max" do
537
- lambda{@a._jes_max}.should_not raise_error
538
- end
539
-
540
- it "should not use the native max_index" do
541
- lambda{@a._jes_max_index}.should_not raise_error
542
- end
543
-
544
- it "should not use the native min" do
545
- lambda{@a._jes_min}.should_not raise_error
546
- end
547
-
548
- it "should not use the native min_index" do
549
- lambda{@a._jes_min_index}.should_not raise_error
550
- end
551
-
552
- it "should not use the native default_block" do
553
- lambda{@a._jes_default_block}.should_not raise_error
554
- end
555
-
556
- it "should not use the native default_block=" do
557
- lambda{@a._jes_default_block= lambda{|e| 1} }.should_not raise_error
558
- end
559
-
560
- it "should not use the native sum" do
561
- lambda{@a._jes_sum}.should_not raise_error
562
- end
563
-
564
- it "should not use the native average" do
565
- lambda{@a._jes_average}.should_not raise_error
566
- end
567
-
568
- it "should not use the native variance" do
569
- lambda{@a._jes_variance}.should_not raise_error
570
- end
571
-
572
- it "should not use the native standard_deviation" do
573
- lambda{@a._jes_standard_deviation}.should_not raise_error
574
- end
575
-
576
- it "should not use the native median" do
577
- lambda{@a._jes_median}.should_not raise_error
578
- end
579
-
580
- it "should not use the native categories" do
581
- lambda{@a._jes_categories}.should_not raise_error
582
- end
583
-
584
- it "should not use the native is_numeric?" do
585
- lambda{@a._jes_is_numeric?}.should_not raise_error
586
- end
587
-
588
- it "should not use the native range" do
589
- lambda{@a._jes_range}.should_not raise_error
590
- end
591
-
592
- it "should not use the native set_range_class" do
593
- lambda{@a._jes_set_range_class(FixedRange)}.should_not raise_error
594
- end
530
+ it "should have the ability to scale the list by a number" do
531
+ a = [1,2,3,4]
532
+ a.scale!(0.5)
533
+ a.should eql([0.5, 1.0, 1.5, 2.0])
534
+ end
535
+
536
+ it "should be able to scale a list by a calculation on the list" do
537
+ a = (1..10).inject([]) {|list, i| list << rand}
538
+ std = a.std
539
+ b = a.map {|e| e * std}
540
+ a.should_receive(:std).once.and_return(std)
541
+ a.scale!(a.std)
542
+ a.should eql(b)
543
+ end
544
+
545
+ it "should be able to scale by a function" do
546
+ a = [-4, -2, 0, 2, 4]
547
+ a.scale! { |e| 1 / (1 + Math.exp( -1 * (e))) }
548
+ a[0].should be_close(0.01798, 1.0e-5)
549
+ a[1].should be_close(0.11920, 1.0e-5)
550
+ a[2].should eql(0.5)
551
+ a[3].should be_close(0.88079, 1.0e-5)
552
+ a[4].should be_close(0.98201, 1.0e-5)
553
+ end
554
+
555
+ it "should be able to scale to a signoid" do
556
+ a = [-4, -2, 0, 2, 4]
557
+ a.scale_to_sigmoid!
558
+ a[0].should be_close(0.01798, 1.0e-5)
559
+ a[1].should be_close(0.11920, 1.0e-5)
560
+ a[2].should eql(0.5)
561
+ a[3].should be_close(0.88079, 1.0e-5)
562
+ a[4].should be_close(0.98201, 1.0e-5)
563
+ end
595
564
 
596
- it "should not use the native set_range" do
597
- lambda{@a._jes_set_range({:a => 1})}.should_not raise_error
598
- end
599
-
600
- it "should not use the native dichotomize" do
601
- lambda{@a._jes_dichotomize(2, :small, :big)}.should_not raise_error
602
- end
565
+ it "should be able to normalize a list" do
566
+ b = @a.normalize
567
+ b.should eql([1/6.0, 2/6.0, 3/6.0])
568
+ @a.normalize!
569
+ @a.should eql(b)
570
+ end
603
571
 
604
- it "should not use the native count_if" do
605
- lambda{@a._jes_count_if {|e| e == 2}}.should_not raise_error
606
- end
607
-
608
- it "should not use the native category_values" do
609
- lambda{@a._jes_category_values}.should_not raise_error
610
- end
611
-
612
- it "should not use the native range_class" do
613
- lambda{@a._jes_range_class}.should_not raise_error
614
- end
615
-
616
- it "should not use the native range_as_range" do
617
- lambda{@a._jes_range_as_range}.should_not raise_error
618
- end
619
-
620
- it "should not use the native new_sort" do
621
- lambda{@a._jes_new_sort}.should_not raise_error
622
- end
623
-
624
- it "should not use the native rank" do
625
- lambda{@a._jes_rank}.should_not raise_error
626
- end
627
-
628
- it "should not use the native order" do
629
- lambda{@a._jes_order}.should_not raise_error
630
- end
631
-
632
- it "should not use the native quantile" do
633
- lambda{@a._jes_quantile}.should_not raise_error
634
- end
635
-
636
- it "should not use the native cum_sum" do
637
- lambda{@a._jes_cum_sum}.should_not raise_error
638
- end
639
-
640
- it "should not use the native cum_prod" do
641
- lambda{@a._jes_cum_prod}.should_not raise_error
642
- end
643
-
644
- it "should not use the native cum_max" do
645
- lambda{@a._jes_cum_max}.should_not raise_error
646
- end
647
-
648
- it "should not use the native cum_min" do
649
- lambda{@a._jes_cum_min}.should_not raise_error
650
- end
651
-
652
- it "should not use the native product" do
653
- lambda{@a._jes_product}.should_not raise_error
654
- end
655
-
656
- it "should not use the native to_pairs" do
657
- lambda{@a._jes_to_pairs(@b) {|a, b| a}}.should_not raise_error
658
- end
659
-
660
- it "should not use the native tanimoto_pairs" do
661
- lambda{@a._jes_tanimoto_pairs(@b)}.should_not raise_error
662
- end
663
-
664
- it "should not use the native union" do
665
- lambda{@a._jes_union(@b)}.should_not raise_error
666
- end
667
-
668
- it "should not use the native intersect" do
669
- lambda{@a._jes_intersect(@b)}.should_not raise_error
670
- end
671
-
672
- it "should not use the native compliment" do
673
- lambda{@a._jes_compliment(@b)}.should_not raise_error
674
- end
675
-
676
- it "should not use the native exclusive_not" do
677
- lambda{@a._jes_exclusive_not(@b)}.should_not raise_error
678
- end
679
-
680
- it "should not use the native cartesian_product" do
681
- lambda{@a._jes_cartesian_product(@b)}.should_not raise_error
682
- end
683
-
684
- it "should not use the native sigma_pairs" do
685
- lambda{@a._jes_sigma_pairs(@b) {|a, b| a}}.should_not raise_error
686
- end
687
-
688
- it "should not use the native euclidian_distance" do
689
- lambda{@a._jes_euclidian_distance(@b)}.should_not raise_error
690
- end
691
-
692
- it "should not use the native rand_in_range" do
693
- lambda{@a._jes_rand_in_range(1, 2)}.should_not raise_error
694
- end
695
-
696
- it "should not use the native correlation" do
697
- lambda{@a._jes_correlation(@b)}.should_not raise_error
698
- end
699
-
700
- it "should not use the native yield_transpose" do
701
- lambda{@a._jes_yield_transpose(@b)}.should_not raise_error
702
- end
703
-
704
- it "should not use the native max_of_lists" do
705
- lambda{@a._jes_max_of_lists(@b)}.should_not raise_error
706
- end
707
-
708
- it "should not use the native min_of_lists" do
709
- lambda{@a._jes_min_of_lists(@b)}.should_not raise_error
572
+ context "scale_between" do
573
+ before do
574
+ @a = [-4, -2, 0, 2, 4]
710
575
  end
711
576
 
712
- it "should not use the native covariance" do
713
- lambda{@a._jes_covariance(@b)}.should_not raise_error
577
+ it "should require two parameters" do
578
+ lambda{@a.scale_between(1)}.should raise_error(ArgumentError, 'Must provide two values')
579
+ lambda{@a.scale_between(1,2)}.should_not raise_error
580
+ lambda{@a.scale_between(1,2,3)}.should raise_error(ArgumentError, 'Must provide two values')
714
581
  end
715
582
 
716
- it "should not use the native pearson_correlation" do
717
- lambda{@a._jes_pearson_correlation(@b)}.should_not raise_error
583
+ it "should return a new array between the scaled values" do
584
+ b = @a.scale_between(1,2)
585
+ b.should eql([1.0, 1.25, 1.5, 1.75, 2.0])
718
586
  end
719
587
 
720
- it "should not use the native to_f!" do
721
- lambda{@a._jes_to_f!}.should_not raise_error
588
+ it "should be able to transform into a scaled set" do
589
+ b = @a.scale_between(1,2)
590
+ @a.scale_between!(1,2)
591
+ @a.should eql(b)
722
592
  end
723
-
724
593
  end
725
-
726
594
  end
data/spec/spec_helper.rb CHANGED
@@ -40,6 +40,7 @@ class BusyClass
40
40
  def range_as_range(&block); raise ArgumentError, "Should not be called"; end
41
41
  def new_sort(&block); raise ArgumentError, "Should not be called"; end
42
42
  def rank(&block); raise ArgumentError, "Should not be called"; end
43
+ def ordinalize(&block); raise ArgumentError, "Should not be called"; end
43
44
  def order(&block); raise ArgumentError, "Should not be called"; end
44
45
  def quantile(&block); raise ArgumentError, "Should not be called"; end
45
46
  def cum_sum(sorted=false, &block); raise ArgumentError, "Should not be called"; end
@@ -64,7 +65,12 @@ class BusyClass
64
65
  def covariance(other); raise ArgumentError, "Should not be called"; end
65
66
  def pearson_correlation(other); raise ArgumentError, "Should not be called"; end
66
67
  def to_f!; raise ArgumentError, "Should not be called"; end
67
-
68
+ def scale!; raise ArgumentError, "Should not be called"; end
69
+ def scale_to_sigmoid!; raise ArgumentError, "Should not be called"; end
70
+ def normalize; raise ArgumentError, "Should not be called"; end
71
+ def normalize!; raise ArgumentError, "Should not be called"; end
72
+ def scale_between; raise ArgumentError, "Should not be called"; end
73
+ def scale_between!; raise ArgumentError, "Should not be called"; end
68
74
  end
69
75
 
70
76
 
@@ -0,0 +1,229 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe "JustEnumerableStats" do
4
+
5
+ context "unobstrusive" do
6
+ before do
7
+ @a = BusyClass.new(1,2,3)
8
+ @b = [2,3,1]
9
+ end
10
+
11
+ it "should not use the native max" do
12
+ lambda{@a._jes_max}.should_not raise_error
13
+ end
14
+
15
+ it "should not use the native max_index" do
16
+ lambda{@a._jes_max_index}.should_not raise_error
17
+ end
18
+
19
+ it "should not use the native min" do
20
+ lambda{@a._jes_min}.should_not raise_error
21
+ end
22
+
23
+ it "should not use the native min_index" do
24
+ lambda{@a._jes_min_index}.should_not raise_error
25
+ end
26
+
27
+ it "should not use the native default_block" do
28
+ lambda{@a._jes_default_block}.should_not raise_error
29
+ end
30
+
31
+ it "should not use the native default_block=" do
32
+ lambda{@a._jes_default_block= lambda{|e| 1} }.should_not raise_error
33
+ end
34
+
35
+ it "should not use the native sum" do
36
+ lambda{@a._jes_sum}.should_not raise_error
37
+ end
38
+
39
+ it "should not use the native average" do
40
+ lambda{@a._jes_average}.should_not raise_error
41
+ end
42
+
43
+ it "should not use the native variance" do
44
+ lambda{@a._jes_variance}.should_not raise_error
45
+ end
46
+
47
+ it "should not use the native standard_deviation" do
48
+ lambda{@a._jes_standard_deviation}.should_not raise_error
49
+ end
50
+
51
+ it "should not use the native median" do
52
+ lambda{@a._jes_median}.should_not raise_error
53
+ end
54
+
55
+ it "should not use the native categories" do
56
+ lambda{@a._jes_categories}.should_not raise_error
57
+ end
58
+
59
+ it "should not use the native is_numeric?" do
60
+ lambda{@a._jes_is_numeric?}.should_not raise_error
61
+ end
62
+
63
+ it "should not use the native range" do
64
+ lambda{@a._jes_range}.should_not raise_error
65
+ end
66
+
67
+ it "should not use the native set_range_class" do
68
+ lambda{@a._jes_set_range_class(FixedRange)}.should_not raise_error
69
+ end
70
+
71
+ it "should not use the native set_range" do
72
+ lambda{@a._jes_set_range({:a => 1})}.should_not raise_error
73
+ end
74
+
75
+ it "should not use the native dichotomize" do
76
+ lambda{@a._jes_dichotomize(2, :small, :big)}.should_not raise_error
77
+ end
78
+
79
+ it "should not use the native count_if" do
80
+ lambda{@a._jes_count_if {|e| e == 2}}.should_not raise_error
81
+ end
82
+
83
+ it "should not use the native category_values" do
84
+ lambda{@a._jes_category_values}.should_not raise_error
85
+ end
86
+
87
+ it "should not use the native range_class" do
88
+ lambda{@a._jes_range_class}.should_not raise_error
89
+ end
90
+
91
+ it "should not use the native range_as_range" do
92
+ lambda{@a._jes_range_as_range}.should_not raise_error
93
+ end
94
+
95
+ it "should not use the native new_sort" do
96
+ lambda{@a._jes_new_sort}.should_not raise_error
97
+ end
98
+
99
+ it "should not use the native rank" do
100
+ lambda{@a._jes_rank}.should_not raise_error
101
+ end
102
+
103
+ it "should not use the native ordinalize" do
104
+ lambda{@a._jes_ordinalize}.should_not raise_error
105
+ end
106
+
107
+ it "should not use the native order" do
108
+ lambda{@a._jes_order}.should_not raise_error
109
+ end
110
+
111
+ it "should not use the native quantile" do
112
+ lambda{@a._jes_quantile}.should_not raise_error
113
+ end
114
+
115
+ it "should not use the native cum_sum" do
116
+ lambda{@a._jes_cum_sum}.should_not raise_error
117
+ end
118
+
119
+ it "should not use the native cum_prod" do
120
+ lambda{@a._jes_cum_prod}.should_not raise_error
121
+ end
122
+
123
+ it "should not use the native cum_max" do
124
+ lambda{@a._jes_cum_max}.should_not raise_error
125
+ end
126
+
127
+ it "should not use the native cum_min" do
128
+ lambda{@a._jes_cum_min}.should_not raise_error
129
+ end
130
+
131
+ it "should not use the native product" do
132
+ lambda{@a._jes_product}.should_not raise_error
133
+ end
134
+
135
+ it "should not use the native to_pairs" do
136
+ lambda{@a._jes_to_pairs(@b) {|a, b| a}}.should_not raise_error
137
+ end
138
+
139
+ it "should not use the native tanimoto_pairs" do
140
+ lambda{@a._jes_tanimoto_pairs(@b)}.should_not raise_error
141
+ end
142
+
143
+ it "should not use the native union" do
144
+ lambda{@a._jes_union(@b)}.should_not raise_error
145
+ end
146
+
147
+ it "should not use the native intersect" do
148
+ lambda{@a._jes_intersect(@b)}.should_not raise_error
149
+ end
150
+
151
+ it "should not use the native compliment" do
152
+ lambda{@a._jes_compliment(@b)}.should_not raise_error
153
+ end
154
+
155
+ it "should not use the native exclusive_not" do
156
+ lambda{@a._jes_exclusive_not(@b)}.should_not raise_error
157
+ end
158
+
159
+ it "should not use the native cartesian_product" do
160
+ lambda{@a._jes_cartesian_product(@b)}.should_not raise_error
161
+ end
162
+
163
+ it "should not use the native sigma_pairs" do
164
+ lambda{@a._jes_sigma_pairs(@b) {|a, b| a}}.should_not raise_error
165
+ end
166
+
167
+ it "should not use the native euclidian_distance" do
168
+ lambda{@a._jes_euclidian_distance(@b)}.should_not raise_error
169
+ end
170
+
171
+ it "should not use the native rand_in_range" do
172
+ lambda{@a._jes_rand_in_range(1, 2)}.should_not raise_error
173
+ end
174
+
175
+ it "should not use the native correlation" do
176
+ lambda{@a._jes_correlation(@b)}.should_not raise_error
177
+ end
178
+
179
+ it "should not use the native yield_transpose" do
180
+ lambda{@a._jes_yield_transpose(@b)}.should_not raise_error
181
+ end
182
+
183
+ it "should not use the native max_of_lists" do
184
+ lambda{@a._jes_max_of_lists(@b)}.should_not raise_error
185
+ end
186
+
187
+ it "should not use the native min_of_lists" do
188
+ lambda{@a._jes_min_of_lists(@b)}.should_not raise_error
189
+ end
190
+
191
+ it "should not use the native covariance" do
192
+ lambda{@a._jes_covariance(@b)}.should_not raise_error
193
+ end
194
+
195
+ it "should not use the native pearson_correlation" do
196
+ lambda{@a._jes_pearson_correlation(@b)}.should_not raise_error
197
+ end
198
+
199
+ it "should not use the native to_f!" do
200
+ lambda{@a._jes_to_f!}.should_not raise_error
201
+ end
202
+
203
+ it "should not use the native scale!" do
204
+ lambda{@a._jes_scale!(1)}.should_not raise_error
205
+ end
206
+
207
+ it "should not use the native scale_to_sigmoid!" do
208
+ lambda{@a._jes_scale_to_sigmoid!}.should_not raise_error
209
+ end
210
+
211
+ it "should not use the native normalize" do
212
+ lambda{@a._jes_normalize}.should_not raise_error
213
+ end
214
+
215
+ it "should not use the native normalize!" do
216
+ lambda{@a._jes_normalize!}.should_not raise_error
217
+ end
218
+
219
+ it "should not use the native scale_between" do
220
+ lambda{@a._jes_scale_between(6,8)}.should_not raise_error
221
+ end
222
+
223
+ it "should not use the native scale_between!" do
224
+ lambda{@a._jes_scale_between!(6,8)}.should_not raise_error
225
+ end
226
+
227
+ end
228
+
229
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: davidrichards-just_enumerable_stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Richards
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-11 00:00:00 -07:00
12
+ date: 2009-08-17 00:00:00 -07:00
13
13
  default_executable: jes
14
14
  dependencies: []
15
15
 
@@ -30,6 +30,7 @@ files:
30
30
  - spec/fixed_range_spec.rb
31
31
  - spec/just_enumerable_stats_spec.rb
32
32
  - spec/spec_helper.rb
33
+ - spec/unobtrusive_just_enumerable_stats_spec.rb
33
34
  has_rdoc: true
34
35
  homepage: http://github.com/davidrichards/just_enumerable_stats
35
36
  licenses: