som 8.2.1 → 8.2.2
raw patch · 2 files changed
+41/−6 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- som.cabal +2/−2
- test/Data/Datamining/Clustering/SOSQC.hs +39/−4
som.cabal view
@@ -1,5 +1,5 @@ Name: som-Version: 8.2.1+Version: 8.2.2 Stability: experimental Synopsis: Self-Organising Maps. Description: A Kohonen Self-organising Map (SOM) maps input patterns @@ -33,7 +33,7 @@ source-repository this type: git location: https://github.com/mhwombat/som.git- tag: 8.2.1+ tag: 8.2.2 library
test/Data/Datamining/Clustering/SOSQC.hs view
@@ -21,7 +21,7 @@ import Data.Datamining.Pattern (adjustNum, absDifference) import Data.Datamining.Clustering.SOSInternal-import Data.List (minimumBy)+import Data.List ((\\), minimumBy) import qualified Data.Map.Strict as M import Data.Ord (comparing) import Data.Word (Word16)@@ -175,8 +175,19 @@ s3 = train s2 x (bmu', _, _, _) = classify s3 x -prop_classification_stabilises- :: TestSOS -> [Double] -> Property+prop_classification_results_are_consistent+ :: TestSOS -> Double -> Property+prop_classification_results_are_consistent (TestSOS s _) x+ = property $ bmu == fst (minimumBy (comparing snd) diffs)+ where (bmu, _, diffs, _) = classify s x++prop_classification_results_are_consistent2+ :: TestSOS -> Double -> Property+prop_classification_results_are_consistent2 (TestSOS s _) x+ = property $ bmuDiff == snd (minimumBy (comparing snd) diffs)+ where (_, bmuDiff, diffs, _) = classify s x++prop_classification_stabilises :: TestSOS -> [Double] -> Property prop_classification_stabilises (TestSOS s _) ps = (not . null $ ps) && maxSize s > length ps ==> k2 == k1 where sStable = trainBatch s . concat . replicate 10 $ ps@@ -184,6 +195,22 @@ sStable3 = trainBatch sStable2 ps (k2, _, _, _) = classify sStable3 (head ps) +prop_models_not_deleted_unless_allowed+ :: TestSOS -> Double -> Property+prop_models_not_deleted_unless_allowed (TestSOS s _) x =+ (not . allowDeletion $ s) ==> null (labelsBefore \\ labelsAfter)+ where labelsBefore = M.keys $ modelMap s+ labelsAfter = M.keys $ modelMap s'+ (_, _, _, s') = classify s x++prop_models_not_deleted_unless_allowed2+ :: TestSOS -> Double -> Property+prop_models_not_deleted_unless_allowed2 (TestSOS s _) x =+ (not . allowDeletion $ s) ==> null (labelsBefore \\ labelsAfter)+ where labelsBefore = M.keys $ modelMap s+ labelsAfter = M.keys $ modelMap s'+ s' = train s x+ test :: Test test = testGroup "QuickCheck Data.Datamining.Clustering.SOS" [@@ -208,6 +235,14 @@ testProperty "prop_batch_training_works" prop_batch_training_works, testProperty "prop_classification_is_consistent" prop_classification_is_consistent,+ testProperty "prop_classification_results_are_consistent"+ prop_classification_results_are_consistent,+ testProperty "prop_classification_results_are_consistent2"+ prop_classification_results_are_consistent2, testProperty "prop_classification_stabilises"- prop_classification_stabilises+ prop_classification_stabilises,+ testProperty "prop_models_not_deleted_unless_allowed"+ prop_models_not_deleted_unless_allowed,+ testProperty "prop_models_not_deleted_unless_allowed2"+ prop_models_not_deleted_unless_allowed2 ]