Last change
on this file was
17980,
checked in by jzenisek, 4 years ago
|
#2719 merged head of HeuristicLab.Problems.DataAnalysis into branch; added several minor items
|
File size:
1.8 KB
|
Rev | Line | |
---|
[10780] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
[12612] | 3 | using System.Linq;
|
---|
[10780] | 4 | using HeuristicLab.Common;
|
---|
| 5 | using HeuristicLab.Core;
|
---|
| 6 | using HeuristicLab.Data;
|
---|
| 7 | using HeuristicLab.Parameters;
|
---|
[17980] | 8 | using HEAL.Attic;
|
---|
[10780] | 9 |
|
---|
[11068] | 10 | namespace HeuristicLab.Problems.DataAnalysis {
|
---|
[17980] | 11 | [StorableType("AAB32034-FA4A-4D70-937F-EF026C1D508A")]
|
---|
[10909] | 12 | [Item("Exponential Transformation", "f(x) = b ^ x | Represents a exponential transformation.")]
|
---|
[10780] | 13 | public class ExponentialTransformation : Transformation<double> {
|
---|
| 14 | protected const string BaseParameterName = "Base";
|
---|
| 15 |
|
---|
| 16 | #region Parameters
|
---|
| 17 | public IValueParameter<DoubleValue> BaseParameter {
|
---|
| 18 | get { return (IValueParameter<DoubleValue>)Parameters[BaseParameterName]; }
|
---|
| 19 | }
|
---|
| 20 | #endregion
|
---|
| 21 |
|
---|
| 22 | #region properties
|
---|
[10932] | 23 | public override string ShortName {
|
---|
| 24 | get { return "Exp"; }
|
---|
| 25 | }
|
---|
[10780] | 26 | public double Base {
|
---|
| 27 | get { return BaseParameter.Value.Value; }
|
---|
| 28 | }
|
---|
| 29 | #endregion
|
---|
| 30 |
|
---|
| 31 | [StorableConstructor]
|
---|
[17980] | 32 | protected ExponentialTransformation(StorableConstructorFlag _) : base(_) { }
|
---|
[11114] | 33 |
|
---|
| 34 | protected ExponentialTransformation(ExponentialTransformation original, Cloner cloner)
|
---|
[10780] | 35 | : base(original, cloner) {
|
---|
| 36 | }
|
---|
[11114] | 37 |
|
---|
[10780] | 38 | public ExponentialTransformation(IEnumerable<string> allowedColumns)
|
---|
| 39 | : base(allowedColumns) {
|
---|
[10808] | 40 | Parameters.Add(new ValueParameter<DoubleValue>(BaseParameterName, "b | Base of exp-function", new DoubleValue(Math.E)));
|
---|
[10780] | 41 | }
|
---|
| 42 |
|
---|
| 43 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 44 | return new ExponentialTransformation(this, cloner);
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | public override IEnumerable<double> Apply(IEnumerable<double> data) {
|
---|
[12612] | 48 | return data.Select(d => Math.Pow(Base, d));
|
---|
[10780] | 49 | }
|
---|
| 50 |
|
---|
| 51 | public override bool Check(IEnumerable<double> data, out string errorMsg) {
|
---|
| 52 | errorMsg = "";
|
---|
| 53 | return true;
|
---|
| 54 | }
|
---|
| 55 | }
|
---|
| 56 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.