Spaces:
Sleeping
Sleeping
Jimin Park
commited on
Commit
·
0e5818e
1
Parent(s):
0093d11
kermitting soon
Browse files- util/helper.py +7 -5
util/helper.py
CHANGED
@@ -903,16 +903,16 @@ def calculate_role_specialization(df):
|
|
903 |
def calculate_champion_loyalty(df):
|
904 |
print("========================== Inside: calculate_champion_loyalty ====================\n")
|
905 |
df = df.copy()
|
906 |
-
print("df.dtypes: ", df.dtypes, "\n")
|
907 |
|
908 |
|
909 |
def get_loyalty_scores(row):
|
910 |
try:
|
911 |
# Convert potentially non-numeric values to numbers !!!!!!!!!!!!!! chatGPT EDITED
|
912 |
-
row['W_1'] = pd.to_numeric(row['W_1'], errors='coerce') if 'W_1' in row else 0
|
913 |
-
row['L_1'] = pd.to_numeric(row['L_1'], errors='coerce') if 'L_1' in row else 0
|
914 |
-
row['W_2'] = pd.to_numeric(row['W_2'], errors='coerce') if 'W_2' in row else 0
|
915 |
-
row['L_2'] = pd.to_numeric(row['L_2'], errors='coerce') if 'L_2' in row else 0
|
916 |
|
917 |
# Get champions lists, handle potential NaN/None values (only top 2)
|
918 |
recent_champs = [
|
@@ -950,6 +950,7 @@ def calculate_champion_loyalty(df):
|
|
950 |
}
|
951 |
|
952 |
# Calculate games played for recent champions (only top 2)
|
|
|
953 |
recent_games = [
|
954 |
(row['W_1'] + row['L_1']) if pd.notna(row['most_champ_1']) else 0,
|
955 |
(row['W_2'] + row['L_2']) if pd.notna(row['most_champ_2']) else 0
|
@@ -983,6 +984,7 @@ def calculate_champion_loyalty(df):
|
|
983 |
|
984 |
loyalty_score += combined_weight
|
985 |
|
|
|
986 |
# Calculate confidence score (adjusted for 2 champions)
|
987 |
confidence_score = 0
|
988 |
confidence_score += 0.5 if pd.notna(row['most_champ_1']) else 0 # Increased weight for main
|
|
|
903 |
def calculate_champion_loyalty(df):
|
904 |
print("========================== Inside: calculate_champion_loyalty ====================\n")
|
905 |
df = df.copy()
|
906 |
+
print("df.dtypes: \n", df.dtypes, "\n")
|
907 |
|
908 |
|
909 |
def get_loyalty_scores(row):
|
910 |
try:
|
911 |
# Convert potentially non-numeric values to numbers !!!!!!!!!!!!!! chatGPT EDITED
|
912 |
+
# row['W_1'] = pd.to_numeric(row['W_1'], errors='coerce') if 'W_1' in row else 0
|
913 |
+
# row['L_1'] = pd.to_numeric(row['L_1'], errors='coerce') if 'L_1' in row else 0
|
914 |
+
# row['W_2'] = pd.to_numeric(row['W_2'], errors='coerce') if 'W_2' in row else 0
|
915 |
+
# row['L_2'] = pd.to_numeric(row['L_2'], errors='coerce') if 'L_2' in row else 0
|
916 |
|
917 |
# Get champions lists, handle potential NaN/None values (only top 2)
|
918 |
recent_champs = [
|
|
|
950 |
}
|
951 |
|
952 |
# Calculate games played for recent champions (only top 2)
|
953 |
+
print("Start calculate games played for recent champions (only top 2)...\n")
|
954 |
recent_games = [
|
955 |
(row['W_1'] + row['L_1']) if pd.notna(row['most_champ_1']) else 0,
|
956 |
(row['W_2'] + row['L_2']) if pd.notna(row['most_champ_2']) else 0
|
|
|
984 |
|
985 |
loyalty_score += combined_weight
|
986 |
|
987 |
+
print("Start calculate confidence score...\n")
|
988 |
# Calculate confidence score (adjusted for 2 champions)
|
989 |
confidence_score = 0
|
990 |
confidence_score += 0.5 if pd.notna(row['most_champ_1']) else 0 # Increased weight for main
|