예제 #1
0
파일: test.py 프로젝트: prusswan/redistrict
 def test_cluster(self):
     # Below are known values for Alabama which allow convergence:
     state = State('AL', '2015', 2, 0.5, 30, 0.5, 0.1, cdist, 200)
     state.cluster()
     self.assertTrue(os.path.isfile(state.clustered_geojson_filename))
     self.assertTrue(os.path.isfile(state.clustered_csv_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()