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

Function OutputMiningModel

catboost/libs/model/model_export/pmml_helpers.cpp:645–693  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

643
644
645static void OutputMiningModel(
646 const TFullModel& model,
647 bool isClassification,
648 const THashMap<ui32, TString>* catFeaturesHashToString,
649 TXmlOutputContext* xmlOut) {
650
651 TOneHotValuesToIdx oneHotValuesToIdx;
652 if (isClassification) {
653 TXmlElementOutputContext miningModel(xmlOut, "MiningModel");
654 xmlOut->AddAttr("functionName", "classification");
655
656 OutputMiningSchemaWithModelFeatures(model, /*mappedCategoricalFeatures*/ false, "prediction", xmlOut);
657
658 if (model.ModelTrees->GetOneHotFeatures().size()) {
659 OutputCategoricalMapping(model, *catFeaturesHashToString, &oneHotValuesToIdx, xmlOut);
660 }
661
662 {
663 TXmlElementOutputContext segmentation(xmlOut, "Segmentation");
664 xmlOut->AddAttr("multipleModelMethod", "modelChain");
665
666 {
667 TXmlElementOutputContext segment(xmlOut, "Segment");
668 xmlOut->AddAttr("id", "treeEnsemble");
669
670 // predicate
671 {
672 TXmlElementOutputContext predicate(xmlOut, "True");
673 }
674
675 OutputTreeEnsemble(model, "approx", /*isChainPart*/ true, catFeaturesHashToString, &oneHotValuesToIdx, xmlOut);
676 }
677 {
678 TXmlElementOutputContext segment(xmlOut, "Segment");
679 xmlOut->AddAttr("id", "classifier");
680
681 // predicate
682 {
683 TXmlElementOutputContext predicate(xmlOut, "True");
684 }
685
686 OutputClassFromApprox(xmlOut);
687 }
688 }
689 OutputTargetsFields(model, xmlOut);
690 } else {
691 OutputTreeEnsemble(model, "prediction", /*isChainPart*/ false, catFeaturesHashToString, &oneHotValuesToIdx, xmlOut);
692 }
693}
694
695namespace NCB {
696 namespace NPmml {

Callers 1

OutputModelFunction · 0.85

Calls 7

OutputCategoricalMappingFunction · 0.85
OutputTreeEnsembleFunction · 0.85
OutputClassFromApproxFunction · 0.85
OutputTargetsFieldsFunction · 0.85
sizeMethod · 0.45
GetOneHotFeaturesMethod · 0.45

Tested by

no test coverage detected