MUSH - Manual model construction
MUSH - Analysis of the UCI Machine Learning Repository Mushroom Data Set/Manual model construction
There are some rules for poisonous mushrooms from most general to most specific:
P_1) odor=NOT(almond.OR.anise.OR.none)
120 poisonous cases missed, 98.52% accuracy
P_2) spore-print-color=green
48 cases missed, 99.41% accuracy
P_3) odor=none.AND.stalk-surface-below-ring=scaly.AND.
(stalk-color-above-ring=NOT.brown)
8 cases missed, 99.90% accuracy
P_4) habitat=leaves.AND.cap-color=white
100% accuracy
Rule P_4) may also be
P_4') population=clustered.AND.cap_color=white
The following script creates a fud of transforms for each of these rules and writes them to MUSH_model_manual.json,
:l MUSHDev
(uu,aa) <- mushIO
let vv = uvars uu
let vvl = sgl (VarStr "edible")
let vvk = vv `minus` vvl
let hh = aahr uu aa
let wwc = cart uu (sgl (VarStr "odor"))
let wwi = llqq [llss [(VarStr "odor", ValStr u)] | u <- ["creosote","fishy","foul","musty","pungent","spicy"]]
let w = VarStr "p1"
let aao = unit (sgl (llss [(w, ValInt 0)]))
let aai = unit (sgl (llss [(w, ValInt 1)]))
let tt1 = trans ((unit (wwc `minus` wwi) `mul` aao) `add` (unit wwi `mul` aai)) (sgl w)
let wwc = cart uu (sgl (VarStr "spore-print-color"))
let wwi = llqq [llss [(VarStr "spore-print-color", ValStr u)] | u <- ["green"]]
let w = VarStr "p2"
let aao = unit (sgl (llss [(w, ValInt 0)]))
let aai = unit (sgl (llss [(w, ValInt 1)]))
let tt2 = trans ((unit (wwc `minus` wwi) `mul` aao) `add` (unit wwi `mul` aai)) (sgl w)
let wwc = cart uu (llqq [VarStr "odor", VarStr "stalk-surface-below-ring", VarStr "stalk-color-above-ring"])
let wwi = llqq [llss [(VarStr "odor", ValStr "none"), (VarStr "stalk-surface-below-ring", ValStr "scaly"), (VarStr "stalk-color-above-ring", ValStr u)] | u <- ["buff","cinnamon","gray","orange","pink","red","white","yellow"]]
let w = VarStr "p3"
let aao = unit (sgl (llss [(w, ValInt 0)]))
let aai = unit (sgl (llss [(w, ValInt 1)]))
let tt3 = trans ((unit (wwc `minus` wwi) `mul` aao) `add` (unit wwi `mul` aai)) (sgl w)
let wwc = cart uu (llqq [VarStr "habitat", VarStr "cap-color"])
let wwi = sgl (llss [(VarStr "habitat", ValStr "leaves"), (VarStr "cap-color", ValStr "white")])
let w = VarStr "p4"
let aao = unit (sgl (llss [(w, ValInt 0)]))
let aai = unit (sgl (llss [(w, ValInt 1)]))
let tt4 = trans ((unit (wwc `minus` wwi) `mul` aao) `add` (unit wwi `mul` aai)) (sgl w)
let wwc = cart uu (llqq [VarStr "population", VarStr "cap-color"])
let wwi = sgl (llss [(VarStr "population", ValStr "clustered"), (VarStr "cap-color", ValStr "white")])
let w = VarStr "p4a"
let aao = unit (sgl (llss [(w, ValInt 0)]))
let aai = unit (sgl (llss [(w, ValInt 1)]))
let tt4a = trans ((unit (wwc `minus` wwi) `mul` aao) `add` (unit wwi `mul` aai)) (sgl w)
let ggm = qqff (llqq [tt1,tt2,tt3,tt4])
Data.ByteString.Lazy.writeFile ("MUSH_model_manual.json") $ fudPersistentsEncode $ fudsPersistent ggm