I am trying to "grow" my own SubsetQ
function using Machine Learning methods. My cSubsetQ
when given two lists (listA and listB) as Inputs should return True
if listA is a subset of listB and False if not.
The plan is to give it enough examples of inputs
and outputs
to train it on.
Here is my failed attempt:
cSubsetQ = Classify[
{
{{}, {a, b, c, d, e}} -> True,
{{a}, {a, b, c, d, e}} -> True,
{{b}, {a, b, c, d, e}} -> True,
{{c}, {a, b, c, d, e}} -> True,
{{d}, {a, b, c, d, e}} -> True,
{{e}, {a, b, c, d, e}} -> True,
{{a, b}, {a, b, c, d, e}} -> True,
{{a, c}, {a, b, c, d, e}} -> True,
{{a, d}, {a, b, c, d, e}} -> True,
{{a, e}, {a, b, c, d, e}} -> True,
{{b, c}, {a, b, c, d, e}} -> True,
{{b, d}, {a, b, c, d, e}} -> True,
{{b, e}, {a, b, c, d, e}} -> True,
{{c, d}, {a, b, c, d, e}} -> True,
{{c, e}, {a, b, c, d, e}} -> True,
{{d, e}, {a, b, c, d, e}} -> True,
{{a, b, c}, {a, b, c, d, e}} -> True,
{{a, b, d}, {a, b, c, d, e}} -> True,
{{a, b, e}, {a, b, c, d, e}} -> True,
{{a, c, d}, {a, b, c, d, e}} -> True,
{{a, c, e}, {a, b, c, d, e}} -> True,
{{a, d, e}, {a, b, c, d, e}} -> True,
{{b, c, d}, {a, b, c, d, e}} -> True,
{{b, c, e}, {a, b, c, d, e}} -> True,
{{b, d, e}, {a, b, c, d, e}} -> True,
{{c, d, e}, {a, b, c, d, e}} -> True,
{{a, b, c, d}, {a, b, c, d, e}} -> True,
{{a, b, c, e}, {a, b, c, d, e}} -> True,
{{a, b, d, e}, {a, b, c, d, e}} -> True,
{{a, c, d, e}, {a, b, c, d, e}} -> True,
{{b, c, d, e}, {a, b, c, d, e}} -> True,
{{a, b, c, d, e}, {a, b, c, d, e}} -> True,
{{a, b, c, d, e}, {}} -> False,
{{a, b, c, d, e}, {a}} -> False,
{{a, b, c, d, e}, {b}} -> False,
{{a, b, c, d, e}, {c}} -> False,
{{a, b, c, d, e}, {d}} -> False,
{{a, b, c, d, e}, {e}} -> False,
{{a, b, c, d, e}, {a, b}} -> False,
{{a, b, c, d, e}, {a, c}} -> False,
{{a, b, c, d, e}, {a, d}} -> False,
{{a, b, c, d, e}, {a, e}} -> False,
{{a, b, c, d, e}, {b, c}} -> False,
{{a, b, c, d, e}, {b, d}} -> False,
{{a, b, c, d, e}, {b, e}} -> False,
{{a, b, c, d, e}, {c, d}} -> False,
{{a, b, c, d, e}, {c, e}} -> False,
{{a, b, c, d, e}, {d, e}} -> False,
{{a, b, c, d, e}, {a, b, c}} -> False,
{{a, b, c, d, e}, {a, b, d}} -> False,
{{a, b, c, d, e}, {a, b, e}} -> False,
{{a, b, c, d, e}, {a, c, d}} -> False,
{{a, b, c, d, e}, {a, c, e}} -> False,
{{a, b, c, d, e}, {a, d, e}} -> False,
{{a, b, c, d, e}, {b, c, d}} -> False,
{{a, b, c, d, e}, {b, c, e}} -> False,
{{a, b, c, d, e}, {b, d, e}} -> False,
{{a, b, c, d, e}, {c, d, e}} -> False,
{{a, b, c, d, e}, {a, b, c, d}} -> False,
{{a, b, c, d, e}, {a, b, c, e}} -> False,
{{a, b, c, d, e}, {a, b, d, e}} -> False,
{{a, b, c, d, e}, {a, c, d, e}} -> False,
{{a, b, c, d, e}, {b, c, d, e}} -> False
}]
The Classify command fails to generalize from my training set.
How would I make a good enough training set to make this work? What would the training set look like?
How can I represent a list and a subset more generally?
I would be grateful for some pointers or advice. Feel free to edit this. Guidance on how to approach this or pose the question better would be nice:)
–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
Note: My attempt replicates this example of Classify in the documentation:
c = Classify[{
{1.5, Blue} -> "A",
{3.2, Blue} -> "A",
{4.1, Red} -> "B",
{5.3, Red} -> "B",
{10., Green} -> "C",
{12.4, Red} -> "C"
}]
SubsetQ
on randomly generalized sequences and feed it toClassify
$\endgroup$