Пример #1
0
    def test_load_svmlight_files_comment_qid(self):
        X_train, y_train, q_train, X_test, y_test, q_test = \
            load_svmlight_files([datafile] * 2,  query_id=True)
        assert_array_equal(X_train, X_test)
        assert_array_equal(y_train, y_test)
        assert_equal(X_train.dtype, np.float32)
        assert_equal(X_test.dtype, np.float32)

        X1, y1, q1, X2, y2, q2, X3, y3, q3 = load_svmlight_files([datafile] * 3, query_id=True)
        assert_equal(X1.dtype, X2.dtype)
        assert_equal(X2.dtype, X3.dtype)
        assert_equal(X3.dtype, np.float32)
Пример #2
0
    def test_load_svmlight_files(self):
        # print load_svmlight_files([datafile] * 2)
        X_train, y_train, X_test, y_test = load_svmlight_files([datafile] * 2, query_id=False)
        assert_array_equal(X_train, X_test)
        assert_array_equal(y_train, y_test)
        assert_equal(X_train.dtype, np.float32)
        assert_equal(X_test.dtype, np.float32)

        X1, y1, X2, y2, X3, y3 = load_svmlight_files([datafile] * 3, query_id=False)
        assert_equal(X1.dtype, X2.dtype)
        assert_equal(X2.dtype, X3.dtype)
        assert_equal(X3.dtype, np.float32)
Пример #3
0
 def test_load_invalid_file2(self):
     try:
         load_svmlight_files([datafile, invalidfile, datafile])
         assert False
     except RuntimeError:
         pass