Update predefined.py
Browse files- predefined.py +11 -7
predefined.py
CHANGED
|
@@ -475,8 +475,9 @@ def ldr_new(I,B,M,N_df,WT,batch_size=32):
|
|
| 475 |
return(dt_ldr)
|
| 476 |
|
| 477 |
|
| 478 |
-
|
| 479 |
-
|
|
|
|
| 480 |
|
| 481 |
df=pd.DataFrame()
|
| 482 |
for i in range(batch_num):
|
|
@@ -486,17 +487,22 @@ def get_output_new(w,wt,I_b=n_Identities,B_b=n_Behaviors,M_b=n_Modifiers,batch_s
|
|
| 486 |
if wt=='identity':
|
| 487 |
df_identity=pd.concat([Identities,new_df],axis=0)
|
| 488 |
df2=out_df(data=q,predictions=preds,df_ident=df_identity)
|
|
|
|
|
|
|
|
|
|
| 489 |
|
| 490 |
if wt=='behavior':
|
| 491 |
df_behavior=pd.concat([Behaviors,new_df],axis=0)
|
| 492 |
df2=out_df(data=q,predictions=preds,df_beh=df_behavior)
|
| 493 |
-
|
|
|
|
| 494 |
if wt=='modifier':
|
| 495 |
df_modifier=pd.concat([Modifiers,new_df],axis=0)
|
| 496 |
df2=out_df(data=q,predictions=preds,df_mod=df_modifier)
|
| 497 |
-
|
|
|
|
| 498 |
df=pd.concat([df,df2],axis=0)
|
| 499 |
-
return(df)
|
| 500 |
|
| 501 |
def gen_new(Identity,Behavior,Modifier,n_df,word_type):
|
| 502 |
if word_type=='identity':
|
|
@@ -614,5 +620,3 @@ def freeze_header(df, num_rows=30, num_columns=10, step_rows=1,
|
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
-
cols=['EEMA', 'EPMA', 'EAMA', 'EEA', 'EPA', 'EAA', 'EEB', 'EPB', 'EAB',
|
| 618 |
-
'EEMO', 'EPMO', 'EAMO', 'EEO', 'EPO', 'EAO', 'ModA', 'Actor', 'Behavior', 'ModO', 'Object']
|
|
|
|
| 475 |
return(dt_ldr)
|
| 476 |
|
| 477 |
|
| 478 |
+
cols=['EEMA', 'EPMA', 'EAMA', 'EEA', 'EPA', 'EAA', 'EEB', 'EPB', 'EAB',
|
| 479 |
+
'EEMO', 'EPMO', 'EAMO', 'EEO', 'EPO', 'EAO', 'ModA', 'Actor', 'Behavior', 'ModO', 'Object']
|
| 480 |
+
def get_output_new(w,wt,I_b=n_Identities,B_b=n_Behaviors,M_b=n_Modifiers,batch_sz=300,batch_num=1,columnss=cols,cus_col=1):
|
| 481 |
|
| 482 |
df=pd.DataFrame()
|
| 483 |
for i in range(batch_num):
|
|
|
|
| 487 |
if wt=='identity':
|
| 488 |
df_identity=pd.concat([Identities,new_df],axis=0)
|
| 489 |
df2=out_df(data=q,predictions=preds,df_ident=df_identity)
|
| 490 |
+
if cus_col:
|
| 491 |
+
cols=[ 'EEA', 'EPA', 'EAA', 'ModA', 'Actor', 'Behavior', 'ModO', 'Object']
|
| 492 |
+
|
| 493 |
|
| 494 |
if wt=='behavior':
|
| 495 |
df_behavior=pd.concat([Behaviors,new_df],axis=0)
|
| 496 |
df2=out_df(data=q,predictions=preds,df_beh=df_behavior)
|
| 497 |
+
if cus_col:
|
| 498 |
+
cols=['EEB', 'EPB', 'EAB', 'ModA', 'Actor', 'Behavior', 'ModO', 'Object']
|
| 499 |
if wt=='modifier':
|
| 500 |
df_modifier=pd.concat([Modifiers,new_df],axis=0)
|
| 501 |
df2=out_df(data=q,predictions=preds,df_mod=df_modifier)
|
| 502 |
+
if cus_col:
|
| 503 |
+
cols=['EEMA', 'EPMA', 'EAMA', 'ModA', 'Actor', 'Behavior', 'ModO', 'Object']
|
| 504 |
df=pd.concat([df,df2],axis=0)
|
| 505 |
+
return(df[columnss)
|
| 506 |
|
| 507 |
def gen_new(Identity,Behavior,Modifier,n_df,word_type):
|
| 508 |
if word_type=='identity':
|
|
|
|
| 620 |
|
| 621 |
|
| 622 |
|
|
|
|
|
|