knitr::opts_chunk$set(echo = TRUE, comment = "#>")

Aaron Eubank, Miles Weule-Chandler, Zhenhua Meng

Summary:

(ade)

Description

This project is part of the Agroimpacts working group and seeks to use R programming to give accuracy statistics on polygons of farm plots in Zambia which have been created by Amazon Mechanical Turk crowdsourced Workers. Specifically, this project will compare Mechanical Turk polygons to a sampling of ground-truthed polygons to determine the true postive, false positive, and false negative areas of each polygon. The package will consist primarily of a reproducible program which will iterate through all of the ground truth polygons in a file, match them with Mechanical Turk polygons by a common grid value, then for each grid, give the accuracy statistics of each polygon in that grid which intersects with the majority of a ground truth polygon. The program will also give the compiled statistics for each grid.

These statistics will be useful in understanding the quality of work done by the Mechanical Turk workers and to draw conclusions about how reliable other (unsampled) polygons are, as well as which workers' products are most reliable.

Primary Objectives

Approach and Method:

(ade)

An outline of the analytical methods and code you plan to use, including the names of key packages that you will draw on.

Simple statistical methods for determining accuracy will also be used to get the final results (see chunks below).

The map accuracy function creates each of our categories in the following way, which will be key to gathering the statistics

#"truth" is a given truth polygon
#"maps" is a given Mechanical Turks polygon

#True Positive
tp <- st_intersection(truth, maps)  

#False Positive
fp <- st_difference(maps, truth)  

#False Negative
fn <- st_difference(truth, maps)  

From there, the area will be taken of each of these values and returned as a list using this code:

acc_stats <- acc_stats_sum(tp = areas["tp"], fp = areas["fp"], 
                             fn = areas["fn"], tn = areas["tn"])

return(list("stats" = acc_stats, "tp" = tp, "fp" = fp, "fn" = fn, "tn" = tn))

The following other packages will likely also be utilzed:

Data:

(mfwc)

This project relies on three data sets. Ground truth polygons, which represent accurate delineations of agricultural fields mapped by a GPS unit, crowdsourced fields produced by mechanical turk workers and a grid network provided by Mapping Africa.

Truth Polygon:

knitr::include_graphics("figures/Truth_Poly.png")
library(sf)
library(sp)
library(raster)
library(rgdal)
library(rgeos)
library(maps)
library(farmapz)
library(rmapaccuracy)

truth_sub <- st_read("C:/Users/euban/OneDrive - Clark University/Geospatial Analysis with R/packages/geospaarproj/farmapz/data/CSV Data/truth_sub.sqlite")

workers_sub <- st_read("C:/Users/euban/OneDrive - Clark University/Geospatial Analysis with R/packages/geospaarproj/farmapz/data/CSV Data/workers_sub.sqlite")

grids_sub <- st_read("C:/Users/euban/OneDrive - Clark University/Geospatial Analysis with R/packages/geospaarproj/farmapz/data/CSV Data/grids_sub.sqlite")

# example truth polygon
example_t_polygon <- truth_sub[truth_sub$ogc_fid0 == "420",]

# example mechanical turk worker polygon
example_worker_polygon <- workers_sub[workers_sub$ogc_fid0 == "1908",]

false_positive <- st_difference(example_worker_polygon, example_t_polygon)
true_positive <- st_intersection(example_worker_polygon, example_t_polygon)
false_negative <- st_difference(example_t_polygon,example_worker_polygon)

plot(st_geometry(example_t_polygon))
plot(st_geometry(false_positive), col = "red", add = TRUE)
plot(st_geometry(true_positive), col = "blue", add = TRUE)
plot(st_geometry(false_negative), col = "grey", add = TRUE)

False positive areas are shown in red (areas present in worker polygons, but not in their truth polygon counterpart). True postive area are shown in blue (shared positive geometry between a worker and a truth polygon). False negative areas are shown in grey (areas present in truth polygon, but not in their crowdsourced counterparts).

True Positive Area:

knitr::include_graphics("figures/True_Positive.png")

False Positve Area:

knitr::include_graphics("figures/False_Positive.png")

False Negative Area:

knitr::include_graphics("figures/False_Negative.png")

Here is a visualization of all three together:

knitr::include_graphics("figures/Overlay.png")

Our proposed methodology will utilize the mapaccuracy function from the rmapaccuracy package to iterate over truth polygons and their associated mechanical turk derived field assignments. The three characteristics described above will then be calculated for each mechanical turk assignment. Existing methodologies from similar projects will be adapted for use in this project'

Code:

(mfwc)

Timelines:

(zm)

A rough timeline of our project is as follows:

Anticipated Outcomes:

(zm)



agroimpacts/farmapz documentation built on May 7, 2019, 12:51 a.m.