def mining_Field_For_First_Segment(feature_names): """ It returns the Mining Schema of the First Segment. Parameters ---------- feature_names: List Contains list of feature/column names. Returns: ------- mining_schema_for_1st_segment: Returns the MiningSchema for the main segment. """ mining_fields_1st_segment = [] for name in feature_names: mining_fields_1st_segment.append(pml.MiningField(name=name)) mining_schema_for_1st_segment = pml.MiningSchema(MiningField=mining_fields_1st_segment) return mining_schema_for_1st_segment
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 a list of well structured node for binary classification/inner segments for multi-class classification 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_()) m_flds = [] mining_field_for_innner_segments = col_names 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="regression", modelName="DecisionTreeModel", missingValueStrategy="none", noTrueChildStrategy="returnLastPrediction", splitCharacteristic="multiSplit", Node=main_node, MiningSchema=pml.MiningSchema( MiningField=m_flds))))) return segments_equal_to_estimators