Skip to content

Commit

Permalink
adjusted add_noise_to_array to make the scale 0 to 1 more intuitive
Browse files Browse the repository at this point in the history
  • Loading branch information
BAAAKA committed Oct 29, 2023
1 parent 7f0868b commit 1b3d287
Show file tree
Hide file tree
Showing 2 changed files with 291 additions and 229 deletions.
6 changes: 3 additions & 3 deletions functions/matching_users.py
Expand Up @@ -27,15 +27,15 @@ def add_noise_to_array(arr, noise_factor):
elif noise_factor == 0:
return arr
noise = np.random.uniform(0, noise_factor, arr.shape)
noisy_array = arr + noise
noisy_array = np.clip(noisy_array, 0, 1)
noise = (noise + noise.T) / 2
noisy_array = arr*(1-noise_factor) + noise
return noisy_array

def get_preference_lists(user_ids, preference_matrix):
check_input(user_ids, preference_matrix)

user_preferences = cosine_similarity(preference_matrix)
user_preferences = add_noise_to_array(user_preferences, 0) # ADJUST NOISE HERE
user_preferences = add_noise_to_array(user_preferences, 1) # ADJUST NOISE HERE

get_sorted_list = get_sorted_list_func(user_ids, user_preferences)
return [get_sorted_list(user_index) for user_index in range(len(user_ids))]
Expand Down

0 comments on commit 1b3d287

Please sign in to comment.