## 2 Materials and Methods
### The Toolbox Design Procedure  
We synthetized GIS spatial statistics, data processing, and machine learning language in the specific education case in the U.S. The toolbox was designed into four component modules using a mixed method.  
Module 1--the Join and Summarize tool  
Figure 3: Chart showing the general flow of data and tools in the toolbox.  
Figure 2: Public school districts student distribution in the U.S.  
It processes and organizes the raw CCD data, then joins it to TIGER/Line shapefile geometry at the state and county scales, and finally calculates a pupil-teacher ratio for each state or county. These feature class outputs can then be used as inputs for the OLS/GWR tool. The Python pseudocodes are as follows:  
_Define parameters and standardized variables_  
_Table To Geodatabase (CCD table to local geodatabase)_  
_Define fields for summing aggregated data_  
_Statistics (State and County tables derived from district CCD data)_  
_AddField (Student Teacher Ratio in State and County Tables)_  
_Calculate Field (Student Teacher Ratio from Sum_Student and Sum_Teacher at State and County Levels)_  
_Feature Class To Feature Class (geometry shapefiles to geodatabase)_  
_Add Fields (Adjust joining fields-define specific field types)_  
_Join (CCD State and County Tables to geometry feature classes_  
Module 2--the spatial OLS tool  
We generated the spatial weight matrix and measured spatial autocorrelation to predict the tendency of the pupil-teacher ratio. In regression analysis, OLS is a traditional method for estimating a linear regression between dependent variables and independent variables [34]. Simple OLS is the estimation of a linear relationship between two variables. Our version of the OLS tool adds the spatial weighted matrix and spatial autocorrelation into one process. By the interactive window, the user defines seven parameters involving input feature class, output feature class, unique ID, independent variables, a dependent variable, a model regression result table, and a description result table. The Python pseudocodes include:  
_Ordinary Least Squares_stats (Cleaned CCD data table)_  
_Geographically Weighted Regression_stats (Cleaned CCD data table)_  
_Spatial Weight Matrix (Cleaned CCD data table)_  
_Autocorrelation Function (OLS Function out table)_  
Module 3--the sensitive analysis tool  
We utilized the seaborn package to create a 2-dimensional representation of the various relationships of data at each scale. The input for this requires an additional step between the Join and Summarize tool and processing. All non-numeric variable fields must be removed before the table can be used as an input for the heat map tool. The Python pseudocodes are as follows:  
_Define parameters as text_  
_Create pandas data frame as cursor_  
_Define seaborn heatmap output visual characteristics_  
_Define input as cursor_  
_Save heatmap output_  
Module 4--the random forest modelling tool  
We incorporated random forest classifier, decision tree classifier, the permutation importance package, and random forest regressor of scikit-learn machine learning in Python. Base on permutation feature importance in scikit-learn [35], the Python pseudocodes are as follows:  
_Define parameters as text_  
_Run Random Forest Classifier_  
_Run Decision Tree Classifier_  
_Run train_test_split_  
_Run permutation_importance_  
_Run Random Forest Regressor_  
Take parameters as inputs in Figure 4.