CoolFace
Apppublic

GIZ/Development-Project-Synergy-Finder

sourceHugging Facemitupdated 4mo agoView on Hugging Face
2likes
single_project_matching.cpython-311.pyc24 linesDownload Raw Back to __pycache__
12`fX��"�ddlZddlmZ	d�ZdS)�N)�3csr_matrixc����t|t��st|��}|j���}|dd�|f}d�t	|��D���|�|��������}tj	|��|d�ddd�}�fd�|D��}||}	|j4|}5|	|6d<|7|8ddk}9|10S)z�11    p_index: index of selected project12    similarity_matrix: matrix with similarities of all projects13    filtered_df: df with filter applied14    top_x: top x project which should be displayed15    Nc��i|]\}}||��	S�r)�.0�position�indexs   ��C:\Users\wagner_ann1\OneDrive - Deutsche Gesellschaft für Internationale Zusammenarbeit (GIZ) GmbH\Dokumente\GitHub\eb-synergy-app\functions\single_project_matching.py�16<dictcomp>z find_similar.<locals>.<dictcomp>s��a�a�a�/�(�E�h��a�a�a������c� ��g|]17}�|��Srr)r�i�index_position_mappings  �r1819<listcomp>z find_similar.<locals>.<listcomp>$s���E�E�E��)�!�,�E�E�Er�20similarityr)�21isinstancerr	�tolist�	enumerate�getrow�toarray�ravel�np�argsort�loc)�p_index�similarity_matrix�filtered_df�top_x�filtered_indices�filtered_column_sim_matrix�project_row�sorted_indices�top_indices�22top_values�	result_dfrs           @r23�find_similarr's����'��4�4�:�&�'8�9�9��$�)�0�0�2�2��!2�1�1�1�6F�3F�!G��b�a�Y�O_�E`�E`�a�a�a��-�3�3�G�<�<�D�D�F�F�L�L�N�N�K��Z��,�,�e�V�W�W�5�d�d��d�;�N�E�E�E�E�n�E�E�E�K��^�,�J����,�I�(�I�l���)�L�1�A�5�6�I��r)�numpyr�scipy.sparserr'rrr24�<module>r*sA������#�#�#�#�#�#��"�"�"�"�"r