Skip to Content
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
Explore Skills
Cloud Computing
Microsoft Azure
Amazon Web Services (AWS)
Google Cloud
Cloud Migration
Cloud Deployment
Cloud Platforms
Data Engineering
Data Warehouse
SQL
Apache Spark
Microsoft SQL Server
MySQL
Kafka
Data Lake
Streaming & Messaging
NoSQL Databases
Relational Databases
Data Science
Pandas
R
MATLAB
SAS
D3
Power BI
Tableau
Statistics
Exploratory Data Analysis
Data Visualization
AI & ML
Generative AI
Machine Learning
Artificial Intelligence (AI)
Deep Learning
Reinforcement Learning
Natural Language Processing
TensorFlow
Scikit-Learn
Hyperparameter Tuning
MLOps
Programming Languages
Java
JavaScript
Spring
Python
Go
C#
C++
C
Swift
Rust
Functional Programming
Software Architecture
Object-Oriented
Distributed Systems
Domain-Driven Design
Architectural Patterns
IT/Ops
Kubernetes
Docker
GitHub
Terraform
Continuous Delivery
Continuous Integration
Database Administration
Computer Networking
Operating Systems
IT Certifications
Security
Network Security
Application Security
Incident Response
Zero Trust Model
Disaster Recovery
Penetration Testing / Ethical Hacking
Governance
Malware
Security Architecture
Security Engineering
Security Certifications
Design
Web Design
Graphic Design
Interaction Design
Film & Video
User Experience (UX)
Design Process
Design Tools
Business
Agile
Project Management
Product Management
Marketing
Human Resources
Finance
Team Management
Business Strategy
Digital Transformation
Organizational Leadership
Soft Skills
Professional Communication
Emotional Intelligence
Presentation Skills
Innovation
Critical Thinking
Public Speaking
Collaboration
Personal Productivity
Confidence / Motivation
Features
All features
Verifiable skills
AI Academy
Courses
Certifications
Interactive learning
Live events
Superstreams
Answers
Insights reporting
Radar Blog
Buy Courses
Plans
Sign In
Try Now
O'Reilly Platform
book
Pythonデータサイエンスハンドブック ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習
by
Jake VanderPlas
,
菊池 彰
May 2018
Intermediate to advanced
556 pages
13h 21m
Japanese
O'Reilly Japan, Inc.
Content preview from
Pythonデータサイエンスハンドブック ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習
2.5
配列の計算:ブロードキャスト
63
2.5
配列の計算:ブロードキャスト
前の節では、
NumPy
のユニバーサル関数を使って演算をベクトル化し、動作の遅い
Python
ルー
プを取り除く方法を見てきました。ベクトル化操作のもう
1
つの手段は、
NumPy
の
ブロードキャ
スト
機能を使用することです。ブロードキャストは、異なるサイズの配列に対して二項
ufunc
(加
算、減算、乗算など)を適用するための一連のルールです。
2.5.1
ブロードキャストの基礎
同じサイズの配列の場合、二項演算は要素ごとに実行されることを思い出してください。
In[1]: import numpy as np
In[2]: a = np.array([0, 1, 2])
b = np.array([5, 5, 5])
a + b
Out[2]: array([5, 6, 7])
ブロードキャストでは、この種の二項演算を異なるサイズの配列に対して実行できます。例えば、
スカラー(ゼロ次元の配列と考える)と配列の加算がそのまま行えます。
In[3]: a + 5
Out[3]: array([5, 6, 7])
これは値
5
をコピーして配列
[5,
5,
5]
に引き伸ばした上で、配列
a
との加算を行う操作と考え
られます。
NumPy
ブロードキャストの利点は、実際にはこの値のコピーが行われないところにあ
るのですが、ブロードキャストの仕組みを考える際には、こうした方がわかりやすくなります。
同様に高次元の配列にも拡張できます。
2
次元配列と
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.
Start your free trial
You might also like
Pythonデータサイエンスハンドブック 第2版 ―Jupyter、NumPy、pandas、Matplotlib、scikit-learnを使ったデータ分析、機械学習
Jake VanderPlas, 菊池 彰
Pythonではじめる機械学習 ―scikit-learnで学ぶ特徴量エンジニアリングと機械学習の基礎
Andreas C. Muller, Sarah Guido, 中田 秀基
PythonによるAIプログラミング入門 ―ディープラーニングを始める前に身につけておくべき15の基礎技術
Prateek Joshi, 相川 愛三
初めてのGraphQL ―Webサービスを作って学ぶ新世代API
Eve Porcello, Alex Banks, 尾崎 沙耶, あんどうやすし
Publisher Resources
ISBN: 9784873118413
Other