#NEWLINE# def show_network_options( network , highlight_options = None ) : #NEWLINE# #INDENT# ' Display all available parameters options for Neural Network.\n\n    Parameters\n    ----------\n    network : object\n        Neural network instance.\n    highlight_options : list\n        List of enabled options. In that case all options from that\n        list would be marked with a green color.\n    ' #NEWLINE# available_classes = [ network . __name__ for cls in network . __class__ . __mro__ ] #NEWLINE# logs = network . logs #NEWLINE# if ( highlight_options is None ) : #NEWLINE# #INDENT# highlight_options = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# def group_by_class_name( value ) : #NEWLINE# #INDENT# ( _ , option ) = value #NEWLINE# option_priority = ( - available_classes . index ( option . class_name ) ) #NEWLINE# return ( option_priority , option . class_name ) #NEWLINE# #UNINDENT# grouped_options = groupby ( sorted ( network . options . items ( ) , key = group_by_class_name ) , group_by_class_name ) #NEWLINE# logs . title ( 'Main information' ) #NEWLINE# logs . message ( 'ALGORITHM' , network . class_name ( ) ) #NEWLINE# logs . newline ( ) #NEWLINE# for ( ( _ , class_name ) , options ) in grouped_options : #NEWLINE# #INDENT# if ( not options ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# logs . write ( '{}:' . format ( class_name ) ) #NEWLINE# for ( key , data ) in sorted ( options ) : #NEWLINE# #INDENT# if ( key in highlight_options ) : #NEWLINE# #INDENT# msg_color = 'green' #NEWLINE# value = highlight_options [ key ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# msg_color = 'gray' #NEWLINE# value = data . value #NEWLINE# #UNINDENT# formated_value = preformat_value ( value ) #NEWLINE# msg_text = '{} = {}' . format ( key , formated_value ) #NEWLINE# logs . message ( 'OPTION' , msg_text , color = msg_color ) #NEWLINE# #UNINDENT# logs . write ( '' )