예제 #1
0
파일: test.py 프로젝트: prusswan/redistrict
 def test_run_stats(self):
     state = State('RI',
                   '2015',
                   0,
                   0.5,
                   10,
                   0,
                   0.1,
                   cdist,
                   10,
                   unique_filename_for_state='RI_2017_10_07_14_17_05')
     state.run_stats()
     self.assertTrue(os.path.isfile(state.stats_filename))
     self.assertTrue(os.path.isfile(state.means_filename))
예제 #2
0
# Create the State object, we want to cluster:
###############################################################################
state = State(args.state,
              year,
              alpha=alpha,
              alpha_increment=alpha_increment,
              alpha_max=alpha_max,
              beta=beta,
              beta_increment=beta_increment,
              dist=cdist,
              max_runs=max_runs,
              unique_filename_for_state=args.filename,
              verbose=args.verbose)

###############################################################################

##########################################################################
# Weighted k-means #######################################################
##########################################################################
state.cluster()

##########################################################################
# Statistics #############################################################
##########################################################################
state.run_stats()

##########################################################################
# Plotting ###############################################################
##########################################################################
state.plot()