Skip to content

math overview

Christopher Small edited this page Jan 7, 2022 · 6 revisions

This page describes the implementation of Polis' core math algorithms.

Source

The core math code can be found in the polismath.math.* namespaces namespaces. Things specifically come together in the polismath.math.conversation namespace, in the conv-update function.

This function is implemented in terms of the small-conv-update-graph map. This is compiled using the plumatic/plumbing library, which allows us to specify a series of data transformations as a Clojure map, and compile this map into a single function which performs all of the individual operations.

inputs

  • conv - previous conv map
  • votes - new votes
  • opts - options map for configuring the algorithm(s)

outputs

The output of the conv-update process is a new conv map, with the following (notable) entries:

  • rating-mat - the vote matrix, as a NamedMatrix (named rows & columns), with nil entries for missing data
  • mat - the vote matrix, with missing data imputed by columnwise means
  • pca - results of the Principal Components Analysis
  • proj - projection of the data, given the pca
  • repness - representativeness values
  • base-clusters - a fine grained clustering (K-means clusters, with K=100)
  • group-clusters - a course grained group clustering, with the number of groups chosen by silhouette coefficient
  • etc.

algorithm overview

The following figure represents the flow of data in the small-conv-update-graph:

conversation update graph

Note that this figure is generated directly from the small-conv-update-graph (one of the advantages of the computational flow being specified as a data structure).