test package

Submodules

test.test_losses module

Documentation

class test.test_losses.TestLambdaWeights(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_tfr_create_ndcg_lambda_weight()[source]
test_tfr_default()[source]
test_tfr_gain_and_discount()[source]
test_tfr_individual_weights()[source]
test_tfr_invalid_labels()[source]
test_tfr_normalized()[source]
test_tfr_smooth_fraction()[source]
test_tfr_topn()[source]
class test.test_losses.TestLosses(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

exp_softmax = [[0.69638747, 0.01275478, 0.25618663, 0.03467109, 0.0, 0.0], [0.01936247, 0.05263266, 0.14307041, 0.00712306, 0.3889057, 0.3889057], [0.01798621, 0.98201376, 0.0, 0.0, 0.0, 0.0], [0.01786798, 0.00657326, 0.9755587, 0.0, 0.0, 0.0], [0.33333334, 0.33333334, 0.33333334, 0.0, 0.0, 0.0]]
test_approximate_bidi_ndcg()[source]
test_approximate_ndcg()[source]
test_masked_softmax()[source]
test_mean_squared_error()[source]
test_multi_loss()[source]
test_ranking_cross_entropy()[source]
test_ranking_softmax_loss()[source]
test_tfr_approximate_ndcg()[source]
y_pred = <tf.RaggedTensor [[3.5, 2.200000047683716, 0.5, 1.0], [1.7000000476837158, 2.299999952316284, 2.0999999046325684, 1.100000023841858, 0.10000000149011612, 1.0], [3.799999952316284, 0.800000011920929], [1.5, -1.0, 1.0], [0.10000000149011612, 1.0, 0.30000001192092896]]>
y_true = <tf.RaggedTensor [[4.0, 0.0, 3.0, 1.0], [1.0, 2.0, 3.0, 0.0, 4.0, 4.0], [0.0, 4.0], [-1.0, -2.0, 3.0], [0.0, 0.0, 0.0]]>

test.test_metrics module

Documentation

class test.test_metrics.TestMetrics(methodName='runTest')[source]

Bases: tensorflow.python.framework.test_util.TensorFlowTestCase

Test cases for metrics. Test names that are prefixed with tfr are a subset of the test cases from the tensorflow ranking project to verify that the results are the same. However, these tests are not particularly robust and do not test padded queries, so additional tests are also included.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

exp_rank = array([[0, 1, 3, 2, 4, 5], [1, 2, 0, 3, 5, 4], [0, 1, 2, 3, 4, 5], [0, 2, 1, 3, 4, 5], [1, 2, 0, 3, 4, 5]])
classmethod expected_dcg(y_true, y_pred)[source]
test_dcg()[source]
test_ndcg()[source]
test_tfr_dcg()[source]
test_tfr_ndcg()[source]
test_tfr_ndcg_with_weights()[source]
test_tfr_ndcg_with_weights_zero_relevance()[source]
test_tfr_ndcg_with_zero_relevance()[source]
y_pred = <tf.RaggedTensor [[3.5, 2.200000047683716, 0.5, 1.0], [1.7000000476837158, 2.299999952316284, 2.0999999046325684, 1.100000023841858, 0.10000000149011612, 1.0], [3.799999952316284, 0.800000011920929], [1.5, -1.0, 1.0], [0.10000000149011612, 1.0, 0.30000001192092896]]>
y_pred_dense = <tf.Tensor: shape=(5, 6), dtype=float32, numpy= array([[ 3.5000000e+00, 2.2000000e+00, 5.0000000e-01, 1.0000000e+00, -3.4028235e+38, -3.4028235e+38], [ 1.7000000e+00, 2.3000000e+00, 2.0999999e+00, 1.1000000e+00, 1.0000000e-01, 1.0000000e+00], [ 3.8000000e+00, 8.0000001e-01, -3.4028235e+38, -3.4028235e+38, -3.4028235e+38, -3.4028235e+38], [ 1.5000000e+00, -1.0000000e+00, 1.0000000e+00, -3.4028235e+38, -3.4028235e+38, -3.4028235e+38], [ 1.0000000e-01, 1.0000000e+00, 3.0000001e-01, -3.4028235e+38, -3.4028235e+38, -3.4028235e+38]], dtype=float32)>
y_true = <tf.RaggedTensor [[4, 0, 3, 1], [1, 2, 3, 0, 4, 4], [0, 4], [-1, -2, 3], [0, 0, 0]]>

test.test_preprocessing module

Documentation

class test.test_preprocessing.TestPreprocessing(methodName='runTest')[source]

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_min_max_scaler()[source]
test_power_transformer()[source]
test_robust_scaler()[source]
test_standard_scaler()[source]
x = array([[ 2., 0., 0., 9., 8., 2., -1., 1.], [ 2., 2., 7., 8., 7., 0., 4., -2.], [ 5., 0., 6., 3., 8., 7., 8., 7.], [ 2., -1., 7., 3., 1., 6., 4., 5.], [ 1., 7., 8., 2., 1., 1., 3., 7.]], dtype=float32)

Module contents

Documentation