Deprecation warning for lists passed into DMatrix (#3970)
* Ensure lists cannot be passed into DMatrix The documentation does not include lists as an allowed type for the data inputted into DMatrix. Despite this, a list can be passed in without an error. This change would prevent a list form being passed in directly.
This commit is contained in:
parent
53f695acf2
commit
fd722d60cd
@ -14,6 +14,7 @@ import ctypes
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
import numpy as np
|
||||
import scipy.sparse
|
||||
@ -381,6 +382,10 @@ class DMatrix(object):
|
||||
label = _maybe_dt_array(label)
|
||||
weight = _maybe_dt_array(weight)
|
||||
|
||||
if isinstance(data, list):
|
||||
warnings.warn('Initializing DMatrix from List is deprecated.',
|
||||
DeprecationWarning)
|
||||
|
||||
if isinstance(data, STRING_TYPES):
|
||||
self.handle = ctypes.c_void_p()
|
||||
_check_call(_LIB.XGDMatrixCreateFromFile(c_str(data),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user