var inputs = new double[] { 234, 234, 356, 465, 546, 766, 233 };
var scaler = new MinMaxScaler();
var outputs = scaler.Scale(inputs);
Console.WriteLine(outputs);
double[] Scale(double[] inputs);
public sealed class MinMaxScaler : IScaler
public double[] Scale(double[] inputs)
if (inputs == null || inputs.Length == 0)
throw new ArgumentOutOfRangeException(nameof(inputs));
var (min, max) = MinMax(inputs);
return inputs.Select(current => (current - min) / range).ToArray();
private static (double, double) MinMax(double[] inputs)
for (var index = 1; index < inputs.Length; ++index)
else if (inputs[index] > max)