Skip to content

Commit

Permalink
Update feature_engineering.py
Browse files Browse the repository at this point in the history
  • Loading branch information
JaeheeRyu authored Jun 8, 2021
1 parent f4f940e commit 004a5dd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions feature_engineering.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def question_class(df):


def KnowledgeTag_relative(df):
df.reset_index(drop=True, inplace=True)
# KnowledgeTag별 누적 풀이 수, 정답 수, 정답률
df_KnowledgeTag = df.sort_values(by=["KnowledgeTag", "Timestamp"])
df['KnowledgeTag_total_answer'] = df_KnowledgeTag.groupby("KnowledgeTag")["answerCode"].cumcount()
Expand All @@ -144,6 +145,7 @@ def KnowledgeTag_relative(df):


def assessmentItemID_relative(df):
df.reset_index(drop=True, inplace=True)
# assessmentItemID별 누적 풀이 수, 정답 수, 정답률
df_assessmentItemID = df.sort_values(by=["assessmentItemID", "Timestamp"])
df['assessmentItemID_total_answer'] = df_assessmentItemID.groupby("assessmentItemID")["answerCode"].cumcount()
Expand Down Expand Up @@ -280,6 +282,7 @@ def userID_elapsed_normalize(df):


def lda_feature(df):
df.reset_index(drop=True, inplace=True)
if 'assessmentItemID_total_answer' not in df.columns:
df = assessmentItemID_relative(df)
if 'KnowledgeTag_total_answer' not in df.columns:
Expand Down

0 comments on commit 004a5dd

Please sign in to comment.