Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check_point 函数在合并分段的时候有一个错误 #5

Open
paleylouie opened this issue Jun 3, 2018 · 0 comments
Open

check_point 函数在合并分段的时候有一个错误 #5

paleylouie opened this issue Jun 3, 2018 · 0 comments

Comments

@paleylouie
Copy link

paleylouie commented Jun 3, 2018

check_point 函数在合并分段的时候有一个错误,
feature_process.py 112行这里:
pdf = df[(df[var] > split[i]) & (df[var] <= split[i+1])]
没有考虑到相邻的split中的sample数量都少于min_sample,但是合起来又大于min_sample的情况。
可以改为:

pre_left_position = float('-inf') # a value to remember the left point of the segmentation
for i in range(-1,split.__len__()-1):
    pdf = df[(df[var] > pre_left_position) & (df[var] <= split[i+1])]
    if (pdf.shape[0] < min_sample) or (np.unique(pdf['target']).__len__()<=1):
        #print(var, pre_left_position, i, "continue")
        continue
    else:
        new_split.append(split[i+1])
        pre_left_position = split[i+1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant