<s> """<STR_LIT>""" <EOL> import pyproct . driver . scheduling . tools as scheduling_tools <EOL> from pyproct . clustering . selection . bestClusteringSelector import BestClusteringSelector <EOL> from pyproct . driver . observer . observable import Observable <EOL> from pyproct . clustering . protocol . exploration . clusteringExplorer import ClusteringExplorer <EOL> from pyproct . clustering . protocol . exploration . algorithmRunParametersGenerator import AlgorithmRunParametersGenerator <EOL> from pyproct . clustering . filtering . clusteringFilter import ClusteringFilter <EOL> from pyproct . clustering . evaluation . analysis . analysisRunner import AnalysisRunner <EOL> from pyproct . clustering . evaluation . analysis . analysisPopulator import AnalysisPopulator <EOL> class ClusteringProtocol ( Observable ) : <EOL> def __init__ ( self , timer , observer ) : <EOL> super ( ClusteringProtocol , self ) . __init__ ( observer ) <EOL> self . timer = timer <EOL> def run ( self , clustering_parameters , matrix_handler , data_handler , workspaceHandler ) : <EOL> self . notify ( "<STR_LIT>" , [ ] ) <EOL> self . timer . start ( "<STR_LIT>" ) <EOL> clusterings = ClusteringExplorer ( clustering_parameters , <EOL> matrix_handler , <EOL> workspaceHandler , <EOL> scheduling_tools . build_scheduler ( clustering_parameters [ "<STR_LIT>" ] [ "<STR_LIT>" ] , <EOL> self . observer ) , <EOL> AlgorithmRunParametersGenerator ( clustering_parameters , <EOL> matrix_handler ) , <EOL> self . observer ) . run ( ) <EOL> self . notify ( "<STR_LIT>" , { "<STR_LIT>" : len ( clusterings ) } ) <EOL> self . timer . stop ( "<STR_LIT>" ) <EOL> self . timer . start ( "<STR_LIT>" ) <EOL> selected_clusterings , not_selected_clusterings = ClusteringFilter ( clustering_parameters [ "<STR_LIT>" ] [ "<STR_LIT>" ] , <EOL> matrix_handler ) . filter ( clusterings ) <EOL> self . notify ( "<STR_LIT>" , { "<STR_LIT>" : len ( selected_clusterings . keys ( ) ) , "<STR_LIT>" : len ( not_selected_clusterings . keys ( ) ) } ) <EOL> self . timer . stop ( "<STR_LIT>" ) <EOL> if selected_clusterings == { } : <EOL> return None <EOL> self . timer . start ( "<STR_LIT>" ) <EOL> analyzer = AnalysisRunner ( scheduling_tools . build_scheduler ( <EOL> clustering_parameters [ "<STR_LIT>" ] [ "<STR_LIT>" ] , <EOL> self . observer ) , <EOL> selected_clusterings , <EOL> AnalysisPopulator ( matrix_handler , <EOL> data_handler , <EOL> clustering_parameters ) ) <EOL> analyzer . evaluate ( ) <EOL> self . timer . stop ( "<STR_LIT>" ) <EOL> self . timer . start ( "<STR_LIT>" ) <EOL> best_clustering_id , all_scores = BestClusteringSelector ( clustering_parameters ) . choose_best ( selected_clusterings ) <EOL> self . timer . stop ( "<STR_LIT>" ) <EOL> return best_clustering_id , selected_clusterings , not_selected_clusterings , all_scores </s>
