Skip to content

Commit 58b5474

Browse files
NEAT & HyperNEAT, it compiles, but testing still needed.
1 parent 3d63313 commit 58b5474

File tree

75 files changed

+4884
-2009
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+4884
-2009
lines changed

encog-core-cs/Engine/Network/Activation/ActivationBiPolar.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,12 @@ public virtual double DerivativeFunction(double b, double a)
5454

5555

5656
/// <returns>Return true, bipolar has a 1 for derivative.</returns>
57-
public virtual bool HasDerivative()
57+
public virtual bool HasDerivative
5858
{
59-
return true;
59+
get
60+
{
61+
return true;
62+
}
6063
}
6164

6265
/// <inheritdoc />
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
namespace Encog.Engine.Network.Activation
7+
{
8+
/// <summary>
9+
/// The bipolar sigmoid activation function is like the regular sigmoid activation function,
10+
/// except Bipolar sigmoid activation function. TheOutput range is -1 to 1 instead of the more normal 0 to 1.
11+
///
12+
/// This activation is typically part of a CPPN neural network, such as
13+
/// HyperNEAT.
14+
///
15+
/// It was developed by Ken Stanley while at The University of Texas at Austin.
16+
/// http://www.cs.ucf.edu/~kstanley/
17+
/// </summary>
18+
[Serializable]
19+
public class ActivationBipolarSteepenedSigmoid : IActivationFunction
20+
{
21+
/// <summary>
22+
/// The parameters.
23+
/// </summary>
24+
private double[] _params;
25+
26+
/// <inheritdoc/>
27+
public void ActivationFunction(double[] d, int start, int size)
28+
{
29+
for (int i = start; i < start + size; i++)
30+
{
31+
if (d[i] < -1.0)
32+
{
33+
d[i] = -1.0;
34+
}
35+
if (d[i] > 1.0)
36+
{
37+
d[i] = 1.0;
38+
}
39+
}
40+
}
41+
42+
/// <inheritdoc/>
43+
public double DerivativeFunction(double b, double a)
44+
{
45+
return 1;
46+
}
47+
48+
/// <inheritdoc/>
49+
public bool HasDerivative
50+
{
51+
get
52+
{
53+
return true;
54+
}
55+
}
56+
57+
/// <inheritdoc/>
58+
public Object Clone()
59+
{
60+
return new ActivationBipolarSteepenedSigmoid();
61+
}
62+
63+
/// <inheritdoc />
64+
public virtual String[] ParamNames
65+
{
66+
get
67+
{
68+
String[] result = { };
69+
return result;
70+
}
71+
}
72+
73+
74+
/// <inheritdoc />
75+
public virtual double[] Params
76+
{
77+
get { return _params; }
78+
}
79+
80+
/// <inheritdoc/>
81+
public string FactoryCode
82+
{
83+
get
84+
{
85+
return null;
86+
}
87+
}
88+
}
89+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
namespace Encog.Engine.Network.Activation
7+
{
8+
/// <summary>
9+
/// Linear activation function that bounds the output to [-1,+1]. This
10+
/// activation is typically part of a CPPN neural network, such as
11+
/// HyperNEAT.
12+
///
13+
/// The idea for this activation function was developed by Ken Stanley, of
14+
/// the University of Texas at Austin.
15+
/// http://www.cs.ucf.edu/~kstanley/
16+
/// </summary>
17+
public class ActivationClippedLinear : IActivationFunction
18+
{
19+
/// <summary>
20+
/// The parameters.
21+
/// </summary>
22+
private double[] _params;
23+
24+
/// <inheritdoc/>
25+
public void ActivationFunction(double[] d, int start, int size)
26+
{
27+
for (int i = start; i < start + size; i++)
28+
{
29+
d[i] = (2.0 / (1.0 + Math.Exp(-4.9 * d[i]))) - 1.0;
30+
}
31+
}
32+
33+
/// <inheritdoc/>
34+
public double DerivativeFunction(double b, double a)
35+
{
36+
return 1;
37+
}
38+
39+
/// <inheritdoc/>
40+
public Object Clone()
41+
{
42+
return new ActivationBipolarSteepenedSigmoid();
43+
}
44+
45+
/// <inheritdoc />
46+
public virtual String[] ParamNames
47+
{
48+
get
49+
{
50+
String[] result = { };
51+
return result;
52+
}
53+
}
54+
55+
56+
/// <inheritdoc />
57+
public virtual double[] Params
58+
{
59+
get { return _params; }
60+
}
61+
62+
/// <inheritdoc/>
63+
public string FactoryCode
64+
{
65+
get
66+
{
67+
return null;
68+
}
69+
}
70+
71+
public bool HasDerivative { get { return true; } }
72+
}
73+
}

encog-core-cs/Engine/Network/Activation/ActivationCompetitive.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,12 @@ public virtual double[] Params
154154

155155

156156
/// <returns>False, indication that no derivative is available for thisfunction.</returns>
157-
public virtual bool HasDerivative()
157+
public virtual bool HasDerivative
158158
{
159-
return false;
159+
get
160+
{
161+
return false;
162+
}
160163
}
161164
}
162165
}

encog-core-cs/Engine/Network/Activation/ActivationElliott.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,12 @@ public double[] Params
100100
/// Return true, Elliott activation has a derivative.
101101
/// </summary>
102102
/// <returns>Return true, Elliott activation has a derivative.</returns>
103-
public bool HasDerivative()
103+
public bool HasDerivative
104104
{
105-
return true;
105+
get
106+
{
107+
return true;
108+
}
106109
}
107110

108111
#endregion

encog-core-cs/Engine/Network/Activation/ActivationElliottSymmetric.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,12 @@ public double[] Params
101101
/// Return true, Elliott activation has a derivative.
102102
/// </summary>
103103
/// <returns>Return true, Elliott activation has a derivative.</returns>
104-
public bool HasDerivative()
104+
public bool HasDerivative
105105
{
106-
return true;
106+
get
107+
{
108+
return true;
109+
}
107110
}
108111

109112
#endregion

0 commit comments

Comments
 (0)