Skip to content

Instantly share code, notes, and snippets.

View NMZivkovic's full-sized avatar

Nikola Živković NMZivkovic

View GitHub Profile
using await (var disposableEntity = parent.Start())
{
// do important work
disposableEntity.SomeFunction();
}
interface IPrintAddress
{
void PrintAddress() { WriteLine("rubikscode.net"); }
}
class Blog : IPrintAddress { } // Doesn't cause error!
IPrintAddress i = new Blog();
i.PrintAddress(); // prints "rubikscode.net"
extension ExtendedEntity extends Entity
{
private string _additionalField = "AdditionalField";
public string AdditionalField
{
get
{
return _additionalField;
}
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);
public interface IInputFunction
{
double CalculateInput(List<ISynapse> inputs);
}
public interface IActivationFunction
{
double CalculateOutput(double input);
}
public class StepActivationFunction : IActivationFunction
{
private double _treshold;
public StepActivationFunction(double treshold)
{
_treshold = treshold;
}
public double CalculateOutput(double input)
public class SigmoidActivationFunction : IActivationFunction
{
private double _coeficient;
public SigmoidActivationFunction(double coeficient)
{
_coeficient = coeficient;
}
public double CalculateOutput(double input)
public class RectifiedActivationFuncion : IActivationFunction
{
public double CalculateOutput(double input)
{
return Math.Max(0, input);
}
}
public class Neuron : INeuron
{
private IActivationFunction _activationFunction;
private IInputFunction _inputFunction;
/// <summary>
/// Input connections of the neuron.
/// </summary>
public List<ISynapse> Inputs { get; set; }