Affective Spatial Computing

A Machine Learning Framework for Geo-Emotional Intelligence in Urban Infrastructure Planning

15riders in the analytic cohort
136verified, GPS-linked diary logs
1,115in-city bicycle crash reports, 2021 to Sept 2026
120/127reproducibility checks matching
The question

Cities know where people cycle. Do they know how it feels?

Planning relies on traffic counts, facility maps, and crash records. Those show where people ride and where they get hurt. They do not show where riders feel stressed, where they feel safe, or which streets they quietly avoid. This research tests whether short, validated emotion surveys taken at the places people ride can add that missing layer to infrastructure decisions in Baltimore.

From a ride to a map
  1. RecordA 20-item PANAS survey with GPS, on the rider's phone.
  2. ScreenOrdered quality rules remove test and spoofed entries.
  3. MeasurePositive and negative affect, scored 10 to 50 each.
  4. ClusterK-Means finds places with a shared emotional signature.
  5. ModelRandom Forest tests which features carry signal.
  6. CompareFelt distress set beside Maryland crash records.
Manuscript

The dissertation

Six chapters and five research questions.

Design

Methods and models

Measurement, screening, clustering, Random Forest, interpolation, crash data.

Evidence

Results

What the evidence shows, and where it stops.

Computation

Analysis notebooks

Ten Jupyter notebooks that rebuild every reported figure and audit it against the manuscript.

Interactive research

Jupyter Research Laboratory

Read all ten notebooks, explore synthetic AI/ML models, and inspect reproducibility exceptions.

Build

Research software

The mobile PANAS-GPS diary app designed and built for the study.

How this site is designed

Built on the same principles as the research

Evidence before claims

Every figure carries its sample size and its limits. Weak results, like the held-out model scores, are shown rather than hidden.

Privacy by design

No coordinates, routes, or diary text appear anywhere. The hero field is generated art, not participant data.

Progressive disclosure

Plain-language summaries come first. Formulas, model settings, and code sit one click deeper for technical readers.

Live progress

Where the dissertation stands

Updated

Milestones

    Chapters

    Reproducibility audit

    Every number in the manuscript is checked against a fresh run of the analysis notebooks. A check passes when the rerun reproduces the reported value.

    The remaining checks are being reconciled against a full-precision rerun of the analysis.

    The manuscript

    The dissertation

    Six chapters, five research questions, and one framework for bringing riders' validated emotional experience into transportation evidence.

    01

    Introduction

    The planning gap in Baltimore, the limits of crowdsourced cycling data, the research objectives and questions, and the Affective Spatial Computing (ASC) framework that draws on six research traditions.

    • Problem statement
    • Research objectives
    • Research questions
    • Theoretical framework
    • Significance
    • Assumptions and limitations
    • Definition of terms
    • Contributions
    02

    Literature Review

    Urban mobility paradigms, the foundations of affective spatial computing, traditional and computational planning methods, participatory design, data integrity, and transportation equity.

    • Urban mobility paradigms
    • Affective spatial computing
    • Traditional and computational methods
    • UX and participatory methods
    • Data quality and integrity
    • Transportation equity
    • Research gaps
    03

    Research Methodology

    A convergent mixed-methods design: a participant-initiated diary study, community-embedded recruitment, the PANAS-GPS instrument, an ordered data-integrity screen, the machine learning pipeline, qualitative diary analysis, and human-subjects protections.

    • Research design
    • Recruitment
    • Data collection
    • Quantitative pipeline
    • Qualitative analysis
    • Mixed-methods integration
    • Ethics
    • Data security
    04

    Results

    The screened cohort, PANAS reliability, affect by infrastructure and trip purpose, geo-emotional clusters, feature importance, the interpolated affect surface, diary themes, and integrated findings for each research question.

    • Cohort
    • Affect reliability
    • Clustering
    • Crash comparison
    • Feature importance
    • Affect surface
    • Diary themes
    • Integration
    05

    Discussion

    What the emotional geography of the network means, how emotion-informed evidence relates to crash-based priorities, who community recruitment reached and who it did not retain, and data integrity as a finding in its own right.

    • Emotional geography
    • Emotion vs. conventional evidence
    • Representation and retention
    • Computation and community
    • Data integrity as a finding
    • Visualization
    • Limitations
    06

    Conclusions, Recommendations, and Future Research

    The study's contributions, design requirements for larger ASC studies, recommendations for data integrity in participatory digital research, and implications for Baltimore and for planning methodology.

    • Contributions
    • Design requirements
    • Data integrity recommendations
    • Implications for Baltimore
    • Planning methodology

    Five research questions

    RQQuestionPrimary evidence
    RQ1Do GPS-linked emotion reports form coherent spatial patterns that flag places for attention?K-Means clusters, location and corridor comparison
    RQ2How do emotion-informed priorities compare with conventional safety evidence?Random Forest feature importance, crash rates
    RQ3What does combining scores with riders' own words reveal?Narrative coding and triangulation
    RQ4Who does community-embedded recruitment reach, and who stays?Cohort composition, retention, diary content
    RQ5Can the results be shown to planners and residents clearly and honestly?Masked affect surface, interactive map
    Research design

    Methods and models

    A convergent mixed-methods study. Riders' validated emotion scores and their written notes are analyzed side by side, then compared with conventional transportation safety data.

    Instrument

    PANAS with GPS

    The Positive and Negative Affect Schedule has 20 items: ten positive, ten negative, each side scored 10 to 50. Riders took it on their phone during or right after a ride, and the app recorded location, infrastructure type, trip purpose, and an optional note.

    Recruitment

    Community-embedded

    Riders were recruited through Baltimore cycling communities, including Bike Social Baltimore and Baltimore Bike Party, with in-person outreach. Data were collected from March 1 to August 1, 2026.

    Screening

    Data integrity first

    Nine ordered rules took 1,526 raw submissions to 136 verified records. Most removals carried synthetic location signatures rather than real device GPS.

    What each model answers

    AI in ASC

    What the project uses

    Conventional machine learning: K-Means clustering, Random Forest regression, and K-nearest-neighbor interpolation, built in scikit-learn. These turn validated, self-reported emotion into spatial patterns that planners can examine.

    Boundaries

    What it does not claim

    No neural network or large language model produces any finding. Model outputs are exploratory evidence for people to weigh. They are not causal estimates and they do not make planning decisions.

    Technical specification

    ElementSpecification
    PANAS scoringPA = sum of 10 positive items; NA = sum of 10 negative items; each 10–50. Net affect (PA − NA) used only for ordering, never in place of the two scales.
    ReliabilityCronbach's α = k/(k − 1) × (1 − Σ item variances / total variance). PANAS reference and Notebook 04 →
    K-MeansStandardized PA, NA, latitude, longitude; k chosen by silhouette and 20-seed adjusted Rand stability
    Random ForestSeparate PA and NA models; 50 predictors; GroupShuffleSplit and GroupKFold so no rider appears in both training and test data. Breiman (2001), Notebook 06 →
    KNN surfacek = 5, inverse-distance weights, haversine distance; 50 m analysis grid masked beyond 250 m of any log
    Crash dataMaryland State Police ACRS reports; bicyclist and other pedalcyclist only; matched to public streets within 30 m and bike facilities within 20 m
    Corridor rateCrashes ÷ (corridor miles × years). A length and time rate, not a cyclist-exposure rate.
    EnvironmentPython 3.13 · pandas 3.0 · NumPy 2.5 · GeoPandas 1.2 · scikit-learn 1.9 · SciPy 1.18 · Folium 0.20 · matplotlib 3.11 · seed 42
    Findings

    Results

    Reported outputs from the October 28 analysis; seven manuscript discrepancies remain open. See the verification audit →

    A proof-of-concept study with 15 riders. Every finding is descriptive and preliminary, and is shown with the limits that come with it.

    Raw submissions to analytic records

    records
    Raw submissions1,526
    Inside window1,480
    Verified136
    Inside city123

    1,265 submissions carried a GPS accuracy of exactly 1.0 or 150.0 m, a signature of non-device location data, and were removed.

    Mean affect

    PANAS, 10–50
    Positive40.6
    Negative17.7

    Reliability was high (α = .93 positive, .92 negative). The two scales were uncorrelated (r = −.04), so a ride can be both enjoyable and stressful. 21 logs showed exactly that mix.

    How riders felt, by infrastructure

    Net affect is positive minus negative. Bars are colored on the same calm-to-distress scale as the rest of the site.

    Net affect, all 136 records

    DISTRESSCALM

    Separated and low-traffic settings ranked above shared-traffic settings in every sensitivity check: with the heaviest contributor removed, and with each rider weighted equally. Several categories rest on very few records.

    Findings by research question

    RQFinding
    RQ1Emotion reports formed spatially and emotionally coherent clusters. The one high-distress zone, in southwest Baltimore, rests mostly on two riders (about 94% of its logs), so it is a candidate for closer attention, not a citywide ranking.
    RQ2Location was the strongest and most stable feature, and hour of day the strongest non-spatial one. The models did not predict well for riders they had not seen (held-out R² near or below zero), which is expected with 15 riders and is reported as a finding.
    RQ3Of 75 substantive notes, 42 agreed with the scores, 21 diverged, and 11 were neutral. Many riders documented hazards in a calm, observational voice, so the notes flagged hazards the scores alone would miss. Notes also explained why built lanes varied so widely: obstruction, not design.
    RQ4Riders of color were 33% of participants and 49% of records; women were 33% of participants; 73% were 35 or older. That differs from the younger, male, mostly White profile of platform cycling data. Less confident riders enrolled but did not stay long enough to be included, the study's central design lesson.
    RQ5The pipeline produced an interpolated affect surface covering only the 4.6% of the city near observed logs, plus an interactive map. Showing coverage limits on the map itself communicated both the findings and their boundaries.
    Crash records

    1,115 reports, 2021–2026

    A primary window of 878 reports from 2021 to 2025. Corridor rates divide crashes by miles and years. Baltimore has no citywide count of riders per street, so rates show where crashes concentrate, not risk per ride.

    Limit

    Small, nonrandom sample

    Fifteen riders cannot represent Baltimore. The study shows the approach works; it does not produce citywide estimates.

    Limit

    Uneven contribution

    Two riders supplied 37% of records. Each spatial pattern is reported with how much of it comes from those two.

    Limit

    Association, not cause

    A street linked with distress is a place to look closer. The design cannot show that the street caused the feeling.

    Computational record

    Analysis notebooks

    Ten Jupyter notebooks run in order, from crash data through screening, measurement, modeling, and mapping, ending with an audit that checks every reported number. Excerpts show method, not data.

    00

    setup_check

    Lists package versions and confirms which inputs are available, so each later notebook records whether it ran on raw sources or stored reference tables.

    import platform, sklearn, geopandas, scipy, folium, matplotlib
    versions = pd.DataFrame({
        "package": ["Python", "pandas", "NumPy", "GeoPandas", "scikit-learn", "SciPy", "Folium", "matplotlib"],
        "version": [platform.python_version(), pd.__version__, np.__version__, geopandas.__version__,
                    sklearn.__version__, scipy.__version__, folium.__version__, matplotlib.__version__]})
    01

    crash_data

    Builds the bicycle crash table from Maryland State Police ACRS exports. Report and non-motorist files join on report number. Only bicyclists and other pedalcyclists count.

    monthly = in_city.set_index("date").resample("MS").size()
    fig, ax = plt.subplots(figsize=(9, 3))
    ax.plot(monthly.index, monthly.values)
    ax.axvspan(pd.Timestamp("2024-01-01"), pd.Timestamp("2024-04-30"),
               label="ACRS 2.0 transition (excluded in the sensitivity run)")
    02

    crash_corridors

    Matches each crash to the street network and bike facility inventory, then ranks corridors by crashes per mile per year. Public streets only (1,615 miles); nearest street within 30 m; nearest facility within 20 m, counted only if installed by the crash year. Corridors under one mile are left out. A corridor is elevated at or above the 75th percentile.

    03

    screening_gate

    Applies the nine ordered integrity rules that take 1,526 raw submissions to the 136-record analytic cohort. Contact details are dropped before anything is saved.

    acc = resp.location_accuracy
    pd.Series({"Exactly 1.0 m":      (acc == 1.0).sum(),
               "Exactly 150.0 m":    (acc == 150.0).sum(),
               "Other whole number": (panas.is_integer_accuracy(acc) & ~panas.is_signature(acc)).sum(),
               "Fractional":         (~panas.is_integer_accuracy(acc) & acc.notna()).sum()})
    04

    affect_descriptives

    PANAS scoring, Cronbach's alpha, score distributions, and contribution sensitivity checks. None of these use coordinates.

    a_pa = panas.cronbach_alpha(df[C.PA_ITEMS])
    a_na = panas.cronbach_alpha(df[C.NA_ITEMS])
    r = df.pa_score.corr(df.na_score)
    mixed = ((df.pa_score >= 40) & (df.na_score >= 25)).sum()
    05

    kmeans_clustering

    K-Means on four standardized features for in-city records. Standardizing puts one standard deviation of latitude on the same footing as one standard deviation of negative affect, so clusters group logs similar in both place and feeling.

    X = StandardScaler().fit_transform(spatial[["pa_score", "na_score", "lat", "lng"]])
    km = KMeans(n_clusters=5, init="k-means++", n_init=10, random_state=SEED).fit(X)
    silhouette_score(X, km.labels_)
    06

    random_forest

    Two models, one for positive and one for negative affect. No rider appears in both training and test data. With 15 riders the question is not whether the model predicts well, but which features carry signal and whether that signal is about place or about who rode.

    results = [models.random_forest(df, target, X) for target in ["pa_score", "na_score"]]
    table_4_9 = models.performance_table(results)
    07

    knn_surface_map

    KNN interpolation (k = 5, inverse distance, haversine) on a 50 m grid of 390 × 314 points, masked beyond 250 m from any log. Color reflects feeling, not how many logs fell in a place. scikit-learn's haversine distance takes [lat, lng] in radians; multiplying by Earth's radius (6,371 km) gives meters.

    08

    location_crash_comparison

    For each in-city diary log, counts bicycle crashes within 100, 150, and 250 m, then asks whether the most distressing logs sit where crashes cluster. Spearman correlations run pooled and within each rider with six or more logs.

    for rad in C.LOCATION_RADII_M:
        r = locations.compare(spatial, streets, radius=rad)
        rows.append({"radius_m": rad, "spearman_pooled": round(r["spearman_pooled"], 2)})
    09

    reproducibility_summary

    Collects every check written by notebooks 01 to 08 into one table: the reproduced value, the dissertation value, and whether they match. This is the source of the audit count on the Progress page.

    Computational scholarship

    Jupyter Research Laboratory

    Browse the original Markdown and source-code cells from all ten notebooks. This public read-only edition removes saved execution outputs and locally identifying paths. Code is displayed for inspection, not executed in your browser.

    Research integrity: Python code shown below comes from the uploaded notebooks; some file paths and endpoint values are redacted. The diagrams below use synthetic data and are not outputs from the dissertation cohort. Confidential GPS, diary narratives, participant-level exports and stored notebook outputs are not published.
    Source archive

    Explore the ten notebooks

    Explorable algorithms

    Machine learning demonstrations

    Illustrative simulations using generated observations. Change the controls to examine how model settings influence the outcome. No study dataset is loaded or reconstructed.

    K-Means: spatial–affective clustering

    Synthetic two-feature observations, assigned to nearest learned centroids. Colors show computed cluster membership.

    Random Forest: feature importance

    Synthetic model illustration showing how different feature patterns affect an illustrative importance ranking. Not fitted to study records.

    For actual study feature importance and weak held-out generalization, see Results and Notebook 06.

    KNN: distance-weighted affect surface

    A synthetic distress field interpolated from generated points, with a coverage mask that hides distant areas.

    The study's private computation used a 50 m working grid; public figures require approved generalization and suppression.

    Audit trail

    Dissertation–notebook reconciliation

    The October 28, 2026 end-of-testing report lists 120 matching figures out of 127, with seven exceptions. These are reported as unresolved; the website does not replace them with guessed values.

    Source: End-of-Testing Analysis, p. 1, notebooks 00–09. These reported checks have not been independently rerun in this website build.

    Academic foundation

    Selected APA references and source links

    Key methodological citations used in the dissertation. Verify the final author, year, journal, and DOI entries against the submitted APA manuscript before public release.

    1. Watson, D., Clark, L. A., & Tellegen, A. (1988). Development and validation of brief measures of positive and negative affect: The PANAS scales. Journal of Personality and Social Psychology, 54(6), 1063–1070. DOI. [PANAS; Chapter 3, Notebook 04]
    2. Breiman, L. (2001). Random forests. Machine Learning, 45, 5–32. DOI. [Random Forest; Notebook 06]
    3. Pedregosa, F., et al. (2011). Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12, 2825–2830. Publication. [Computational implementation; Chapters 3–4]
    4. Hubert, L., & Arabie, P. (1985). Comparing partitions. Journal of Classification, 2, 193–218. DOI. [Adjusted Rand index; Notebook 05]
    5. Maryland State Police. (2021–2026). Automated Crash Reporting System (ACRS) datasets. [Crash source; Notebooks 01, 02, 08. Consult manuscript for exact dataset and retrieval citations.]
    Designed and built

    Research software

    The study's data came from a purpose-built mobile app, designed and developed as part of the dissertation.

    Explore the original study app — interactive walkthrough

    Follow the historical participant experience from consent and enrollment through 20 PANAS ratings, trip context, simulated GPS capture, and submission. Offline demonstration: no database, account, location access, or data collection.

    Launch the interactive app demo →
    Baltimore Cycling Study

    PANAS-GPS diary app

    A mobile-first web app covering consent, enrollment, the 20-item PANAS, trip and infrastructure questions, automatic GPS capture with accuracy reporting, and accessibility controls. Built with HTML, CSS, and JavaScript, Leaflet, and a Postgres backend.

    Design decision

    Built for integrity

    Recording device GPS accuracy with every entry is what made the data-integrity screen possible. That interface-level choice became one of the study's methodological contributions.

    The live study app is not linked here. Data collection has closed, and the study system is kept separate from public pages.
    Human subjects

    Ethics and privacy

    The study ran under an approved University of Baltimore human-subjects protocol, with informed consent and a data security plan.

    What this site shows

    Aggregate statistics, method descriptions, and code excerpts. Places are described by neighborhood, not by coordinate.

    What stays private

    GPS traces, individual diary entries and notes, contact and enrollment records, and notebook outputs. None of it is published here.

    Maps

    Any public map follows the study's dissemination rules: neighborhood-level aggregation, heatmap cells of at least 200 m, and no individual points.

    AI-assisted analysis

    An AI tool proposed candidate codes for pseudonymized diary notes and helped check pipeline code. The researcher reviewed every code, and no finding was generated by AI. Participants were told about this use in the consent materials.

    Rounding or blurring coordinates does not by itself guarantee anonymity. Small groups and repeated locations can identify people, so this site publishes no location-level participant data.
    Presentation

    Defense overview

    The argument in thirteen slides. Use the controls or the arrow keys.

    01

    Affective Spatial Computing

    A Machine Learning Framework for Geo-Emotional Intelligence in Urban Infrastructure Planning. David Sebastian Dhanesar, University of Baltimore.

    02 · The gap

    Planning measures use and harm

    Counts and crash records show where people ride and where they get hurt. Nothing routinely records how the network feels to the people using it.

    03 · Purpose

    Build and test a pipeline

    Join validated emotion measurement to location, and set it beside conventional transportation evidence.

    04 · Questions

    Five research questions

    Spatial priorities · comparison with crash evidence · mixed-methods integration · representation · communicating results.

    05 · Framework

    The ASC framework

    Rider diary + validated PANAS + GPS + integrity screening + machine learning + spatial interpretation.

    06 · Instrument

    Building the research app

    A mobile-first PANAS-GPS app handled consent, diary entries, context questions, and GPS accuracy capture.

    07 · Cohort

    1,526 → 136

    Ordered integrity screening kept 136 verified logs from 15 riders.

    08 · Measurement

    Emotion has two dimensions

    Positive affect 40.6, negative affect 17.7, α = .93 / .92. Enjoyment and stress can occur on the same ride.

    09 · Models

    Place carries the signal

    Clusters grouped shared place and feeling. Location led feature importance; prediction for unseen riders was weak, as expected at this scale.

    10 · Evidence

    Felt distress beside crash records

    A masked affect surface and corridor crash rates, compared at the level the data can support.

    11 · Limits

    What the study cannot say

    Small sample, uneven contribution, observational design, limited spatial coverage.

    12 · Contribution

    A transparent, reproducible pipeline

    From validated emotion measurement to spatial computation, research software, and responsible planning interpretation.

    13

    Discussion

    Questions and future research.

    1 / 13
    About the principal investigator

    About the Researcher

    David Sebastian Dhanesar · Doctoral Researcher · Information & Interaction Design · University of Baltimore

    Research focus

    Human experience as planning evidence

    Dhanesar's Affective Spatial Computing (ASC) research brings together interaction design, applied machine learning, GIS, psychometrics and community-engaged cycling research. The Baltimore proof-of-concept asks how planners can account for how infrastructure feels, alongside conventional safety and use measures.

    The work is grounded in local cycling participation, systems engineering, public-sector technology and the practical design of accessible digital research tools. ASC is presented as a methodological integration rather than a new scientific discipline.

    Research roles

    Principal investigator

    University of Baltimore doctoral research, with faculty sponsor Greg Walsh. Community engagement includes ride leadership and co-founding Bike Social Baltimore.

    Research ethics

    IRB oversight

    University of Baltimore IRB Protocol #670 received expedited, minimal-risk approval on February 23, 2026. An administrative amendment was approved May 14, 2026. The documented protocol expiration date is February 23, 2029.

    Approval of human-subjects research does not mean the university endorses this independent website, its analytical claims, or any future public dataset.

    Research ethics education

    CITI human-subjects training

    Completed December 18, 2025: Human Subjects Research (HSR), Group 1: Student Researchers; and HSR, Revised Common Rule. Both certificates list an expiration date of December 18, 2028.

    Administrative certificates and full protocol records are retained as researcher documentation rather than mirrored publicly.

    Research ecosystem

    Related work

    ASC is the principal scholarly project presented here. Other projects remain accessible but deliberately secondary to the dissertation.

    Dhanesar Labs · &ResearchHub project overview · Original participant application (historical overview)

    Following publication at DhanesarLabs.com, the Dhanesar Labs link will resolve to this domain; the original Dhanesar Labs site is preserved locally under /labs/.

    Research history and governance

    Study Materials & Research Archive

    A public description of the 2026 Baltimore cycling study's development, instruments, ethics process and computational record. This is a historical archive, not an open enrollment portal.

    Recruitment history

    Help build emotion-aware cities

    Historic Affective Spatial Computing research recruitment poster featuring study title, smartphone and QR code

    Historical artifact only. The pictured QR code and app address were used for recruitment in 2026. Scanning does not indicate that recruitment is currently open.

    Participatory research

    Study design

    Adults cycling in Baltimore were invited to submit 3–5 brief entries during their regular rides. Each entry combined the 20-item Positive and Negative Affect Schedule (PANAS), location information, trip context and optional narrative responses.

    A proposed optional validation workshop used personalized maps and aggregate patterns to elicit feedback. The existence of a workshop protocol does not establish that workshop sessions were conducted.

    Recorded research materials include the consent form, recruitment flyer and scripts, PANAS and contextual instruments, the workshop question guide and data-security plan.

    Governance record

    Research protections

    Study protocol #670: initial expedited approval February 23, 2026; administrative amendment approval May 14, 2026; stated expiration February 23, 2029. Informed consent was required before GPS-tagged diary collection. The data-security plan specifies separate handling of identity/contact data, restricted access, neighborhood-level publication, 200 m minimum map grid resolution and no public individual GPS points.

    Public release policy: figures and demonstrations here must be aggregated, screened or synthetic. Participant-level output cells from notebook HTML exports are not automatically approved for website publication.

    Research notebook record

    Computational pipeline

    The ten-notebook sequence spans environment setup; crash data; street/facility matching; participant screening; PANAS statistics; K-Means; Random Forest; KNN surfaces; affect–crash comparisons; and reproducibility checks.

    The October 28 end-of-testing report documents 120 of 127 checks matching. Seven differences are disclosed in the Research Lab. The notebook HTML exports are treated as confidential audit source files until each individual saved output is reviewed.

    The original mobile web application's code is preserved as a separate historical source, not deployed under this research portal and not connected to the live study database.

    ↑↓ navigate↵ openesc close