[Breaking] Require format to be specified in input URI. (#9077)
Previously, we use `libsvm` as default when format is not specified. However, the dmlc data parser is not particularly robust against errors, and the most common type of error is undefined format. Along with which, we will recommend users to use other data loader instead. We will continue the maintenance of the parsers as it's currently used for many internal tests including federated learning.
This commit is contained in:
@@ -283,7 +283,7 @@ class TestDMatrix:
|
||||
assert m0.feature_types == m1.feature_types
|
||||
|
||||
def test_get_info(self):
|
||||
dtrain = xgb.DMatrix(dpath + 'agaricus.txt.train')
|
||||
dtrain, _ = tm.load_agaricus(__file__)
|
||||
dtrain.get_float_info('label')
|
||||
dtrain.get_float_info('weight')
|
||||
dtrain.get_float_info('base_margin')
|
||||
@@ -432,7 +432,9 @@ class TestDMatrix:
|
||||
def test_uri_categorical(self):
|
||||
path = os.path.join(dpath, 'agaricus.txt.train')
|
||||
feature_types = ["q"] * 5 + ["c"] + ["q"] * 120
|
||||
Xy = xgb.DMatrix(path + "?indexing_mode=1", feature_types=feature_types)
|
||||
Xy = xgb.DMatrix(
|
||||
path + "?indexing_mode=1&format=libsvm", feature_types=feature_types
|
||||
)
|
||||
np.testing.assert_equal(np.array(Xy.feature_types), np.array(feature_types))
|
||||
|
||||
def test_base_margin(self):
|
||||
|
||||
Reference in New Issue
Block a user