protected override List <Signal> Calculate(List <Signal> values) { // Results.Clear(); // Results.Add(Math.Pow(values[0], power)); Signal inputSignal = values[0]; Signal outputSignal = Results[0]; outputSignal.Clone(inputSignal.Apply((item) => Math.Pow(item, power))); return(Results); }
protected override List <Signal> Calculate(List <Signal> values) { // Results.Clear(); // Results.Add(Math.Tanh(values[0])); Signal inputSignal = values[0]; Signal outputSignal = Results[0]; outputSignal.Clone(inputSignal.Apply(Math.Tanh)); return(Results); }
protected override List <Signal> Calculate(List <Signal> values) { // Results.Clear(); // Results.Add(Math.Sign(values[0])); Signal inputSignal = values[0]; Signal outputSignal = Results[0]; outputSignal.Clone(inputSignal.Apply((item) => Convert.ToDouble(Math.Sign(item)))); return(Results); }
protected override List <Signal> Calculate(List <Signal> values) { Signal outputSignal = Results[0]; if (rowNo == 0 && colNo == 0) { outputSignal.Pack(random.NextDouble() * (upper - lower) + lower); } else if (rowNo > 0 && colNo > 0) { var build = Matrix <double> .Build; var matrix = build.Dense(rowNo, colNo); Signal signal = new Signal(matrix); outputSignal.Pack(signal.Apply(_ => random.NextDouble() * (upper - lower) + lower)); } return(Results); }
protected override List <Signal> Calculate(List <Signal> values) { Signal inputSignal = values[0]; Signal outputSignal = Results[0]; outputSignal.Clone(inputSignal.Apply((item) => { if (item < right && item > left) { return(0); } else if (item <= left) { return(item - left); } else //item>=right { return(item - right); } })); return(Results); }
protected override List <Signal> Calculate(List <Signal> values) { // Results.Clear(); Signal inputSignal = values[0]; Signal outputSignal = Results[0]; outputSignal.Clone(inputSignal.Apply((item) => { if (item < upper && item > lower) { return(item); } else if (item <= lower) { return(lower); } else //item>=upper { return(upper); } })); return(Results); }