Beispiel #1
0
 def _nyoka_mining_schema(
         self,
         mining_schema: models.MiningSchema) -> nyoka_pmml.MiningSchema:
     return nyoka_pmml.MiningSchema(MiningField=[
         nyoka_pmml.MiningField(name=f.name, usageType=f.usageType.name)
         for f in mining_schema.miningFields
     ])
Beispiel #2
0
def generate_Segments_Equal_To_Estimators(val, derived_col_names, col_names):
    """
    It returns number of Segments equal to the estimator of the model.

    Parameters
    ----------
    val : List
        Contains nodes in json format.
    derived_col_names : List
        Contains column names after preprocessing.
    col_names : List
        Contains list of feature/column names.
    Returns
    -------
    segments_equal_to_estimators :
         Returns list of segments equal to number of estimator of the model
    """
    segments_equal_to_estimators = []
    for i in range(len(val)):
        main_node = pml.Node(True_=pml.True_())
        mining_field_for_innner_segments = col_names
        m_flds = []
        create_node(val[i], main_node, derived_col_names)
        for name in mining_field_for_innner_segments:
            m_flds.append(pml.MiningField(name=name))

        segments_equal_to_estimators.append((pml.Segment(
            id=i + 1,
            True_=pml.True_(),
            TreeModel=pml.TreeModel(
                functionName=MINING_FUNCTION.REGRESSION,
                modelName="DecisionTreeModel",
                missingValueStrategy="none",
                noTrueChildStrategy="returnLastPrediction",
                splitCharacteristic=TREE_SPLIT_CHARACTERISTIC.MULTI,
                Node=main_node,
                MiningSchema=pml.MiningSchema(MiningField=m_flds)))))

    return segments_equal_to_estimators