#NEWLINE# def segmentation( self ) : #NEWLINE# #INDENT# '\n        Build a segmentation (sequence of estimators)\n        :return: Segmentation element\n        ' #NEWLINE# segmentation = pmml . Segmentation ( multipleModelMethod = 'weightedAverage' ) #NEWLINE# regression_context = TransformationContext ( schemas = dict ( self . context . schemas ) ) #NEWLINE# regression_context . schemas [ Schema . OUTPUT ] = [ RealNumericFeature ( name = self . context . schemas [ Schema . OUTPUT ] [ 0 ] . name , namespace = Schema . NUMERIC . namespace ) ] #NEWLINE# init_segment = pmml . Segment ( weight = 1 ) #NEWLINE# init_segment . append ( pmml . True_ ( ) ) #NEWLINE# init_segment . append ( find_converter ( self . estimator . init_ ) ( self . estimator . init_ , regression_context ) . model ( ) ) #NEWLINE# segmentation . append ( init_segment ) #NEWLINE# for est in self . estimator . estimators_ [ : , 0 ] : #NEWLINE# #INDENT# s = pmml . Segment ( weight = self . estimator . learning_rate ) #NEWLINE# s . append ( pmml . True_ ( ) ) #NEWLINE# s . append ( DecisionTreeConverter ( est , regression_context , ModelMode . REGRESSION ) . _model ( ) ) #NEWLINE# segmentation . append ( s ) #NEWLINE# #UNINDENT# return segmentation