public void ShouldHaveCorrectNetValuesInverseWithOffsetPast0() { var myFunction = new SigmoidFunction(new SigmoidFunctionConfig { offset = 0f, range = 10f, yRange = 1f }); var offsettedValue = 0.988565420571308328; var expectedValueTable = new Dictionary <float, float> { { 0f, (float)(0 - offsettedValue) }, { -1f, (float)(-0.99576033664861238091444299431088089366184175169765377856 - offsettedValue) }, { -2f, (float)(-1.99419611796465617607528580607077258667289101133381732908 - offsettedValue) }, { -6f, (float)(-5.99330135307220032534204550450772727429328160638888197171 - offsettedValue) }, { -7f, (float)(-6.99329079570435966418901789133356611158827908472468216254 - offsettedValue) }, { -10f, (float)(-9.99328495741315564510406920928653520521498975323882941468 - offsettedValue) }, }; foreach (var expectedPair in expectedValueTable) { Assert.AreEqual(expectedPair.Key, myFunction.GetPointFromNetExtraValueFromPoint(expectedPair.Value, 1), 1e-5); } }
public void ShouldHaveCorrectNetValuesInverseWithOffset() { var myFunction = new SigmoidFunction(new SigmoidFunctionConfig { offset = 0f, range = 10f, yRange = 1f }); var offsettedValue = 0.988565420571308328; var expectedValueTable = new Dictionary <float, float> { { 0f, (float)(0 - offsettedValue) }, { 1f, (float)(0.988565420571308328 - offsettedValue) }, { 2f, (float)(1.958127996915376009 - offsettedValue) }, { 6f, (float)(4.693453660970895236 - offsettedValue) }, { 7f, (float)(4.879787337446145572 - offsettedValue) }, { 10f, (float)(5f - offsettedValue) }, }; foreach (var expectedPair in expectedValueTable) { Assert.AreEqual(expectedPair.Key, myFunction.GetPointFromNetExtraValueFromPoint(expectedPair.Value, 1), 1e-5); } }
public void ShouldHaveCorrectNetValuesInverseWhenPastLimitOfIntegral() { var myFunction = new SigmoidFunction(new SigmoidFunctionConfig { offset = 0f, range = 10f, yRange = 1f }); var expectedValueTable = new Dictionary <float, float> { { float.MaxValue, (float)(100f) }, }; foreach (var expectedPair in expectedValueTable) { Assert.AreEqual(expectedPair.Key, myFunction.GetPointFromNetExtraValueFromPoint(expectedPair.Value, 1), 1e-5); } }