Skip to Content
밑바닥부터 시작하는 딥러닝
book

밑바닥부터 시작하는 딥러닝

by 사이토 고키, 개앞맵시(이복연)
January 2017
Beginner to intermediate
312 pages
7h 3m
Korean
Hanbit Media, Inc.
Content preview from 밑바닥부터 시작하는 딥러닝
70
밑바닥부터 시작하는 딥러닝
>>>
import numpy as np
>>>
x
=
np
.
array
([-
1
.
0
,
1
.
0
,
2
.
0
])
>>>
x
array
([-
1
.,
1
.,
2
.])
>>>
y
=
x
>
0
>>>
y
array
([
False
,
True
,
True
],
dtype
=
bool
)
넘파이 배열에 부등호 연산을 수행하면 배열의 원소 각각에 부등호 연산을 수행한
bool
배열
이 생성됩니다. 이 예에서는 배열
x
의 원소 각각이
0
보다 크면
True
로,
0
이하면
False
로 변
환한 새로운 배열
y
가 생성됩니다.
이
y
는
bool
배열입니다. 그런데 우리가 원하는 계단 함수는
0
이나
1
의 ‘
int
형’을 출력하는 함
수죠. 그래서 배열
y
의 원소를
bool
에서
int
형으로 바꿔줍니다.
>>>
y
=
y
.
astype
(
np
.
int
)
>>>
y
array
([
0
,
1
,
1
])
이처럼 넘파이 배열의 자료형을 변환할 때는
astype
( ) 메서드를 이용합니다. 원하는 자료형
(이 예에서는
np
.
int
)을 인수로 지정하면 되죠. 그리고 파이썬에서는
bool
을
int
로 변환하면
True
는
1
로,
False
는
0
으로 변환됩니다. 이상이 계단 함수 구현에서 사용한 넘파이의 ‘트릭’이
었습니다.
3.2.3
계단 함수의 그래프
이제 앞에서 정의한 계단 함수를 그래프로 그려봅시다. 이를 위해
matplotlib ...
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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’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
QuotationMarkI 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
QuotationMarkI’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
QuotationMarkI'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.
Mark W.
Embedded Software Engineer

You might also like

밑바닥부터 시작하는 비트코인

밑바닥부터 시작하는 비트코인

류정필, 송재준
엑셀이 편해지는 파이썬

엑셀이 편해지는 파이썬

펠릭스 춤슈타인

Publisher Resources

ISBN: 9788968484636