fb50688c503567c5db6207e45e2c5e2ee1ad33df,tgen/features.py,,depth,#,41
Before Change
nodes = scope_func(cur_node, incremental=incremental)
if nodes:
return {"": max(node.get_depth() for node in nodes)}
return {"": 0}
After Change
depths = {} // store nodes that we"ve already processed
max_depth = 0
for node_id in xrange(len(tree)):
pos = node_id
depth = 0
// go up to the root / an already processed node
while tree.parents[pos] >= 0 and pos not in depths:
depth += 1
pos = tree.parents[pos]
if pos in depths: // processed node: add its depth
depth += depths[pos]
// store the depth to save computation
depths[node_id] = depth
if depth > max_depth:
max_depth = depth
return {"": max_depth}
def max_children(tree, context):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 11
Instances
Project Name: UFAL-DSG/tgen
Commit Name: fb50688c503567c5db6207e45e2c5e2ee1ad33df
Time: 2014-08-25
Author: odusek@ufal.mff.cuni.cz
File Name: tgen/features.py
Class Name:
Method Name: depth
Project Name: EpistasisLab/scikit-rebate
Commit Name: ece383696800b9b34854df27a65a3d1d74669952
Time: 2020-05-28
Author: alexmxu@alexs-mbp-3.attlocal.net
File Name: skrebate/iterrelief.py
Class Name: IterRelief
Method Name: fit
Project Name: EpistasisLab/scikit-rebate
Commit Name: 163eb7df13667e21b0e02a2706e18d1f53eee610
Time: 2020-01-29
Author: alexmxu99@gmail.com
File Name: skrebate/iterrelief.py
Class Name: IterRelief
Method Name: fit