Пример #1
0
 public static IEnumerable<Hypothesis> SmallestGeneralizers(IEnumerable<Hypothesis> generalBorder,
                                                            Example example,
                                                            Hypothesis h)
 {
     var generalized = h + example;
     yield return generalized;
 }
Пример #2
0
 public static IEnumerable<Hypothesis> SmallestSpecifiers(IEnumerable<Hypothesis> specificBorder,
                                                          Example example,
                                                          Hypothesis h)
 {
     if (h.Left <= example.X - 1) yield return new Hypothesis(h.Left, example.X - 1, h.Bottom, h.Top);
     if (example.X + 1 <= h.Right) yield return new Hypothesis(example.X + 1, h.Right, h.Bottom, h.Top);
     if (example.Y + 1 <= h.Top) yield return new Hypothesis(h.Left, h.Right, example.Y + 1, h.Top);
     if (h.Bottom <= example.Y - 1) yield return new Hypothesis(h.Left, h.Right, h.Bottom, example.Y - 1);
 }
Пример #3
0
 public bool Contains(Hypothesis h)
 {
     if (IsEmpty())
     {
         return false;
     }
     return h.IsEmpty() ||
            (
                (h.Left > Left || (float.IsInfinity(h.Left) && float.IsInfinity(Left))) &&
                (h.Right < Right || (float.IsInfinity(h.Right) && float.IsInfinity(Right))) &&
                (h.Bottom > Bottom || (float.IsInfinity(h.Bottom) && float.IsInfinity(Bottom))) &&
                (h.Top < Top || (float.IsInfinity(h.Top) && float.IsInfinity(Top)))
            );
 }