This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using await (var disposableEntity = parent.Start()) | |
{ | |
// do important work | |
disposableEntity.SomeFunction(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface IPrintAddress | |
{ | |
void PrintAddress() { WriteLine("rubikscode.net"); } | |
} | |
class Blog : IPrintAddress { } // Doesn't cause error! | |
IPrintAddress i = new Blog(); | |
i.PrintAddress(); // prints "rubikscode.net" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension ExtendedEntity extends Entity | |
{ | |
private string _additionalField = "AdditionalField"; | |
public string AdditionalField | |
{ | |
get | |
{ | |
return _additionalField; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface INeuron | |
{ | |
Guid Id { get; } | |
double PreviousPartialDerivate { get; set; } | |
List<ISynapse> Inputs { get; set; } | |
List<ISynapse> Outputs { get; set; } | |
void AddInputNeuron(INeuron inputNeuron); | |
void AddOutputNeuron(INeuron inputNeuron); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IInputFunction | |
{ | |
double CalculateInput(List<ISynapse> inputs); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IActivationFunction | |
{ | |
double CalculateOutput(double input); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StepActivationFunction : IActivationFunction | |
{ | |
private double _treshold; | |
public StepActivationFunction(double treshold) | |
{ | |
_treshold = treshold; | |
} | |
public double CalculateOutput(double input) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SigmoidActivationFunction : IActivationFunction | |
{ | |
private double _coeficient; | |
public SigmoidActivationFunction(double coeficient) | |
{ | |
_coeficient = coeficient; | |
} | |
public double CalculateOutput(double input) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RectifiedActivationFuncion : IActivationFunction | |
{ | |
public double CalculateOutput(double input) | |
{ | |
return Math.Max(0, input); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Neuron : INeuron | |
{ | |
private IActivationFunction _activationFunction; | |
private IInputFunction _inputFunction; | |
/// <summary> | |
/// Input connections of the neuron. | |
/// </summary> | |
public List<ISynapse> Inputs { get; set; } |