Skip to content

Commit e16042a

Browse files
committed
Přidejte soubory projektu.
1 parent 0e0a2e2 commit e16042a

File tree

190 files changed

+38446
-0
lines changed

Some content is hidden

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

190 files changed

+38446
-0
lines changed

.editorconfig

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[*.cs]
2+
3+
# IDE0090: Použít new(...)
4+
dotnet_diagnostic.IDE0090.severity = none

EasyML.sln

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.5.33530.505
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyMLCore", "EasyMLCore\EasyMLCore.csproj", "{7F77B739-279E-47BE-9BE3-CA549CBF26BF}"
7+
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyMLEduApp", "EasyMLEduApp\EasyMLEduApp.csproj", "{C6A84CEC-52C1-427F-8A2A-69F749D034E5}"
9+
EndProject
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{27D8C4CB-2A9E-4803-AA75-55879C483CFE}"
11+
ProjectSection(SolutionItems) = preProject
12+
.editorconfig = .editorconfig
13+
EndProjectSection
14+
EndProject
15+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Položky řešení", "Položky řešení", "{5A1CEEE1-E036-4A12-ACBE-D94BCFA98698}"
16+
ProjectSection(SolutionItems) = preProject
17+
..\..\..\Development\NET\LICENSE.txt = ..\..\..\Development\NET\LICENSE.txt
18+
..\..\..\Development\NET\Readme.md = ..\..\..\Development\NET\Readme.md
19+
EndProjectSection
20+
EndProject
21+
Global
22+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
23+
Debug|Any CPU = Debug|Any CPU
24+
Debug|x64 = Debug|x64
25+
Release|Any CPU = Release|Any CPU
26+
Release|x64 = Release|x64
27+
EndGlobalSection
28+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
29+
{7F77B739-279E-47BE-9BE3-CA549CBF26BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30+
{7F77B739-279E-47BE-9BE3-CA549CBF26BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
31+
{7F77B739-279E-47BE-9BE3-CA549CBF26BF}.Debug|x64.ActiveCfg = Debug|x64
32+
{7F77B739-279E-47BE-9BE3-CA549CBF26BF}.Debug|x64.Build.0 = Debug|x64
33+
{7F77B739-279E-47BE-9BE3-CA549CBF26BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
34+
{7F77B739-279E-47BE-9BE3-CA549CBF26BF}.Release|Any CPU.Build.0 = Release|Any CPU
35+
{7F77B739-279E-47BE-9BE3-CA549CBF26BF}.Release|x64.ActiveCfg = Release|x64
36+
{7F77B739-279E-47BE-9BE3-CA549CBF26BF}.Release|x64.Build.0 = Release|x64
37+
{C6A84CEC-52C1-427F-8A2A-69F749D034E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
38+
{C6A84CEC-52C1-427F-8A2A-69F749D034E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
39+
{C6A84CEC-52C1-427F-8A2A-69F749D034E5}.Debug|x64.ActiveCfg = Debug|x64
40+
{C6A84CEC-52C1-427F-8A2A-69F749D034E5}.Debug|x64.Build.0 = Debug|x64
41+
{C6A84CEC-52C1-427F-8A2A-69F749D034E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
42+
{C6A84CEC-52C1-427F-8A2A-69F749D034E5}.Release|Any CPU.Build.0 = Release|Any CPU
43+
{C6A84CEC-52C1-427F-8A2A-69F749D034E5}.Release|x64.ActiveCfg = Release|x64
44+
{C6A84CEC-52C1-427F-8A2A-69F749D034E5}.Release|x64.Build.0 = Release|x64
45+
EndGlobalSection
46+
GlobalSection(SolutionProperties) = preSolution
47+
HideSolutionNode = FALSE
48+
EndGlobalSection
49+
GlobalSection(ExtensibilityGlobals) = postSolution
50+
SolutionGuid = {4E97701F-D6DC-4C72-A4F5-0E477A185DA9}
51+
EndGlobalSection
52+
EndGlobal
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using EasyMLCore.Extensions;
2+
using EasyMLCore.MathTools;
3+
using System;
4+
5+
namespace EasyMLCore.Activation
6+
{
7+
/// <summary>
8+
/// Implements the Bent Identity activation function.
9+
/// </summary>
10+
[Serializable]
11+
public class AFBentIdentity : ActivationBase
12+
{
13+
//Constructor
14+
/// <summary>
15+
/// Creates an initialized instance.
16+
/// </summary>
17+
public AFBentIdentity()
18+
: base(ActivationFnID.BentIdentity, Interval.IntZPI)
19+
{
20+
return;
21+
}
22+
23+
//Methods
24+
/// <inheritdoc/>
25+
public override double Compute(double sum)
26+
{
27+
return (Math.Sqrt(sum.Power(2) + 1d) - 1d) / 2d + sum;
28+
}
29+
30+
/// <inheritdoc/>
31+
public override double ComputeDerivative(double sum, double activation)
32+
{
33+
return sum / (2d * Math.Sqrt(sum.Power(2) + 1d)) + 1d;
34+
}
35+
36+
}//BentIdentity
37+
38+
}//Namespace

EasyMLCore/Activation/AFELU.cs

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using EasyMLCore.Extensions;
2+
using EasyMLCore.MathTools;
3+
using System;
4+
5+
namespace EasyMLCore.Activation
6+
{
7+
/// <summary>
8+
/// Implements the Exponential Linear Unit activation function.
9+
/// </summary>
10+
[Serializable]
11+
public class AFELU : ActivationBase
12+
{
13+
//Constants
14+
private const double Alpha = 1d;
15+
//Static members
16+
private static readonly Interval _range = new Interval(-Alpha, double.MaxValue.Bound(), false, true);
17+
18+
//Constructor
19+
/// <summary>
20+
/// Creates an initialized instance.
21+
/// </summary>
22+
public AFELU()
23+
: base(ActivationFnID.ELU, _range)
24+
{
25+
return;
26+
}
27+
28+
//Methods
29+
/// <inheritdoc/>
30+
public override double Compute(double sum)
31+
{
32+
return (sum < 0) ? (Alpha * (Math.Exp(sum) - 1)) : sum;
33+
}
34+
35+
/// <inheritdoc/>
36+
public override double ComputeDerivative(double sum, double activation)
37+
{
38+
return (sum < 0) ? (activation + Alpha) : 1d;
39+
}
40+
41+
/// <inheritdoc/>
42+
public override double GetNormalInitWeightsStdDev(int numOfInputNodes, int numOfLayerNeurons)
43+
{
44+
return Math.Sqrt(1d / numOfInputNodes);
45+
}
46+
47+
}//AFELU
48+
49+
}//Namespace

EasyMLCore/Activation/AFElliotSig.cs

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using EasyMLCore.Extensions;
2+
using EasyMLCore.MathTools;
3+
using System;
4+
5+
namespace EasyMLCore.Activation
6+
{
7+
/// <summary>
8+
/// Implements the Elliot activation function (aka Softsign).
9+
/// </summary>
10+
[Serializable]
11+
public class AFElliotSig : ActivationBase
12+
{
13+
//Constants
14+
private const double Slope = 1d;
15+
16+
//Constructor
17+
/// <summary>
18+
/// Creates an initialized instance.
19+
/// </summary>
20+
public AFElliotSig()
21+
: base(ActivationFnID.ElliotSig, Interval.IntN1P1)
22+
{
23+
return;
24+
}
25+
26+
//Methods
27+
/// <inheritdoc/>
28+
public override double Compute(double sum)
29+
{
30+
sum *= Slope;
31+
return sum / (1d + Math.Abs(sum));
32+
}
33+
34+
/// <inheritdoc/>
35+
public override double ComputeDerivative(double sum, double activation)
36+
{
37+
return Slope / ((1d + Math.Abs(activation * Slope)).Power(2));
38+
}
39+
40+
/// <inheritdoc/>
41+
public override double GetNormalInitWeightsStdDev(int numOfInputNodes, int numOfLayerNeurons)
42+
{
43+
//Xavier Initialization
44+
return Math.Sqrt(2d / (numOfInputNodes + numOfLayerNeurons));
45+
}
46+
47+
}//AFElliotSig
48+
49+
}//Namespace

EasyMLCore/Activation/AFGELU.cs

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using EasyMLCore.Extensions;
2+
using EasyMLCore.MathTools;
3+
using System;
4+
5+
namespace EasyMLCore.Activation
6+
{
7+
/// <summary>
8+
/// Implements the Gaussian Error Linear Unit activation function.
9+
/// </summary>
10+
[Serializable]
11+
public class AFGELU : ActivationBase
12+
{
13+
//Static members
14+
private static readonly double PF = Math.Sqrt(2d / Math.PI);
15+
private static readonly Interval _range = new Interval(-0.170041d, double.MaxValue.Bound(), false, true);
16+
17+
//Constructor
18+
/// <summary>
19+
/// Creates an initialized instance.
20+
/// </summary>
21+
public AFGELU()
22+
: base(ActivationFnID.GELU, _range)
23+
{
24+
return;
25+
}
26+
27+
//Methods
28+
/// <inheritdoc/>
29+
public override double Compute(double sum)
30+
{
31+
return 0.5d * sum * (1d + Math.Tanh(PF * (sum + 0.044715d * (sum * sum * sum))));
32+
}
33+
34+
/// <inheritdoc/>
35+
public override double ComputeDerivative(double sum, double activation)
36+
{
37+
return 0.5 * Math.Tanh(0.0356774d * sum * sum * sum + 0.797885d * sum) + (1d / Math.Cosh(0.0535161d * sum * sum * sum + 0.398942d * sum)).Power(2) * (0.0356774d * sum * sum * sum + 0.797885d * sum) + 0.5d;
38+
}
39+
40+
41+
}//AFGELU
42+
43+
}//Namespace

EasyMLCore/Activation/AFLeakyReLU.cs

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using EasyMLCore.MathTools;
2+
using System;
3+
4+
namespace EasyMLCore.Activation
5+
{
6+
/// <summary>
7+
/// Implements the Leaky Rectified Linear Unit activation function.
8+
/// </summary>
9+
[Serializable]
10+
public class AFLeakyReLU : ActivationBase
11+
{
12+
//Constants
13+
private const double NegSlope = 0.01d;
14+
15+
//Constructor
16+
/// <summary>
17+
/// Creates an initialized instance.
18+
/// </summary>
19+
public AFLeakyReLU()
20+
: base(ActivationFnID.LeakyReLU, Interval.IntNIPI)
21+
{
22+
return;
23+
}
24+
25+
//Methods
26+
/// <inheritdoc/>
27+
public override double Compute(double sum)
28+
{
29+
return (sum < 0) ? (NegSlope * sum) : sum;
30+
}
31+
32+
/// <inheritdoc/>
33+
public override double ComputeDerivative(double sum, double activation)
34+
{
35+
return (sum < 0) ? NegSlope : 1d;
36+
}
37+
38+
}//AFLeakyReLU
39+
40+
}//Namespace

EasyMLCore/Activation/AFLinear.cs

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using EasyMLCore.MathTools;
2+
using System;
3+
4+
namespace EasyMLCore.Activation
5+
{
6+
/// <summary>
7+
/// Implements the Linear activation function (aka Identity).
8+
/// </summary>
9+
[Serializable]
10+
public class AFLinear : ActivationBase
11+
{
12+
//Constructor
13+
/// <summary>
14+
/// Creates an initialized instance.
15+
/// </summary>
16+
public AFLinear()
17+
: base(ActivationFnID.Linear, Interval.IntNIPI)
18+
{
19+
return;
20+
}
21+
22+
//Methods
23+
/// <inheritdoc/>
24+
public override double Compute(double sum)
25+
{
26+
return sum;
27+
}
28+
29+
/// <inheritdoc/>
30+
public override double ComputeDerivative(double sum, double activation)
31+
{
32+
return 1d;
33+
}
34+
35+
/// <inheritdoc/>
36+
public override double GetNormalInitWeightsStdDev(int numOfInputNodes, int numOfLayerNeurons)
37+
{
38+
//Xavier-Glorot initialization
39+
return Math.Sqrt(2d / (numOfInputNodes + numOfLayerNeurons));
40+
}
41+
42+
}//AFLinear
43+
44+
}//Namespace

EasyMLCore/Activation/AFReLU.cs

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using EasyMLCore.MathTools;
2+
using System;
3+
4+
namespace EasyMLCore.Activation
5+
{
6+
/// <summary>
7+
/// Implements the Rectified Linear Unit activation function.
8+
/// </summary>
9+
[Serializable]
10+
public class AFReLU : ActivationBase
11+
{
12+
//Constructor
13+
/// <summary>
14+
/// Creates an initialized instance.
15+
/// </summary>
16+
public AFReLU()
17+
: base(ActivationFnID.ReLU, Interval.IntZPI)
18+
{
19+
return;
20+
}
21+
22+
//Methods
23+
/// <inheritdoc/>
24+
public override double Compute(double sum)
25+
{
26+
return Math.Max(0d, sum);
27+
}
28+
29+
/// <inheritdoc/>
30+
public override double ComputeDerivative(double sum, double activation)
31+
{
32+
return (sum > 0) ? 1d : 0d;
33+
}
34+
35+
}//AFReLU
36+
37+
}//Namespace

0 commit comments

Comments
 (0)