[1.16更新B14特征处理]津南数字制造题目解读及部分思路~~有趣的特征
首先声明,我并不能保证这些特征可以上分,每个人处理方式不同结果肯定不一样。
大家也最好不要私聊私下讨论方案。感觉不太好,其实大家一般问我的,我回复的内容都是我自己乱想的,基本没测过。
处理的步骤和思路都在图和代码里了,应该是还有其他操作的,这种思路小伙伴们可以参考参考。
代码:
<predejavu sans="" mono';font-size:15.0pt;"="">train = train[train['<spanar pl="" ukai="" cn';"="">收率'] > 0.87]
print(len(train))
train.loc[train['B14'] == 40, 'B14'] = 400
train = train[train['B14']>=400]
print(len(train))
train = train[good_cols]
good_cols.remove('<spanar pl="" ukai="" cn';"="">收率')
test = test[good_cols]
test_select = {}
for v in [280, 385, 390, 785]:
print(v)
print(test[test['B14'] == v]['<spanar pl="" ukai="" cn';"="">样本id'])
test_select[v] = test[test['B14'] == v]['<spanar pl="" ukai="" cn';"="">样本id'].index
print(test[test['B14'] == v]['<spanar pl="" ukai="" cn';"="" data-spm-anchor-id="">样本id'].index)
print(test_select[v])</spanar></spanar></spanar></spanar></spanar></predejavu>
<predejavu sans="" mono';font-size:15.0pt;"=""><spanar pl="" ukai="" cn';"=""><spanar pl="" ukai="" cn';"=""><spanar pl="" ukai="" cn';"=""><spanar pl="" ukai="" cn';"=""><spanar pl="" ukai="" cn';"="">
</spanar></spanar></spanar></spanar></spanar></predejavu>
<predejavu sans="" mono';font-size:15.0pt;"=""><spanar pl="" ukai="" cn';"=""><spanar pl="" ukai="" cn';"=""><spanar pl="" ukai="" cn';"=""><spanar pl="" ukai="" cn';"=""><spanar pl="" ukai="" cn';"=""><predejavu sans="" mono';font-size:15.0pt;"="">for v in test_select.keys():
if v == 280:
x = 0.947
elif v == 385 or v == 785:
x = 0.879
elif v == 390:
x = 0.89
print(v)
print(test_select[v])
# sub_df.iloc[test_select[v]][1] = x
sub_df.loc[test_select[v], 1] = x</predejavu>
</spanar></spanar></spanar></spanar></spanar></predejavu>
Motivation
那我们怎么操作才能找到对比实验呢???
如何构造相关特征呢?
all = all.sort_values(keep_col, ascending=True)
all['b14_div_a1_a2_a3_a4_a19_b1b2_b12b13'] = all['B14']/(all['A1']+all['A2']+all['A3']+all['A4']+all['A19']+all['B1']*all['B2']+all['B12']*all['B13'])
# all.loc[all['B14']<=360, 'B14'] = all['B14']+140
ids = all['样本id'].values
all_copy_previous_row = all[copy_col].copy()
all_copy_previous_row['time_mean'] = all_copy_previous_row[['B9','B10','B11']].std(axis=1)
all_copy_previous_row.drop(['B9','B10','B11'], axis=1, inplace=True)
all_copy_previous_row = all_copy_previous_row.diff(periods=1)
all_copy_previous_row.columns = [col_+'_difference'+'_previous' for col_ in all_copy_previous_row.columns.values]
all_copy_following_row['time_mean'] = all_copy_following_row[['B9','B10','B11']].std(axis=1)
all_copy_following_row.drop(['B9','B10','B11'], axis=1, inplace=True)
all_copy_following_row = all_copy_following_row.diff(periods=-1)
all_copy_following_row.columns = [col_+'_difference'+'_following' for col_ in all_copy_following_row.columns.values]
# all_copy_following_row['样本id_difference_following'] = all_copy_following_row['样本id_difference_following'].abs()
all_copy_following_row['样本id'] = list(ids)