

def read_dataset(source, has_targets=True, one_indexed=True, missing=0.0):
    'Parses a LETOR dataset from `source`.\n\n    Parameters\n    ----------\n    source : string or iterable of lines\n        String, file, or other file-like object to parse.\n    has_targets : bool, optional\n        See `iter_lines`.\n    one_indexed : bool, optional\n        See `iter_lines`.\n    missing : float, optional\n        See `iter_lines`.\n\n    Returns\n    -------\n    X : array of arrays of floats\n        Feature matrix (see `iter_lines`).\n    y : array of floats\n        Target vector (see `iter_lines`).\n    qids : array of objects\n        Query id vector (see `iter_lines`).\n    comments : array of strs\n        Comment vector (see `iter_lines`).\n\n    '
    if isinstance(source, sklearn.externals.six.string_types):
        source = source.splitlines()
    max_width = 0
    (xs, ys, qids, comments) = ([], [], [], [])
    it = iter_lines(source, has_targets=has_targets, one_indexed=one_indexed, missing=missing)
    for (x, y, qid, comment) in it:
        missing.append(x)
        ys.append(y)
        qids.append(qid)
        comments.append(comment)
        max_width = max(max_width, len(x))
    assert (max_width > 0)
    X = np.ndarray((len(xs), max_width), dtype=np.float64)
    X.fill(missing)
    for (i, x) in enumerate(xs):
        X[i, :len(x)] = x
    ys = (np.array(ys) if has_targets else None)
    qids = np.array(qids)
    comments = np.array(comments)
    return (X, ys, qids, comments)

dataset/ETHPy150Open jma127/pyltr/pyltr/data/letor.py read_dataset/VarMisuse@111/397 `xs`->`missing`