Skip to main content
1 of 2
Ben Sprott
  • 1.3k
  • 14
  • 23

Is it possible to regress an arbitrary function from a span?

Suppose we have three sets $A, B,C$ and a span $S := A \leftarrow C \rightarrow B$. There is a special case when the data of the span $S$ exactly specifies a function $f: A \rightarrow B$. In every other case, we have some data that may be used to define a function. It's a bit like a probabilistic model of a function or "data" about a function. What I am wondering is whether or not we can do something like a regression that takes spans to functions in some precise way, the same way one might regress a linear function between two data columns. I have gone back and forth as to whether this is possible. Since each arm of the span can be seen as a multiset, we might have a notion of addition over the range elements like this:

$ \{ (a,b), (a,c),(a,b),(a,c) \} \rightarrow \{ 2(a,b), 2(a,c) \} $

Or

$ \{ (a,b), (a,c),(a,b),(a,c) \} \rightarrow (a, \{ 2b, 2c \} )$

What we don't have is a way to map a mixture of ordered pairs to a single ordered pair thus producing the critical regression.

This is reminiscent of the Kleisli category of the multiset monad which is what I was thinking about before landing on this specific question in this post. There is a natural transformation from the mulitset monad to the monad of measures of finite support, which itself has a Kleisli category. Perhaps there is a way to push the notion of averaging from the measures monad Kleisli Cat down to the Kleisli Cat of the multiset monad.

Ben Sprott
  • 1.3k
  • 14
  • 23