1
Robust High Performance
Optimization for Clustering,
Multi-Dimensional Scaling
and Mixture Models
CGB Indiana University Lunchtime Tal January 22 2008
Geoffrey Fox discussing work with:
Seung-Hee Bae, Neil Devadasan, Rajarshi Guha, Marlon Pierce, Xiaohong Qiu, David Wild, Huapeng Yuan
Community Grids Laboratory, Research Computing UITS, School of informatics and POLIS Center Indiana University
George Chrysanthakopoulos, Henrik Frystyk Nielsen Microsoft Research, Redmond WA
http://www.infomall.org/multicore
Abstract
n We first review the pros and cons of various approaches to non linear
optimization in the presence of local minima, ill conditioned matrices and ambiguous choice of appropriate number of degrees of freedom (over and under fitting).
n We define constraints on approaches from need to run well in parallel on
systems of multicore CPU's.
n We present a uniform approach to data clustering and Gaussian mixture model
ling that uses deterministic (not Monte Carlo) annealing to mitigate the local minima problem and naturally relates the appropriate number of parameters (clusters or mixture components) to the scale at which problem is examined.
n New clusters (mixtures) are introduced at phase transitions as the annealing
temperature is lowered and second derivative matrix becomes singular.
n We contrast three ways of visualizing this structure in low (2) dimensions with
Principal Component Analysis PCA, Generative Topographic Mapping GTM
and Multi-Dimensional Scaling MDS using annealing to regularize GTM and MDS.
n Currently we have implemented in preliminary fashion deterministic annealing
clustering and GTM in a fashion that runs well on multicore systems.
n We have applied these techniques to Geographical Information Systems
(clustering demographic data in 2D) and Cheminformatics in 1052 and lower dimensions.
n We would like to understand other applications that can constrain and test
Too much Computing?
n Historically both grids and parallel computing have tried to
increase computing capabilities by
• Optimizing performance of codes at cost of re-usability • Exploiting all possible CPU’s such as Graphics
co-processors and “idle cycles” (across administrative domains)
• Linking central computers together such as NSF/DoE/DoD
supercomputer networks without clear user requirements
n Next Crisis in technology area will be the opposite problem –
commodity chips will be 32-128way parallel in 5 years time and we currently have no idea how to use them on commodity systems – especially on clients
• Only 2 releases of standard software (e.g. Office) in this
time span so need solutions that can be implemented in next 3-5 years
n Intel RMS analysis: Gaming and Generalized decision
Too much Data to the Rescue?
n Multicore servers have clear “universal parallelism” as many
users can access and use machines simultaneously
n Maybe also need application parallelism (e.g. datamining) as
needed on client machines
n Over next years, we will be submerged of course in data
deluge
• Scientific observations for e-Science • Local (video, environmental) sensors
• Data fetched from Internet defining users interests
n Maybe data-mining of this “too much data” will use up the
“too much computing” both for science and commodity PC’s
• PC will use this data(-mining) to be intelligent user
assistant?
30 Clusters
Renters
Asian
Hispanic
Total
30 Clusters
Clustering algorithm annealing by decreasing distance scale and gradually finds more clusters as resolution improved
Parallel Multicor
Deterministic Annealing Clustering
10000/(Grain Size n = points per core) Overhead = Constant1 + Constant2/n
Constant1 = 0.05 to 0.1 (Windows) due to threa
runtime fluctuations
10 Clusters
20 Clusters Parallel Overhea
on 8 Threads on Intel 8 core
Speedup = 8/(1+Overhead)
Basic Nonlinear Optimization I
n Nonlinear optimization (in either 2 or maximum likilihood) issubject to well known problems including diverging or converging but to non optimal solution (local minima)
n If we have n parameters i and need to minimize
F = 2 or – ln L
n Then naively one expands
n F = F(0) + k=1n k F(0) /i + k,l=1n kl 2F(0)
/kl
• with = -0
n As long as number of observables N is large in su
2 =
i=1Nqi2() or – ln L = i=1Nln qi() n One can approximate
2F(0) /kl i=1N (1/ qi)qi(0) /kqi(0) /l
dropping term proportional to 2qi(0) /k l
n This shows that second derivative matrix is positive (semi-)
Basic Nonlinear Optimization II
n Taylor expansion of F (Newton’s method) is jusn This formula can rarely be used as in practice matrix A is
poorly conditioned corresponding to linear combination of
being (ill/un) determined
n This easy to understand by transforming basis to those of
Basic Nonlinear Optimization III
n In my experience, the lowest eigenvalues k of A are zero to
rounding error, so corresponding shifts k are unreliable and
incrementing = 0 + gives a nonsense point and F rapidly
diverges as one iterates
n There are several approaches and they actually work and with
modification, Newton’s method is very reliable and one can expect to get good results
• Unless n is very large (tens of thousands?) when it can be
computationally unattractive
…….
Reliable Newton’s Method I
n
WNPF
(
W
ell
N
igh
P
erfect Fit – code lost): Here one
diagonalizes A and modifies equation
k=
b
k/
k, by
zeroing shifts
kif
k<
cutwhere is
cutis
dynamically adjusted and I typically started with
cut =
maxwith initially
~ 0.1
• adjusted up or down depending on success of fit • Only shift in well determined directions but do many
directions at once
n
Converges in 10-20 iterations
See my first paper
Reliable Newton’s Method II
n
Manxcat.f
(Code still exists): This can be too expensive
so when I needed millions of such optimizations I used
Marquardt’s method
which corresponds to
• k k + Q accomplished by
• Replacing A Q Identity matrix + A
• so removes effect of 1/k for small kwithout expense of
determining eigenvalues/vectors
• Has nonzero but small shifts in ill determined directions • Q is dynamically changed in a complicated fashion on a
logarithmic scale
n
Similar performance to WNPF but less flexible
Gradient Descent
n Many optimizations do not use second order Taylor expansion
but rather look at a shift
n = G(0) so estimate of minimum i
=0+ G(0)
n Where may be varied and G has a more or less fancy way of determining
it
n However usually G is related to steepest descent direction n i.e. G = - F which is direction F decreases fastest along
n One can often find a rigorous bound so that one can show F definitely
decreases
n However essentially always a local minima as only explore directions of
largest eigenvalues (still could be a good minima)
n Note unlikely to be a minimum in “other directions” so really a “partial” not
a “local” minima
n Convergence tends to be slow as error lower order in F than for Newton’s
method but derivatives do not need to be calculated
n Computation n N for n parameters and N data points
Simulated Annealing
n
Here we consider
function F() to be minimized as an
Energy E()
and randomly choose points in a
neighborhood of
0n
One accepts a new value of
with a probability P
depending on temperature T and energies E(
) and
E(
0)
n
Typical choice is P=1 if
E() < E(
0)
, and
P = exp([E(
0) − E()]/
T
)
if
E() > E(
0)
n
Temperatures are decreased gradually
n
This method avoids local minima due to allowing
upward fluctuations at high temperature but execution
time is huge although each iteration has time
CICC Chemical Informatics and Cyberinfrastructure Collaboratory Web Service Infrastructure
Portal Services
RSS Feeds User Profiles
Collaboration as in Sakai
Core Grid Services
Service Registry
Job Submission and Management
Local Clusters
IU Big Red, TeraGrid, Open Science Grid
Varuna.net
Quantum Chemistry OSCAR Document Analysis
InChI Generation/Search
Computational Chemistry (Gamess, Jaguar etc.)
Deterministic Annealing for Data Mining
n We are looking at deterministic annealing algorithms because although
heuristic
• They have clear scalable parallelism (e.g. use parallel BLAS)
• They avoid (some) local minima and regularize ill defined problems
in an intuitively clear fashion
• They are fast (no Monte Carlo)
• They determine number of clusters automatically (Most important?) • Support iterative visualization approaches as increment number of
clusters systematically
n Developed first by Durbin as Elastic Net for TSP
n Extended by Rose (my student then; now at UCSB)) and Gurewitz
(visitor to C3P) at Caltech for signal processing and applied later to
many optimization and supervised and unsupervised learning methods.
n See K. Rose, "Deterministic Annealing for Clustering, Compression,
Classification, Regression, and Related Optimization Problems,"
Proceedings of the IEEE, vol. 80, pp. 2210-2239, November 1998 Cited by 286
n A deterministic annealing approach to clustering K Rose, E Gurewwitz,
G Fox - Pattern Recognition Letters, 1990 Cited by 159
n Statistical mechanics and phase transitions in clustering K Rose, E
High Level Theory
n Deterministic Annealing can be looked at from a Physics,
Statistics and/or Information theoretic point of view
n In physics view, you get result by using “mean field
approximation” but simplest is information theoretic
n Let E be function that one wishes to minimize
n Then we wish to find minima that is most probable given density
of states.
n One minimizes Free Energy F= E-TS where S is Entropy and S is
just sum over plnp for each degree of freedom with probability
p
• At large T, Entropy dominates while at small T Energy dominates • Annealing lowers temperature so solution tracks continuously
n Key idea is to only apply this to “missing data” i.e. to hidden
degree of freedom k that labels cluster or mixture
n So S is a sum over these discrete degrees of freedom and one can
Deterministic Annealing for Clustering II
n This is an extended K-means algorithm or a simplified Gaussian
mixture
n Start with a single cluster giving as solution Y1 as centroid n For some annealing schedule for T, iterate above algorithm
testing correlation matrix in Xi about each cluster center to see if
“elongated”
n Split cluster if elongation “long enough”; splitting is a phase
transition in physics view
n You do not need to assume number of clusters but rather a final
resolution T or equivalent
n Minimum evolving as temperature decreases n Movement at fixed temperature going to local
minima if not initialized “correctly
Solve Linear Equations for each temperature
Nonlinearity effects mitigated by approximating with solution at previous higher temperature
Deterministi
Annealing
F({y}, T)
Views from
Past on
Physical
Parallelism
n
All the methods – Deterministic Annealing, Mixture
Models, GTM, PCA and Newton’s method involve
n
Sums over data points
x
=1..N to calculate values and
derivatives
• One can divide points up between cores and efficiently
parallelize
• A little tricky to add results from separate data sets running
in parallel (problem is Cache coherence)
n
Matrix algebra
such as finding eigenvalues
• Well known how to parallelize but need low latency i.e.
Where are we for Clustering?
n We have deterministically annealed clustering running well on
8-core (2-processor quad 8-core) Intel systems using C# and Microsoft Robotics Studio CCR/DSS
n Could also run on multicore-based parallel machines but didn’t
do this (is there a large Windows quad core cluster on TeraGrid?)
• This would also be efficient on large problems
n Applied to Geographical Information Systems (GIS) and census
data
• Could be an interesting application on future broadly deployed PC’s • Visualize nicely on Google Maps (and presumably Microsoft Virtual Earth)
n Applied to several Cheminformatics problems and have parallel
efficiency but visualization harder as in 150-1024 (or more) dimensions
n Will develop a family of such parallel (annealing) data-mining
tools where basic approach known for
• Clustering and Gaussian Mixtures (Expectation Maximization) • Mapping High Dimensional Spaces – MDS and GTM
Clustering Data
n Cheminformatics was tested successfully with small datasets and
compared to commercial tools
n Cluster on properties of chemicals from high throughput
screening results to chemical properties (structure, molecular weight etc.)
n Applying to PubChem (and commercial databases) that have
6-20 million compounds
• Comparing traditional fingerprint (binary properties) with real-valued
properties
n GIS uses publicly available Census data; in particular the 2000
Census aggregated in 200,000 Census Blocks covering Indiana
• 100MB of data
n Initial clustering done on simple attributes given in this data
• Total population and number of Asian, Hispanic and Renters
n Working with POLIS Center at Indianapolis on clustering of
SAVI (Social Assets and Vulnerabilities Indicators) attributes at http://www.savi.org) for community and decision makers
Parallel Multicore
Deterministic Annealing Clustering
“Constant1”
Increasing number of clusters decreases communication/memory bandwidth overheads
Parallel Overhead for large (2M points) Indiana Census clusterin on 8 Threads Intel 8
Parallel Multicore
Deterministic Annealing Clustering
“Constant1”
Increasing number of clusters decreases communication/memory bandwidth overheads
Parallel Overhead for subset of PubChem clustering on 8 Threads (Intel 8b
The fluctuating overhead is reduced to 2% (as bits not doubles
Visualizing High Dimensional Spaces
n For GIS we have a 2D or 3D underlying space and visualization
of data correlations is clear
n For cheminformatics we have hundreds (continuous) to
thousands (binary) degrees of freedom and difficult to evaluate any data mining – in particular clustering
n Need to map high dimensional space into lower (here two)
dimensional space with some constraints
n This field has been well studied and there are at least two
approaches
• SOM (Self Organizing Maps) and GTM (Generative Topographic
Mapping) which are really clustering algorithms with a built in 2D organization for clusters
• MDS (Multi Dimensional Scaling) which “just views this as an
optimization problem”.
• Principal Component Analysis (PCA) is here viewed as a special case of
MDS Multi Dimensional Scaling
n This is rather straightforward (and perhaps good for that
reason).
n Consider n points Y which are vectors in a high dimensional
space that we want to map into n points X in a low dimensional space (bad notation)
n Let us minimize
Stress (X) = i<j=1n weight(i,j) (ij- d(Xi , Xj))2
n ij is distance between original vectors Y in high dimensional
space but it can be any scoring of discrepancy between points i
and j.
n d(Xi , Xj) is distance between mapped vectors
n Here simplest choice is weight(i,j) = 1 but one can also look at
choices like Sammon’s mapping
PCA Principal Component Analysis I
n This is closely related to analysis used in WNPF approach to
nonlinear fitting and DA method for determining whether to split clusters. We form DD matrix PCA which depends on
vectors Yk in original space and a “mean” M about which we do
the expansio
n For cluster splitting the mean M is a cluster center and there is
a kernel which is probability that Yk belongs to a given cluster
n For MDS, the kernel is often absent and the mean M is the
PCA Principal Component Analysis II
n
The PCA approach finds the eigenvalues and
eigenvectors of the D
D matrix
PCA
and maps point
point Y
kinto its expansion in the first 2 (or choose here
lower dimensional space) PCA eigenvectors with
largest eigenvalues
n
This is optimal solution to minimizing stress under two
conditions
• One only looks at mappings Yk Xk that are orthogonal
projections
• Choice of stress as i<j=1n (ij2- d(Xi , Xj)2)
n
For example there are “better” linear transformations
that add scaling of PCA vectors
Classical MDS: SMACO
Scaling by minimizing a complicated function
n This is a variant of steepest descent approach to minimizing
Stress. One sets two matrices V and B in nL dimensional space (L=2 is dimension of target space of mapping).
• n is number of vectors Yk to be mappe
n Then one can establish a rigorous bound to show that one always
decreases Stress (X) by iteration labeled by t i
More obvious MDS for Clustering or
Mixture Model Mapping
n
The number of parameters in MDS is typically modest as in
simple cases just
2
(dimension of target space)
Number of
Clusters
(or Number of points to be mapped)
n
Thus Newton’s method should work well and it is trivial to
derive first and second order derivatives for
(X)
n
As well as “general” approaches to regularization, one can
enhance convergence by
•
Initializing optimization
with SMACOF iterations
•
Noting that DA clustering algorithm gives us results with
number of clusters increasing by one each time. Thus we
can initialize optimization for n clusters with results
GTM Generative Topographic Mapping
n This addresses a slightly different problem of mapping ALL
points in a high dimensional space. It approaches this by simultaneously clustering in high dimensional space and mapping cluster (centers) to low dimension space
• We ignore clustering and view as a way to getting mapping by
looking at all points in space not just cluster centers
n The key idea is a nonlinear mapping
• Y(k) = m=1M Wmm(X(k))
• m(X) = exp( - 0.5 (X-m)2/2 ) for fixed m and
n Y(k) are cluster centers in high dimensional space which map
from X(k) in lower dimensional space
n If largish compared to separation between basis vectors X(k)
GTM for visualizing 2 Clusters in 155 Dimensions
n Here GTM just
used to visualize.
n Clustering done
separately
n Deliberately “easy”
problem!
n Note although
formal clustering gives 2 clusters
n GTM visualization
uses
n K=225 clusters n M=64 basis
functions
Basic Gaussian Mixture Models
n Mixture models write the probability of a point X(x) a
n And set the Liklihood L = x=1N p(x,) where parameters are centers
Y(k), Probability Pk that point generated by center k and covariance matrix
(k)2
n Expectation Maximization is (from 1977) iterative solution to minimizing –
lnL
n It starts
by estimatin
n And using this to calculate al
the using formulae like:
n Note similarity to deterministic annealing cluster formulae
n Deterministic annealing EM algorithm - N Ueda, R Nakano - Neural Networks, 1998
Cited by 124
n A different approach which does not seem general is in
n Deterministic annealing for density estimation by multivariate normal mixture
DA / EM / DAEM / GTM I
n The General Formula for “F = - lnL” or “Free Energy” F = E-TS is
n Note x is a label and E(x) is data n For Deterministic Annealing
• a(x) = 1/N or generally p(x) with p(x) =1
• g(k)=1
• s(k)=0.5
• T is annealing temperature varied down from with final value of 1
• Vary Y(k) but can calculate Pkand(k) (even for matrix (k)) using IDENTICAL
formulae for Gaussian mixtures; iteration formula identical to Expectation Maximization EM which is steepest descent
• K starts at 1 and is incremented by algorithm
n For traditional Gaussian mixture models simplified to spherical distributions ((k) is
really a k k symmetric correlation matrix)
• a(x) = 1
• g(k) = Pk/(2(k)2)D/2 where space D dimensional • s(k) = (k)2
• T = 1
DA / EM / DAEM / GTM II
n The General Formula for “F = - lnL-TS” isn Note x is a label and E(x) is data
n For Deterministic Annealing Gaussian mixture models simplified
to spherical distributions ((k) is really a DD symmetric correlation matrix)
• a(x) = 1
• g(k)={Pk/(2(k)2)D/2}1/T • s(k)= (k)2
• T is annealing temperature varied down from with final
value of 1
• Vary Y(k) Pk and (k)
DA / EM / DAEM / GTM III
n The General Formula for “F = - lnL” isn Note x is a label and E(x) is data
n For GTM Generative Topographic Mapping
• a(x) = 1
• g(k) = (1/K)( /2)D/2 where space D dimensional • s(k) = 1/
• T = 1
• Y(k) = m=1M Wmm(X(k))
• Fix m(X) = exp( - 0.5 (X-m)2/2 ) but other choices possible • Vary Wm and but fix values of M and K a priori
n Y(k) E(x) Wm are vectors in original high D dimensional space n X(k) and m are vectors in 2 dimensional mapped space
There is presumably a version of GTM using deterministic annealing using either a pure cluster basis – anneal in o
Some links for Parallel Computing
n
See
http://www.connotea.org/user/crmc
for
references
-- select tag
oldies
for venerable links; tags like
MPI
Applications Compiler
have obvious significance
n
h
ttp://www.infomall.org/salsa f
or recent work
including publications
n
My tutorial on parallel computing
Parallel Programming Model
n If multicore technology is to succeed, mere mortals must be able to
build effective parallel programs on commodity machines
n There are interesting new developments – especially the new Darpa
HPCS Languages X10, Chapel and Fortress
n However if mortals are to program the 64-256 core chips expected in 5-7
years, then we must use near term technology and we must make it easy
• This rules out radical new approaches such as new languages
n Remember that the important applications are not scientific computing
but most of the algorithms needed are similar to those explored in scientific parallel computing
n We can divide problem into two parts:
• “Micro-parallelism”: High Performance scalable (in number of
cores) parallel kernels or libraries
• Macro-parallelism: Composition of kernels into complete
applications
n We currently assume that the kernels of the scalable parallel
algorithms/applications/libraries will be built by experts with a
n Broader group of programmers (mere mortals) composing library
Multicore SALSA at CGL
n Service Aggregated Linked Sequential Activities
n Aims to link parallel and distributed (Grid) computing by
developing parallel applications as services and not as programs or libraries
• Improve traditionally poor parallel programming
development environments
n Developing set of services (library) of multicore parallel data
mining algorithms
n Looking at Intel list of algorithms (and all previous experience),
we find there are two styles of “micro-parallelism”
• Dynamic search as in integer programming, Hidden Markov Methods
(and computer chess); irregular synchronization with dynamic threads
• “MPI Style” i.e. several threads running typically in SPMD (Single
Program Multiple Data); collective synchronization of all threads together
n Most Intel RMS are “MPI Style” and very close to scientific
Scalable Parallel Components
n How do we implement micro-parallelism?n There are no agreed high-level programming environments for
building library members that are broadly applicable.
n However lower level approaches where experts define
parallelism explicitly are available and have clear performance models.
n These include MPI for messaging or just locks within a single
shared memory.
n There are several patterns to support here including the
collective synchronization of MPI, dynamic irregular thread parallelism needed in search algorithms, and more specialized cases like discrete event simulation.
n We use Microsoft CC
There is MPI style messaging and ..
n OpenMP annotation or Automatic Parallelism of existing
software is practical way to use those pesky cores with existing code
• As parallelism is typically not expressed precisely, one needs luck to get
good performance
• Remember writing in Fortran, C, C#, Java … throws away information
about parallelism
n HPCS Languages should be able to properly express parallelism
but we do not know how efficient and reliable compilers will be
• High Performance Fortran failed as language expressed a subset of
parallelism and compilers did not give predictable performance
n PGAS (Partitioned Global Address Space) like UPC, Co-array
Fortran, Titanium, HPJava
• One decomposes application into parts and writes the code for each
component but use some form of global index
• Compiler generates synchronization and messaging
• PGAS approach should work but has never been widely used – presumably
Summary of micro-parallelism
n
On
new applications
, use MPI/locks with explicit
user decomposition
n
A subset of applications can use “
data parallel
”
compilers which follow in HPF footsteps
•
Graphics Chips and Cell processor motivate such
special compilers but not clear how many
applications can be done this way
n
OpenMP and/or Compiler-based Automatic
Composition of Parallel Components
n The composition (macro-parallelism) step has many excellent solutions
as this does not have the same drastic synchronization and correctness constraints as one has for scalable kernels
• Unlike micro-parallelism step which has no very good solutions
n Task parallelism in languages such as C++, C#, Java and Fortran90; n General scripting languages like PHP Perl Python
n Domain specific environments like Matlab and Mathematica n Functional Languages like MapReduce, F#
n HeNCE, AVS and Khoros from the past and CCA from DoE
n Web Service/Grid Workflow like Taverna, Kepler, InforSense KDE,
Pipeline Pilot (from SciTegic) and the LEAD environment built at Indiana University.
n Web solutions like Mash-ups and DSS
n Many scientific applications use MPI for the coarse grain composition
as well as fine grain parallelism but this doesn’t seem elegant
n The new languages from Darpa’s HPCS program support task
parallelism (composition of parallel components) decoupling
Integration of Services and “MPI”/Threads
n Kernels and Composition must be supported both inside chips (the multicore
problem) and between machines in clusters (the traditional parallel computing problem) or Grids.
n The scalable parallelism (kernel) problem is typically only interesting on true
parallel computers (rather than grids) as the algorithms require low communication latency.
n However composition is similar in both parallel and distributed scenarios and
it seems useful to allow the use of Grid and Web composition tools for the parallel problem.
• This should allow parallel computing to exploit large investment in service
programming environments
n Thus in SALSA we express parallel kernels not as traditional libraries but as
(some variant of) services so they can be used by non expert programmers
n Bottom Line: We need a runtime that supports inter-service linkage and
micro-parallelism linkage
n CCR and DSS have this property
• Does it work and what are performance costs of the universality of
runtime?
• Messaging need not be explicit for large data sets inside multicore node.