def test_sigmoid_calibration():
 exF = np.array([5, (-4), 1.0])
 exY = np.array([1, (-1), (-1)])
 AB_lin_libsvm = np.array([(-0.20261354391187855), 0.6523631498001051])
 assert_array_almost_equal(AB_lin_libsvm, _sigmoid_calibration(exF, exY), 3)
 lin_prob = (1.0 / (1.0 + np.exp(((AB_lin_libsvm[0] * exF) + AB_lin_libsvm[1]))))
 sk_prob = _SigmoidCalibration().fit(exF, exY).predict(exF)
 assert_array_almost_equal(lin_prob, sk_prob, 6)
 assert_raises(ValueError, _SigmoidCalibration().fit, np.vstack((exF, exF)), exY)

def test_sigmoid_calibration ( ) : exF = np . array ( [ 5 , ( - 4 ) , 1.0 ] ) exY = np . array ( [ 1 , ( - 1 ) , ( - 1 ) ] ) AB_lin_libsvm = np . array ( [ ( - 0.20261354391187855 ) , 0.6523631498001051 ] ) assert_array_almost_equal ( AB_lin_libsvm , _sigmoid_calibration ( exF , exY ) , 3 ) lin_prob = ( 1.0 / ( 1.0 + np . exp ( ( ( AB_lin_libsvm [ 0 ] * exF ) + AB_lin_libsvm [ 1 ] ) ) ) ) sk_prob = _SigmoidCalibration ( ) . fit ( exF , exY ) . predict ( exF ) assert_array_almost_equal ( lin_prob , sk_prob , 6 ) assert_raises ( ValueError , _SigmoidCalibration ( ) . fit , np . vstack ( ( exF , exF ) ) , exY )
test calibration values with platt sigmoid model .