What valence does this APL train have?
Haskell, 61 bytes

f t=[and$zipWith(/=)t$[2|even$length t]++cycle[x,0]|x&lt;-[2,0]]

Try it online!
Takes a list of: 0 for monad, 1 for both, 2 for dyad. Returns [a,b].
The valid monad trains are:
M
MM
MDM
MMDM
MDMDM
MMDMDM
...

And the valid dyad trains are:
D
MD
DDD
MDDD
DDDDD
MDDDDD
...

So we check the input against this pattern, first for x=M and then x=D:
x
Mx
xDx
MxDx
xDxDx
MxDxDx
...

To generate the pattern, we start with M if the length is even, then alternate x and D. (Haskell's laziness lets me use cycle, which creates an infinite alternating list, rather than specify how long to alternate for: zipWith will only consume the pattern until it hits the end of t.)
I use (/=) and invert the pattern to support B as a wildcard.