‘넘파이’는 모든 곳에 존재한다. 그것은 우리 주변에 있다. 심지어 지금 이 방에도 존재한
다. 창문 밖을 보거나
TV
를 켜면 그것을 볼 수 있다. 일할 때나, 교회에 갈 때, 세금 낼 때
도 느낄 수 있다.
- 모피어스, 영화 <매트릭스> 등장인물
이 장은 사이파이의 일부 통계 함수를 다룬다. 그리고 이보다 더 중요한 넘파이 배열을 집중해
서 다룬다. 넘파이 배열은 파이썬에서 수치 과학 계산의 기초가 되는 자료구조다. 숫자 데이터
를 조작하는 넘파이 배열 연산으로 간결하고 효율적인 코드를 작성해보자.
이 장의 예제는
TCGA
The
Cancer
Genome
Atlas
프로젝트의 유전자 발현
gene
expression
데이터를 사용하
여 피부암 환자의 사망률을 추정한다. 예제와 함께 사이파이의 핵심 개념 일부를
1
장과
2
장에
서 살펴본다. 사망률을 추정하기 전에
RPKM
1
을 사용하여 데이터를 정규화한다.
RPKM
정규
화는 다른 샘플과 유전자 사이의 측정값을 비교할 수 있게 해준다(‘유전자 발현’의 의미를 풀어
낸다).
먼저 간단한 코드를 살펴보자. 이 책의 각 장은 사이파이의 우아한 함수의 코드 샘플로 시작한
다. 다음 코드는 넘파이의 벡터 및 브로드캐스팅을 강조하여 데이터 배열을 효율적으로 조작하
고 추론한다.
1
역주_ ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.