| 643 | |
| 644 | |
| 645 | static 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 | |
| 695 | namespace NCB { |
| 696 | namespace NPmml { |
no test coverage detected