Changeset 155 for trunk/sources/HeuristicLab.Functions/Average.cs
- Timestamp:
- 04/22/08 18:05:14 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Functions/Average.cs
r2 r155 31 31 public override string Description { 32 32 get { 33 return @"Returns the average (arithmetic mean) of all sub- operatorresults.";33 return @"Returns the average (arithmetic mean) of all sub-tree results."; 34 34 } 35 35 } … … 40 40 } 41 41 42 public Average(Average source, IDictionary<Guid, object> clonedObjects) 43 : base(source, clonedObjects) { 44 } 45 46 47 public override double Evaluate(Dataset dataset, int sampleIndex) { 42 public override double Apply(Dataset dataset, int sampleIndex, double[] args) { 48 43 double sum = 0.0; 49 for(int i = 0; i < SubFunctions.Count; i++) {50 sum += SubFunctions[i].Evaluate(dataset, sampleIndex);44 for(int i = 0; i < args.Length; i++) { 45 sum += args[i]; 51 46 } 52 return sum / SubFunctions.Count; 53 } 54 55 public override object Clone(IDictionary<Guid, object> clonedObjects) { 56 Average clone = new Average(this, clonedObjects); 57 clonedObjects.Add(clone.Guid, clone); 58 return clone; 47 return sum / args.Length; 59 48 } 60 49
Note: See TracChangeset
for help on using the changeset viewer.