Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions createDB/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ def get_tour_courses(character_type):
course_info['cat3'] = expand_cat3_ranges(course_info['cat3_ranges'])
return course_info


# 소분류 우선 만약 소분류로 했을때 결과가 없으면 중분류까지 감
def filter_courses_by_preference(tour_courses, cat3_list, cat2_list):
# 소분류 코드(cat3)로 필터링
Expand All @@ -261,6 +262,7 @@ def filter_courses_by_preference(tour_courses, cat3_list, cat2_list):
return filtered_courses



# 거리 계산 - 코스 추천시 코스별 거리가 멀면 안되기에
def filter_courses_by_distance(courses, base_location, max_distance=1.0):
filtered_courses = []
Expand Down Expand Up @@ -432,12 +434,14 @@ def create_weighted_list(preferences):
weighted_list.extend([keywords[i]] * weight)
return weighted_list


# 코사인 유사도 계산
def calculate_cosine_similarity(group1, group2):
group1_vector = np.array([group1])
group2_vector = np.array([group2])
return cosine_similarity(group1_vector, group2_vector)[0][0]


# 유사한 그룹 찾기
def find_similar_group(current_group_preferences, groups_data):
max_similarity = float('-inf')
Expand Down
6 changes: 3 additions & 3 deletions groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"pk": 1,
"fields": {
"people_num": 3,
"tour_type": "������ ����",
"tour_type": "힐링형 감자",
"group_name": "group1"
}
},
Expand All @@ -13,7 +13,7 @@
"pk": 2,
"fields": {
"people_num": 3,
"tour_type": "��Ƽ��Ƽ�� ������",
"tour_type": "액티비티형 옥수수",
"group_name": "group2"
}
},
Expand All @@ -22,7 +22,7 @@
"pk": 3,
"fields": {
"people_num": 4,
"tour_type": "������ ����",
"tour_type": "관람형 배추",
"group_name": "group3"
}
}
Expand Down