Pruning functionality
Description
In the old version of icet
we worked already quite a bit with pruning of CEs. At that time though the functionality had to be written almost entirely outside icet
and the integration into icet
was clumsy and fragile. We are now in a position to do this much more elegantly, stable, and easier.
I can imagine that pruning could be carried out by using something along the following (pseudo code) line(s)
eci_avg, eci_sdv = optimizer.get_parameters(stddev=True) # anticipating functionality of a future EnsembleOptimizer
ce = ClusterExpansion(eci_avg)
ce.prune(np.abs(eci_avg) < eci_sdv) # condition for pruning as Numpy array of booleans
Internally, the prune
function would then loop over the orbits/ECIs and for each orbit/ECI for which the pruning condition is fulfilled
- call a (not yet existing) function of
ClusterSpace
to remove the orbit from the list of orbits and - delete the respective element of the
parameters
vector.
Note 1: To me it appears that ClusterSpace
is a suitable and appropriate location for this functionality (as opposed to e.g., a separate module). This is something to be discussed.
Note 2: The approach outlined above raises the question whether ClusterExpansion
ought to maintain a copy or a reference of both the underlying ClusterSpace
object and the parameters
list/vector. In the case of e.g., pruning the use of references would lead to side effects that in general are highly undesirable. Hence using copies appears to me the way to go, while at present we use references. The latter come with some (very small) memory savings but at the moment I cannot remember whether there were/are other reasons for keeping a reference.
Demonstration
- a new
prune
function must be implemented incluster_space.py
as part ofClusterSpace
- the C++
ClusterSpace
class must implement and expose (viaPyBindings.cpp
) a function for removing an orbit from the list of orbits; possibly this requires some further changes in related parts of the C++ code - the unit test for
ClusterSpace
must be updated to include the new functionality - new example in
examples
that illustrate the use of the functionality along with a page in the user guide
Sub-tasks
-
implement ClusterSpace.prune()
function -
implement a function for removing an orbit from the C++ ClusterSpace
class -
expose this function via PyBindings.cpp
-
update the unit test for ClusterSpace
-
add an example to examples
-
integrate the example in the user guide