Maximum-Entropy-Principle Orthogonal Non-negative Matrix Factorization
[This code is presented as supplimentary material for our paper]: "A Novel Maximum-Entropy-Driven Technique for Low-Rank Orthogonal Nonnegative Matrix Factorization with ℓ0-Norm sparsity Constraint"
Deterministic Annealing (DA) is a clustering, or in a more accurate definition, a facility location algorithm that clusters data points into several groups of different sizes, so that the cumulative distance of each data point to its assigned resource is minimized (for details on this algorithm, please refere to our paper mentioned above). To cluster data into
parameter | description |
---|---|
k | number of clusters we want to partition our data in |
tol | The tolerence at which bifurcation happens for the critical cluster - smaller values more stable, but results in a slower performance |
max_iter | maximum number of iterations that the code waits until the convergence of parameters |
alpha | the value at which |
purturb | the rate at which we purturb new cluster centers |
beta_final | the final |
verbos | whether to print out iterations' information |
normalize | whether to 'l2' normalize the input data |
input | description |
---|---|
X | Data matrix |
output | description |
---|---|
Y | cluster centers (resource locations) |
P | associations matrix |
{
from Deterministic_Annealing import DA
model=DA(K,tol=1e-4,max_iter=1000,alpha=1.05,
purturb=0.01,beta_final=None,verbos=0,normalize=False)
model.fit(X,Px='auto')
Y,P=model.cluster()
print(model.return_cost())
}
For example, for a dataset that consists of 16 psudu-symmetric clusters as illustrated if Fig 1, the DA finds the cluster centers:
{
model.plot()
}
Where in this animation below, you can see how by increasing the value of
{
model.animation()
}
Clustering.mp4
These critical
{
model.plot_criticals(log=True)
}
By looking at this diagram, we can see that there are large gaps at 2,4,8 and 16 between these critical
{
model.return_true_number()
}
returns the value 16 for this dataset.
The command mesh_plot specifies which cluster center the data belong to. For example, for a given dataset of 15 clusters, we get:
{
model.mesh_plot()
}
The Mass-Constrained DA allows capturing unbalanced datasets where one or more clusters have significantly lower number of data points compared with the other clusters. The weight of each cluster can be shown using the pie_chart command. This is very useful for outlier detection applications. For example, for a given dataset like:
{
model.pie_chart()
}
The resulting pie chart indicates that the cluster Y_6 is an outlier.
The orthogonal NMF (ONMF) poses the following problem:
DA can also be used to solve the ONMF problem.
input | description |
---|---|
X | Data matrix |
output | description |
---|---|
W | Features matrix |
H | Mixing matrix |
model | DA model associated with the data matrix. Can be used to identify the true number of features |
{
from onmf_DA import ONMF_DA
W,H,model=ONMF_DA.func(X,k,alpha=alpha,purturb=p,tol=tol)
}
For