MCPcopy Create free account
hub / github.com/catboost/catboost / CatBoostOutputModel_R

Function CatBoostOutputModel_R

catboost/R-package/src/catboostr.cpp:774–801  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

772}
773
774EXPORT_FUNCTION CatBoostOutputModel_R(SEXP modelParam, SEXP fileParam,
775 SEXP formatParam, SEXP exportParametersParam, SEXP poolParam) {
776 R_API_BEGIN();
777 TFullModelHandle model = static_cast<TFullModelHandle>(R_ExternalPtrAddr(modelParam));
778 THashMap<ui32, TString> catFeaturesHashToString;
779 TVector<TString> featureId;
780
781 if (poolParam != R_NilValue) {
782 TPoolHandle pool = static_cast<TPoolHandle>(R_ExternalPtrAddr(poolParam));
783 catFeaturesHashToString = MergeCatFeaturesHashToString(*pool->ObjectsData.Get());
784 featureId = pool->MetaInfo.FeaturesLayout.Get()->GetExternalFeatureIds();
785 }
786
787 EModelType modelType;
788 CB_ENSURE(TryFromString<EModelType>(CHAR(asChar(formatParam)), modelType),
789 "unsupported model type: 'cbm', 'coreml', 'cpp', 'python', 'json', 'onnx' or 'pmml' was expected");
790
791 ExportModel(*model,
792 CHAR(asChar(fileParam)),
793 modelType,
794 CHAR(asChar(exportParametersParam)),
795 false,
796 &featureId,
797 &catFeaturesHashToString
798 );
799 R_API_END();
800 return ScalarLogical(1);
801}
802
803EXPORT_FUNCTION CatBoostReadModel_R(SEXP fileParam, SEXP formatParam) {
804 SEXP result = NULL;

Callers

nothing calls this directly

Calls 3

ExportModelFunction · 0.85
GetExternalFeatureIdsMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected