# Aligned Induction

## Conditional entropy optimisation

Code commentary on the implementation of Tractable and Practicable Inducers/Python Implementation/Conditional entropy optimisation

### Sections

Conditional entropy tuple set builder

### Conditional entropy tuple set builder

Define the limited-dimension conditional entropy tuple set list minimiser $Z_{P,A,\mathrm{L}} = \mathrm{maximiseLister}(X_{P,A,\mathrm{L}},P_{P,A,\mathrm{L}},\mathrm{top}(\mathrm{omax}),R_{P,A,\mathrm{L}})$ where (i) the optimiser function is $\begin{eqnarray} X_{P,A,\mathrm{L}} &=& \{(K,-(\mathrm{entropy}(A~\%~(K \cup L))-\mathrm{entropy}(A~\%~K))) : K \subseteq V \setminus L\} \end{eqnarray}$ and (ii) the neighbourhood function is $\begin{eqnarray} &&P_{P,A,\mathrm{L}}(M) = \{(J,X_{P,A,\mathrm{L}}(J)) : \\ &&\hspace{2em}(K,\cdot) \in M,~w \in V \setminus L \setminus K,~J = K \cup \{w\},~|J| \leq \mathrm{kmax}\} \end{eqnarray}$ and (iii) the initial subset is $\begin{eqnarray} R_{P,A,\mathrm{L}} &=& \{(\{w\},X_{P,A,\mathrm{L}}(\{w\})) : w \in V \setminus L\} \end{eqnarray}$ Then the conditional entropy optimised limited-dimension conditional entropy tuple set list, $M$, is (Text) $\begin{eqnarray} M &=& \mathrm{topd}(\mathrm{qmax})(\mathrm{elements}(Z_{P,A,\mathrm{L}})) \subset \mathrm{P}(V \setminus L) \end{eqnarray}$ The conditional entropy tuple set builder parametersBuilderConditionalVars is defined in module AlignmentPracticable.

parametersBuilderConditionalVars ::
Integer -> Integer -> Integer -> Set.Set Variable -> Histogram ->
Maybe (Map.Map (Set.Set Variable) Double)

def parametersBuilderConditionalVars(kmax,omax,qmax,ll,aa):
...
def buildc(qq,nn):
pp = sset([kk|sgl(w) for (kk,e) in qq.items() if e > 0 for w in vvk-kk])
mm = bot(omax,sdict([(jj,ent(red(aa,ll|jj))-ent(red(aa,jj))) for jj in pp if len(jj) <= kmax]))
if len(mm) > 0:
nn1 = nn.copy()
nn1.update(mm)
return buildc(mm,nn1)
return nn
if kmax < 0 or omax < 0 or qmax < 0:
return None
vvk = vars(aa) - ll
rr = bot(omax,sdict([(sgl(w),ent(red(aa,ll|sgl(w)))-ent(red(aa,sgl(w)))) for w in vvk]))
return bot(qmax,buildc(rr,rr))


top