calculate_slr | R Documentation |
calculate_slr
has been superseded in
favor of compare_documents()
which offers more functionality.
calculate_slr(
sample1_path,
sample2_path,
rforest = NULL,
reference_scores = NULL,
project_dir = NULL
)
sample1_path |
A file path to a handwriting sample saved in PNG file format. |
sample2_path |
A file path to a second handwriting sample saved in PNG file format. |
rforest |
Optional. A random forest trained with ranger. If no
random forest is specified, |
reference_scores |
Optional. A dataframe of reference similarity
scores. If reference scores is not specified, |
project_dir |
A path to a directory where helper files will be saved. If no project directory is specified, the helper files will be saved to tempdir() and deleted before the function terminates. |
Compares two handwriting samples scanned and saved a PNG images with the following steps:
processDocument
splits the writing in both samples into component shapes, or graphs.
get_clusters_batch
groups the graphs into clusters of similar shapes.
get_cluster_fill_counts
counts the number of graphs assigned to each cluster.
get_cluster_fill_rates
calculates the proportion of graphs assigned to each cluster. The cluster fill rates serve as a writer profile.
A similarity score is calculated between the cluster fill rates of the two documents using a random forest trained with ranger.
The similarity score is compared to reference distributions of same writer and different writer similarity scores. The result is a score-based likelihood ratio that conveys the strength of the evidence in favor of same writer or different writer. For more details, see Madeline Johnson and Danica Ommen (2021) doi:10.1002/sam.11566.
A dataframe
# Compare two samples from the same writer
s1 <- system.file(file.path("extdata", "docs", "w0005_s01_pLND_r03.png"),
package = "handwriterRF"
)
s2 <- system.file(file.path("extdata", "docs", "w0005_s02_pWOZ_r02.png"),
package = "handwriterRF"
)
calculate_slr(s1, s2)
# Compare samples from two writers
s1 <- system.file(file.path("extdata", "docs", "w0005_s02_pWOZ_r02.png"),
package = "handwriterRF"
)
s2 <- system.file(file.path("extdata", "docs", "w0238_s01_pWOZ_r02.png"),
package = "handwriterRF"
)
calculate_slr(s1, s2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.