
Discover how vector data machine learning builds models from labeled training data to classify geospatial features. Explore attributes like elevation to guide model application and discuss spatial autocorrelation.
Explore how machine learning uses training data to build predictive models and differs from statistics in drawing population inferences. Geospatial land use classification uses elevation and distance from a city.
Explore geospatial biodiversity data from Mexico, analyzing species observations and diversity across hexagonal grids and covariates. Learn modeling foundations, including linear and logistic regression, data preparation, and spatial autocorrelation considerations.
Explore qualitative and quantitative variable types, including nominal, ordinal, interval, ratio, and circular data, and learn how representation affects statistical modeling in geospatial contexts.
Explore simple linear regression by modeling a linear relationship between an explanatory variable x and a dependent response y, estimating the y-intercept and slope.
Explore simple linear regression in geospatial data science by simulating data, defining Y and X, and fitting models with statsmodels and scikit-learn, including intercept, slope, residuals, and R squared.
Explore multiple linear regression as an extension of simple regression with multiple explanatory variables to predict species from elevation, rainfall, and population density, and contrast statistical analysis with machine learning.
Explore multiple linear regression with two explanatory variables—temperature and pH—to predict growth, estimate intercepts and slopes, and assess fit via r-squared and residuals.
Analyze the five core linear regression assumptions: linear relationship, normally distributed zero-mean residuals, no multicollinearity, no autocorrelation (temporal and spatial), and constant variance. Learn practical checks, tests, and simple remedies.
Explore how variable transformations address linear regression assumptions by transforming the response or explanatory variables, using logarithmic, square root, square, power, reciprocal, and arcsine transformations, and back-transform predictions for interpretation.
Explore polynomial regression as a linear model using powers of X to capture nonlinear relationships and discuss overfitting, inflection points, and the need for domain knowledge in model selection.
Learn how overfitting arises when models include too many explanatory variables, harming generalization by fitting noise rather than the underlying process, especially with sparse data and limited degrees of freedom.
Compare many explanatory variable combinations, transformations, and interactions, then apply information criteria such as AIC or BIC to choose parsimonious models with strong generalization.
Explain how the Akaike information criterion (AIC) helps select among nested models by penalizing parameter count and comparing log-likelihood, with polynomial regression examples.
Investigate the Mexico biodiversity project dataset, measuring richness and evenness with Shannon's index and Simpson's lambda using species occurrence data across polygon scales, including 50-km hexagons.
Explore diversity indices by calculating richness and evenness, using shannon's index, simpson's index, and inverse simpson for species observations across state polygons.
Compute state-level diversity from geospatial mushroom observations by building genus-count dictionaries, then derive richness, Shannon index, Simpson's lambda, and evenness across states using flexible functions.
Explore relationships among mushroom and reptile diversity using correlation matrices, histograms, and scatterplots; assess geographic patterns in Mexico and highlight richness and Simpson's diversity as focus.
Create and join explanatory variables for Mexican municipalities, including terrain roughness, elevation, climate, ecological indexes, eco regions, and proximity to cities and protected areas, using spatial joins and representative points.
Perform exploratory data analysis to refine variables, assess correlations with a heat map, and select Simpson's lambda as the response, linking richness, Shannon's index, and elevation.
Create candidate models that map biological hypotheses onto statistical tests, using variables like plant richness, elevation range, topographic roughness, area, and ecological integrity; compare models with AC values.
Fit and compare candidate geospatial models for biodiversity, split data for training and testing, and identify the best model using variables like plant richness, elevation, and area effects.
Check linear regression assumptions for the best model by examining linearity, residuals with zero mean, normal distribution, homoscedasticity, and spatial autocorrelation in richness and Simpson's diversity index.
Evaluate regression performance using a five-step framework: split data, train on training data, predict test values, and compare with mean absolute error, root mean squared error, and coefficient of variation.
Learn how to incorporate categorical variables into linear regression with dummy variables and one-hot encoding, including drop-first, converting to numeric types, and interpreting coefficients as constants.
Explore encoding categorical variables in linear regression, using a four-technique example to create dummy variables, interpret coefficients relative to a reference category, and discuss degrees of freedom and model implications.
Split data with train_test_split, train a model on the training set, and predict on the test set. Assess performance using mean absolute error and RMSE.
Introduce dummy variables for coastal, protected areas, and ecoregions, fit linear models with a train/test split, compare implementations, and interpret coefficients while noting modest r-squared improvements.
Identify mismerged municipalities by bounding box ratio, remove problematic polygons, and create a clean data set. Compare original and clean data to assess coastal variable effects and guide regression analyses.
Explore the concept of maximum likelihood estimation, using likelihood functions to estimate beta coefficients in nonlinear models like Poisson and logistic regression, and contrast with linear regression's closed-form solution.
Scale data with standardization or normalization to align explanatory variables, applying fit and transform on training data while noting implications for models and interpretation.
Learn how Poisson regression models count data like species richness by linking a log-linear model to explanatory variables, using statsmodels and scikit-learn with dummy variables and scaling.
Compare statistical inference and machine learning approaches to model selection. Emphasize cross-validation and regularization to prevent overfitting in Poisson regression and beyond.
Explore classification in geospatial data science, including supervised methods like logistic regression and random forests, unsupervised PCA and clustering, and evaluation via confusion matrices and metrics.
Explore logistic regression for binary and multiclass outcomes. Link explanatory variables to the probability of coastal versus upland municipalities, and discuss thresholds, regularization, and maximum likelihood estimation.
Apply logistic regression with a single explanatory variable to classify municipalities as coastal or upland, and evaluate predictions with confusion matrices and probability curves.
Explore logistic regression with multiple explanatory variables, selecting predictors from box plots, coding the response, and evaluating performance with confusion matrices, precision, recall, and F1 metrics.
Explore logistic regression with multiple explanatory variables and manual cross-validation, using ten train-test splits to estimate coefficients and evaluate F1, accuracy, and confusion matrices.
Explore logistic regression with manual regularization and cross-validation, comparing regularization types and C values, scaling data, and evaluating models with classification reports and confusion matrices.
Explore logistic regression with automatic cross-validation and regularization, using cross-validation folds, EF1 scoring, and L1/L2 penalties to predict upland versus coastal municipalities.
Extend logistic regression to multiclass predictions in geospatial data science by classifying bird richness into low, medium, and high using one versus the rest with dummy variables and cross-validation.
Explore decision trees and random forests for supervised classification and regression, highlighting non parametric models, information-theoretic splits, bootstrapping, random feature subsets, feature importance, and addressing overfitting.
Explore how gini impurity and entropy guide decision trees for supervised classification and regression, from root nodes to leaves, through simple examples like coastal versus upland municipalities.
Explore how a classification decision tree uses petal length and petal width to classify iris species via Gini impurity, with pruning and random forests to reduce overfitting on test data.
Apply simple decision tree models to classify coastal municipalities using minimum elevation, compare with logistic regression, and practice pruning, visualization, and feature importances to prevent overfitting.
Explore how pruning simplifies decision trees and boosts accuracy. Apply a random forest to predict bird richness from 13 features, comparing performance to logistic regression.
Explore how decision trees and random forests apply to regression problems, compare pruning and depth controls to reduce overfitting, and evaluate models with mean absolute error and RMSE.
Explore k-nearest neighbors, a simple classification method based on feature-space similarity, using euclidean distances, data scaling, and the elbow method to tune K for optimal smoothing.
Explore how the k-nearest neighbors classifier uses feature-space similarity to categorize bird richness on a 50-km hex grid in Mexico, and compare weight schemes and variable selection.
Explore support vector machines as a classification method that finds a hyperplane to separate classes, using kernels and hyperparameters tuned by grid search for best performance.
Apply support vector machines to geospatial data analysis, tuning hyperparameters such as C, gamma, kernels, and degrees, and compare results with logistic regression.
Explore the full hyperparameter space with grid search CV (GridSearchCV) for SVMs and other models, using cross-validation and parameter grids for C, gamma, kernels, and regularization to optimize accuracy.
Explore k-means clustering as an unsupervised classification method that uses centroids and nearest-centroid assignments to form clusters, optimizing inertia with the elbow method and smarter initial centroids.
Apply k-means clustering to biodiversity data by grouping polygons based on five taxa richness using a scaled explanatory variable matrix.
In this course I demonstrate open source python packages for the analysis of vector-based geospatial data. I use Jupyter Notebooks as an interactive Python environment. GeoPandas is used for reading and storing geospatial data, exploratory data analysis, preparing data for use in statistical models (feature engineering, dealing with outlier and missing data, etc.), and simple plotting. Statsmodels is used for statistical inference as it provides more detail on the explanatory power of individual explanatory variables and a framework for model selection. Scikit-learn is used for machine learning applications as it includes many advanced machine learning algorithms, as well as tools for cross-validation, regularization, assessing model performance, and more.
This is a project-based course. I use real data related to biodiversity in Mexico and walk through the entire process, from both a statistical inference and machine learning perspective. I use linear regression as the basis for developing conceptual understanding of the methodology and then also discuss Poisson Regression, Logistic Regression, Decision trees, Random Forests, K-NN classification, and unsupervised classification methods such as PCA and K-means clustering.
Throughout the course, the focus is on geospatial data and special considerations for spatial data such as spatial joins, map plotting, and dealing with spatial autocorrelation.
Important concepts including model selection, maximum likelihood estimation, differences between statistical inference and machine learning and more are explained conceptually in a manner intended for geospatial professionals rather than statisticians.