dmlc / XGBoost.jl

XGBoost Julia Package
Other
288 stars 110 forks source link

Fix errors in docs examples #129

Closed tylerjthomas9 closed 1 year ago

tylerjthomas9 commented 1 year ago
  1. Modify DMatrix to accept a generic tuple of 2 instead of a DataTuple I set the type to Tuple{Any,AbstractVector}, because we want a tuple of 2 items, and the second item has to be an abstract vector. I am not sure if we want this or just a generic tuple. This error was mentioned here

    DMatrix(Xy::Tuple{Any,AbstractVector}; kw...) = DMatrix(Xy[1], Xy[2]; kw...)
  2. Added a function for setting the value of the label in a DMatrix. Usage was in the docs, but I could not find this function.

    setlabel!(dm::DMatrix, info::AbstractVector) = setinfo!(dm, "label", info)
  3. Added functionality for instantiating a DMatrix with a table and symbol for the label. This was also in the docs, but it did not work.

    DMatrix(df, :y)  # equivalent to DMatrix(df, y)
ExpandingMan commented 1 year ago

Thanks! I was a bit more aggressive and just got rid of DataTuple altogether. There were also some problems with your DMatrix constructor because the Tables.jl interface does not guarantee that getindex method to exist.

This is superseded by #133 as it was easier for me to do there.