Closed reinismu closed 1 month ago
have seen, can reproduce – feels like it should be obvious to me looking at the code but scratching my head on this one. i think there's a mistake with the order in which `self.
although, i realize in an earlier refactor i may have changed the metric calculation to handle the edge case of earth-mover distance where we try to lookup a "degenerate" pair, i.e. Pair::from(x, x)
.
this might fix? https://github.com/krukah/robopoker/commit/fa60546e35faf266744fac6bf54c8325ebab5f53
From what I can tell when compute gets till fn distance(&self, x: &Abstraction, y: &Abstraction) -> f32 {
Metric BTree is empty.
I don't thing setting default Pair will fix it. From what I can tell it needs to contain many different keys.
Seems that issue is in code order. My best guess is that need to change order of metrics
and points
here
let mut layer = Self {
lookup: Abstractor::default(), // assigned during clustering
kmeans: AbstractionSpace::default(), // assigned during clustering
street: self.inner_street(), // uniquely determined by outer layer
metric: self.inner_metric(), // uniquely determined by outer layer
points: self.inner_points(), // uniquely determined by outer layer
};
So metrics would be set when kmeans are calculated. Tho best would be to rewrite how this is handled. Currently it is not obvious that order is important there and can cause bugs as this one in the future as well
it's true that it's not obvious, but order should not be important here if i've implemented my mental model correctly. the idea is that some of the Layer properties (metric & street & abstractionProjections) fields are computed as a pure function of the previous layer (via inner[_points, _metric, _street]
via &self)
the base case of the outermost River layer is a bit odd because it has all of these as empty
the 1st case Turn is a bit less odd, but it still has an empty metric bc we can calculate its histogram over the real numbers, and we don't have to use learned kmeans distances, yet
but Metric
handles that edge case internally, differentiating between the abstract wasserstein
distance vs the scalar difference
distnace -- not so well named, admittedly
so my best guess as to what was happening earlier was that the Pair from 0u64
entry was missing, violating the assertion that distance(x, y)
would be defined for any x, y: Abs
, since we are certain to encounter the case of x == y => Pair(x,y) == Pair::from(0)
which is not in the index of the Metric
can confirm this missing diagonal zero entry was the problem, was able to encounter a new fatal error that's a trivial fix – just have to deprecate Progress in favor of 3rd party progress bar
Seems like there is a bug that metrics are never set with values. Now when running it will fail
Run it using my shortdeck branch to test easier