## 문제 urllib3 을 사용할 때, 다음과 같은 에러가 발생하면서 python 스크립트가 실행되지 않는다. ``` ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2k-fips 26 Jan 2017'. See: https://github.com/urllib3/urllib3/issues/2168 ``` 원인을 파악해보고자 구글링을 하니 다음과 같은 공식 가이드와 짤막한 해결방안이 있었다. 요약하면, urllib3 부터는 OpenSSL 1.1.1+ 버전만을 지원하므로, 서버에 설치되어 있는 openssl 버전을 업그레이드 하여야 한다. 제공된 가이드의 경우 RHEL7 의 경우 os 업그레이드를 하라는 배보다 배꼽이 다소 더 큰 가이드를 하고 있다. [https://urllib3.readthedocs.io/en/latest/v2-migration-guide.html#common-upgrading-issues](https://urllib3.readthedocs.io/en/latest/v2-migration-guide.html#common-upgrading-issues) ## 해결방안 python 을 업그레이드한 openssl 을 연동해서 직접 컴파일하여 설치해보자. (아래의 [stackoverflow 글](https://stackoverflow.com/questions/69371800/how-to-link-python3-to-use-openssl11-or-latest-version-of-openssl-1-1-1-on-c)을 참고하였습니다.) ### OpenSSL 설치 ``` # Install OpenSSL 1.1.1 cd /opt curl https://ftp.openssl.org/source/old/1.1.1/openssl-1.1.1o.tar.gz --output openssl.tar.gz tar xzf openssl.tar.gz rm openssl.tar.gz cd openssl-1.1.1o/ # --prefix 경로에 openssl 을 설치합니다. ./config --prefix=/opt/openssl && make && make install ``` #### 설치 경로를 포함한 OpenSSL 버전 확인 ``` openssl version -d ``` ### 특정 OpenSSL 을 연동하여 python 설치 ``` # Install Python 3.8.18 cd /opt wget https://www.python.org/ftp/python/3.8.18/Python-3.8.18.tgz tar xzf Python-3.8.18.tgz cd Python-3.8.18 # 아까 설치했던 openssl 경로를 입력합니다. ./configure --with-openssl=/opt/openssl # build and install make make altinstall ``` ## 확인 ``` python3.8 > import ssl > ssl.OPENSSL_VERSION 'OpenSSL 1.1.1o 14 Dec 2021' ``` ### 참조 - [https://stackoverflow.com/questions/69371800/how-to-link-python3-to-use-openssl11-or-latest-version-of-openssl-1-1-1-on-c](https://stackoverflow.com/questions/69371800/how-to-link-python3-to-use-openssl11-or-latest-version-of-openssl-1-1-1-on-c)
> https://amitness.com/posts/information-retrieval-evaluation 글을 읽고 정리한 문서입니다. ## 지표의 목적 상위 N 결과가 얼마나 우수한지 어떻게 평가할 것 인가? ### Binary relevance - 문서에 대한 관련성을 `있다 / 없다` 로만 판단한다. - 현재 Ranking model 이 query 에 대해서 5개의 각각의 문서 관련도는 `[1, 0, 1, 0, 1]` 로 나타낼 수 있다. (*binary*) ## Order-unaware metrics ### Precision@k $$ Precision@k = \frac{ true\ positives@k}{(true\ positives@k) + (false\ positives@k)} $$ - 이 메트릭은 상위 K 결과의 관련 항목 수를 정량화합니다. - 추출된 k 랭크 문서 중에서 관련 있는 문서의 갯수 예시) *Precision@2* ### Recall@k $$ Recall@k = \frac{ true\ positives@k}{(true\ positives@k) + (false\ negatives@k)} $$ - 이 메트릭은 쿼리에 대한 모든 실제 관련 결과 중에서 몇 개의 실제 관련 결과가 표시되었는지 알려줍니다. - 전체 관련 있는 문서 갯수 중에서 k 랭크 내에 추출된 관련 있는 문서의 갯수 예시) *Recall@2* ### 참고: Precision 과 Recall 의 집합관계 - A = 모델에서 문서가 관련 있다고 예측한 영역 (예측) - B = 실제 관련 있는 문서가 있는 영역 (정답) - b 영역 = True Positive 로 모델이 추출한 관련 문서 중 실제 관련 있는 문서가 있었던 영역 모델이 반환한 결과 중에서 실제 관련도 있는 문서를 추출한 비율이 precision, 실제 관련 있는 문서 목록 중 model 이 올바르게 문서를 추출한 비율이 recall 이라고 할 수 있다...
댓글
댓글 쓰기