tangled
alpha
login
or
join now
huwcampbell.com
/
grenade
1
fork
atom
💣 Machine learning which might blow up in your face 💣
1
fork
atom
overview
issues
pulls
pipelines
Only permit exact hotmaps
Huw Campbell
8 years ago
cb2eb0db
96a45066
+1
-4
2 changed files
expand all
collapse all
unified
split
grenade.cabal
src
Grenade
Utils
OneHot.hs
-3
grenade.cabal
···
42
42
, containers >= 0.5 && < 0.6
43
43
, cereal >= 0.5 && < 0.6
44
44
, deepseq >= 1.4 && < 1.5
45
45
-
, exceptions == 0.8.*
46
45
, hmatrix == 0.18.*
47
46
, MonadRandom >= 0.4 && < 0.6
48
48
-
, mtl >= 2.2.1 && < 2.3
49
47
, primitive >= 0.6 && < 0.7
50
50
-
, text == 1.2.*
51
48
, singletons >= 2.1 && < 2.4
52
49
, vector >= 0.11 && < 0.13
53
50
+1
-1
src/Grenade/Utils/OneHot.hs
···
57
57
let len = fromIntegral $ natVal n
58
58
uniq = [ c | (c:_) <- group $ sort as]
59
59
hotl = length uniq
60
60
-
in if hotl <= len
60
60
+
in if hotl == len
61
61
then
62
62
Just (M.fromList $ zip uniq [0..], V.fromList uniq)
63
63
else Nothing