Having a multiclass classification task. My goal is to solve this using the Local Classifier per Parent Node (LCPN) approach.
Let me explain using a MWE.
Say I have this dummy dataset:
import numpy as npfrom sklearn.datasets import make_classificationfrom scipy.cluster import hierarchyX, y = make_classification(n_samples=1000, n_features=10, n_classes=5, n_informative=4)I came up with the distance matrix between these classes to be:
d = np.array([[ 0., 201.537, 197.294, 200.823, 194.517], [201.537, 0., 199.449, 202.941, 196.703], [197.294, 199.449, 0., 198.728, 192.354], [200.823, 202.941, 198.728, 0., 195.972],[[194.517, 196.703, 192.354, 195.972, 0. ]])So, I determined the class hierarchy like so:
hc = hierarchy.linkage(d, method='complete')The dendrogram obtained is thus:
dendrogram = hierarchy.dendrogram(hc, labels=['A','B','C', 'D', 'F'])dendrogramWhich I illustrate in a tree-like structure, using hierarchy.to_tree() as:
My Question:
How do I fit a classifier such as a DecisionTreeClassifier or SVM at each internal node (including the root), following the LCPN method, to proceed as in the tree illustration above?

