private void btnEstimateSigmoid_Click(object sender, EventArgs e)
{
DataTable source = dgvLearningSource.DataSource as DataTable;
// Creates a matrix from the source data table
double[,] sourceMatrix = source.ToMatrix(out columnNames);
// Get only the input vector values (in the first two columns)
double[][] inputs = sourceMatrix.GetColumns(0, 1).ToArray();
DoubleRange range; // valid range will be returned as an out parameter
var sigmoid = Sigmoid.Estimate(inputs, inputs.Length, out range);
if (sigmoid.Alpha < (double)Decimal.MaxValue && sigmoid.Alpha > (double)Decimal.MinValue)
numSigAlpha.Value = (decimal)sigmoid.Alpha;
if (sigmoid.Constant < (double)Decimal.MaxValue && sigmoid.Constant > (double)Decimal.MinValue)
numSigB.Value = (decimal)sigmoid.Constant;
}