From 3fbbafe94896d9ffb7693fbe6a9edf264928b077 Mon Sep 17 00:00:00 2001 From: Tyler Thomas <36181311+tylerjthomas9@users.noreply.github.com> Date: Tue, 27 Jun 2023 08:23:00 -0700 Subject: [PATCH] Fix missing docs, feature_importance input type (#26) --- docs/src/wrapper.md | 6 +++--- src/wrapper.jl | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/src/wrapper.md b/docs/src/wrapper.md index 00c34d8..b9bb8b7 100644 --- a/docs/src/wrapper.md +++ b/docs/src/wrapper.md @@ -7,9 +7,9 @@ Pool CatBoost.CatBoostClassifier CatBoost.CatBoostRegressor cv -to_catboost -to_pandas +CatBoost.to_catboost +CatBoost.to_pandas pandas_to_tbl -feature_importance +CatBoost.feature_importance load_dataset ``` diff --git a/src/wrapper.jl b/src/wrapper.jl index 5d9317f..411861f 100644 --- a/src/wrapper.jl +++ b/src/wrapper.jl @@ -39,9 +39,9 @@ cv(pool::Py; kwargs...) = pandas_to_tbl(catboost.cv(pool; kwargs...)) ##### """ - to_catboost(arg) + CatBoost.to_catboost(arg) -`to_catboost` is called on each argument passed to [`fit`](@ref), [`predict`](@ref), [`predict_proba`](@ref), and [`cv`](@ref) +`CatBoost.to_catboost` is called on each argument passed to [`fit`](@ref), [`predict`](@ref), [`predict_proba`](@ref), and [`cv`](@ref) to allow customization of the conversion of Julia types to python types. By default, `to_catboost` simply checks if the argument satisfies `Tables.istable(arg)`, and if so, it outputs @@ -55,7 +55,7 @@ to_catboost(arg) = Tables.istable(arg) ? to_pandas(arg) : arg all_to_catboost(args) = (to_catboost(arg) for arg in args) """ - to_pandas(X) + CatBoost.to_pandas(X) Convert a table/array to a pandas dataframe """ @@ -83,11 +83,11 @@ end ##### """ - feature_importance(py_model) + CatBoost.feature_importance(py_model::Py) Generate a Vector{Pair{Symbol, Float64}} of feature importances """ -function feature_importance(py_model) +function feature_importance(py_model::Py) py_df_importance = pandas.DataFrame() py_df_importance["name"] = py_model.feature_names_ py_df_importance["importance"] = py_model.feature_importances_