d257ce051723c78bdf3f6c5e9387f1f7f54dd7a5,bt/algos.py,Rebalance,__call__,#Rebalance#Any#,1211

Before Change


        targets = target.temp["weights"]

        // de-allocate children that are not in targets
        not_in = [x for x in target.children if x not in targets]
        for c in not_in:
            target.close(c)

        // save value because it will change after each call to allocate

After Change



        // de-allocate children that are not in targets and have non-zero value
        // (open positions)
        for cname in target.children:
            // if this child is in our targets, we don"t want to close it out
            if cname in targets:
                continue

            // get child and value
            c = target.children[cname]
            v = c.value
            // if non-zero and non-null, we need to close it out
            if v != 0. and not np.isnan(v):
                target.close(cname)

        // save value because it will change after each call to allocate
        // use it as base in rebalance calls
        base = target.value
        for item in iteritems(targets):
            target.rebalance(item[1], child=item[0], base=base)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 12

Instances


Project Name: pmorissette/bt
Commit Name: d257ce051723c78bdf3f6c5e9387f1f7f54dd7a5
Time: 2016-04-09
Author: morissette.philippe@gmail.com
File Name: bt/algos.py
Class Name: Rebalance
Method Name: __call__


Project Name: ruotianluo/ImageCaptioning.pytorch
Commit Name: 8bf6fdc8160d8e6150a0b7211b5ee41496331057
Time: 2019-04-27
Author: rluo@ttic.edu
File Name: eval_ensemble.py
Class Name:
Method Name: