SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Downloaden Sie, um offline zu lesen
© 2017 Continuum Analytics - Confidential & Proprietary© 2018 Quansight - Confidential & Proprietary
Standardizing ND-Arrays (Tensors) in Python
Quansight Labs
travis@quansight.com
@quansightai
@teoliphant
Python Summit, December 2018
1998 20182001
2015
2009 20122005
…
2001
2006
Python Data Analysis and Machine Learning Time-Line
1991
2003
2014
2008
2010 2016
2009
Maintenance Problem — Funding for
Community Devs
Full-time: 2 Full-time: 0
Full-time: 1/2
Open Source is too important to be just left to volunteer time — current situation is not working to
sustain millions of users:
• No funding for creators of these libraries to continue their work
• GPU support could have been added to NumPy years ago
• SciPy took 17 years to hit 1.0
• NumPy should already be at 2.0 — but not without full-time guidance and leadership
Full-time: 2
Full-time: 0
Company
2012 - Created Two Orgs for Sustainability
Community
Enterprise software company initially
built on services and supporting
open-source.
Became
Quansight — continuing Continuum momentum
Replaced by
Spin Out
Incubate
2012
2018
?
?
Key. Members of the management team at Continuum
Analytics ==> Anaconda was our first (spin-out) company.
2015
2019 and beyond…
Build and Connect
Companies and
Communities to
Solve Challenging
Problems with Data
Continuing my quest to find more
ways to pay developers to work on
open source!
Open Source Directions
Webinar series to promote and encourage accessible publicity
about what community developers are thinking about.
LABS
Sustaining the Future
Open-source innovation and
maintenance around the entire data-
science and AI workflow.
• Hire and fund a “PyData Core Team”
• GPU Support for NumPy Ecosystem
• Improve foundations of Array computing
• JupyterLab development and plugins
• Data Catalog standards and demos
• Packaging (conda-forge, PyPA, etc.)
• Cross Language Integration
uarray — unified array interface and “symbolic" NumPy
xnd — re-factored NumPy (low-level cross-language
libraries for N-D (tensor) computing)
Partnered with NumFOCUS and
Ursa Labs (supporting Apache
Arrow)
Bokeh
Adapted from Jake Vanderplas
PyCon 2017 Keynote
http://quansight.com/labs
Quansight Labs Team
Pearu
Peterson
Saul
Shanabrook
Hameer
Abbasi
Stefan
Krah
Tony
Fast
Anirrudh
Krishnan
Aaron
Meurer
David
Charboneau
Chris
Ostrouchov
Ryan
Henning
Carlos
Cordoba
Anthony
Scopatz
James
Bourbeau
Sameer
Deshmukh
Ivan
Ogasawara
Ian
Rose
Hugo
Shi
NumPy was created to merge array objects
in Python and unify PyData community
Numeric
Numarray
NumPy
2005 to 2006
Now a large community effort
SciPy ~ 673 contributors
NumPy ~ 709 contributors
Bokeh
Adapted from Jake Vanderplas
PyCon 2017 Keynote
Python’s Scientific Ecosystem
Bokeh
Adapted from Jake Vanderplas PyCon
https://github.com/josephmisiti/awesome-machine-learning#python-general-purpose
http://deeplearning.net/software_links/
http://scikit-learn.org/stable/related_projects.html
Explosion of ML Frameworks and libraries
TVM/NNVM
Now array-like objects everywhere
Sparse Arrays
Neon
CUDArray
We have a “divided” community again!
Numeric
Numarray
NumPy
Real problem is packages have little re-use
FastAI
skorch
Pyro
Eduard
anyrl
Braid
PyMC4
MLFlow
torchdiffeq
Two additional efforts in 2006
Buffer Protocol (PEP 3118)
__array_interface__
Way for all Python objects to share memory using
NumPy-like data-structures (strided memory layout
with a shape). “memoryview”
Type system not solved at the time (punted to the
struct module syntax extended with character
codes)
(“I 2s f”) == dtype(‘u4, 2S, f’)
Protocol approach. Any object can define this
attribute to explain how it could be interpreted as
an array — still tied to NumPy structure (strided
layout)
What if we revisit these earlier efforts
Buffer Protocol (PEP 3118)
__array_interface__
Cross-language buffer-protocol
plus numpy-like math libraries
uarray
New project to formalize and
generalize array protocol for Python
while that downstream projects can
depend on (rather than a single array)
NumPy’s Key Parts
dtype
umath
ndarray
Description of what is “in the array” — data-description language but missing key
primitives (pointer, missing-data types, categoricals, new float types, etc.)
Strictly extensible —- but not easily.
Innovation was ability to map to any memory pointer that you could describe via
dtype “language” and then “slice and dice”
Pointer to data described by “dtype” with shape and strides information and
powerful “indexing” capabilities.
Mapping pointers to the start of a data-structure you can describe with dtype and
then applying (generalized) ufuncs is the essence of array-oriented computing
Math and functions for arrays. Started as “scalar” kernels (ufuncs) that are applied
over the array.
DEShaw added “generalized ufuncs” which allowed the kernel applied over the array
to involve “inner-dimensions” (i.e. dot, cholesky, svd, argmax, can be a kernel)
libndtypes libgumath libxnd
C-libraries with
defined API/ABI
Language Bindings
(Python, Ruby, …) ndtypes gumath xnd
Generalization of
dtype. Description of
“any” container
Generalization of numpy array container and
Universal functions (arbitray kernels applied
over the data)
Need: C++, Scala, Node,
F#, C#, Go, Java
Not a NumPy replacement — but could be used by NumPy!
Is a generalization of Arrow — you could describe an Arrow container with XND
Like Pandas columns are NumPy arrays.
Unified (or Universal) Array Interface
Need to fix the “string / bytes” problem of the array world!
Logical array vs. strided-pointer of numpy
“uarray”
interface
……
CuPy
Big Hairy Audacious Goal (BHAG)
Enhance the Array ecosystem (initially for Python) with an abstract interface
that downstream libraries can use (with a concrete interface based on xnd).
• Reuse as much of the existing ecosystem as possible.
• Easily allow multiple implementations of an array (sparse,
hardware-backed, delayed) with a common interface.
• Libraries (e.g. SciPy and PyData) that depend only on the
interface could be compiled down to hardware or use a backend
runtime.
Collaboration with Mathematics
Apply reduction rules from the "Mathematics of Arrays” on code that uses the
array_interface.
Lenore Mullin worked with Ken Iverson on APL and has since developed a
formal mathematics of arrays that shows how arbitrary array-based
cacluations (based on the Psi function) can be consistently defined,
simplified and formalized to be optimally implemented on arbitrary
hardware.
https://www.researchgate.net/profile/Lenore_Mullin https://arxiv.org/abs/0907.0796
Tensors and n-d Arrays: A Mathematics of Arrays
(MoA), psi-Calculus and the Composition of Tensor
and Array Operations
Similar to but learning from…
Current NumPy (API is huge…)
• Generalized ufuncs on top of this including Segmentation (Grouping) and
reduction
• Input/Output Rules for reducing and simplifying functions
• Method for defining pipelines of functions (with automatic differentiation)
Compute/Transform Creation/Reading Reporting/Output
Indexing/Subsetting MetaData/Attributes
Other Total
Functions 33 7 6 12 11 2 71
Methods 226 170 22 38 21 68 545
NumPy API
What is an array (or tensor)?
Fundamental concepts:
• shape (a named tuple)
• a function that takes a tuple of indexes and returns another array (Psi function)
• A (“dtype” or “memory-type”) (what are the elements)
• Math that works with arrays.
Other important concepts:
• for each dimension an “index” mapping from index space to 0..N-1 (labels)
• Data pointer (including device ID)
• Slicing, sub-selection, and indexing capability
• conversion from (0-d array) to Python scalar type
• Optional bit-array for masking missing data
• Functions for concatenation
• Functions for creating and filling the array (from a file, from a string, from Python
objects, from ODBC)
Core API that might be necessary
First part of the general Idea
__uarray__ —> return an object that implements the array interface
uarray interface: (strawperson phase…)
required
__u_psi__ : function mapping from a sequence of integers to an mtype
__u_shape__: a named tuple showing the shape of the uarray (or None if unknown)
__u_mtype__ : What this array contains: The Python type object in each element of the array
__u_attr__ : named tuple of attributes (version, ndim, jagged, strided, c-like, f-like, …)
optional
__u_llvm__ : return named tuple of llvm snippets for psi function
__u_llfuncs__ : return named tuple of low-level function pointers
__u_psi_dim__: function mapping from an sequence of integers to a __uarray__ one dimension smaller
__u_setelement__ : a function that sets an element of the array with an object of type mtype
__u_getelement__ : a function that gets
__u_fromiter__ : function to build a array from an iterator
__u_frombuffer__ : function to build a “gamma-based” uarray from a buffer
__u_concat__ : concatenate a sequence of __uarray__ objects along an axis
Core C-API from NumPy
PyArray_FromAny
PyArray_Shape
PyArray_New
PyArray_Fill
PyArray_Copy
PyArray_Take
PyArray_Put
PyArray_NDIM
PyArray_GETITEM
PyArray_SETITEM
…
* EquivArrTypes
* GetItem
* SetItem
* CopySwapN
* CopySwap
* ScanFunc
* FromStr
* FillFunc
* meta-data
Core Array Container DTtype
Basic Idea: Provide a place for these function-pointers in Python TypeObject
Start of a Proposal
Core Array Container
dtype Mtype
tp_as_ndarray
PyNDArrayMethods
Analagous to PySequenceMethods
Standardized function pointers for “bits”
In an “element” of a data-structure.
Inherit from PyHeapTypeObject

Weitere ähnliche Inhalte

Was ist angesagt?

Python as the Zen of Data Science
Python as the Zen of Data SciencePython as the Zen of Data Science
Python as the Zen of Data ScienceTravis Oliphant
 
SciPy 2019: How to Accelerate an Existing Codebase with Numba
SciPy 2019: How to Accelerate an Existing Codebase with NumbaSciPy 2019: How to Accelerate an Existing Codebase with Numba
SciPy 2019: How to Accelerate an Existing Codebase with Numbastan_seibert
 
Getting started with TensorFlow
Getting started with TensorFlowGetting started with TensorFlow
Getting started with TensorFlowElifTech
 
Introduction To TensorFlow
Introduction To TensorFlowIntroduction To TensorFlow
Introduction To TensorFlowSpotle.ai
 
A Short Course in Data Stream Mining
A Short Course in Data Stream MiningA Short Course in Data Stream Mining
A Short Course in Data Stream MiningAlbert Bifet
 
Webinar: Deep Learning with H2O
Webinar: Deep Learning with H2OWebinar: Deep Learning with H2O
Webinar: Deep Learning with H2OSri Ambati
 
深層学習フレームワーク概要とChainerの事例紹介
深層学習フレームワーク概要とChainerの事例紹介深層学習フレームワーク概要とChainerの事例紹介
深層学習フレームワーク概要とChainerの事例紹介Kenta Oono
 
Deep Learning on Qubole Data Platform
Deep Learning on Qubole Data PlatformDeep Learning on Qubole Data Platform
Deep Learning on Qubole Data PlatformShivaji Dutta
 
[Update] PyTorch Tutorial for NTU Machine Learing Course 2017
[Update] PyTorch Tutorial for NTU Machine Learing Course 2017[Update] PyTorch Tutorial for NTU Machine Learing Course 2017
[Update] PyTorch Tutorial for NTU Machine Learing Course 2017Yu-Hsun (lymanblue) Lin
 
Mining Frequent Closed Graphs on Evolving Data Streams
Mining Frequent Closed Graphs on Evolving Data StreamsMining Frequent Closed Graphs on Evolving Data Streams
Mining Frequent Closed Graphs on Evolving Data StreamsAlbert Bifet
 
Migrating from matlab to python
Migrating from matlab to pythonMigrating from matlab to python
Migrating from matlab to pythonActiveState
 
TensorFlow Dev Summit 2017 요약
TensorFlow Dev Summit 2017 요약TensorFlow Dev Summit 2017 요약
TensorFlow Dev Summit 2017 요약Jin Joong Kim
 
Online learning, Vowpal Wabbit and Hadoop
Online learning, Vowpal Wabbit and HadoopOnline learning, Vowpal Wabbit and Hadoop
Online learning, Vowpal Wabbit and HadoopHéloïse Nonne
 
Large Scale Deep Learning with TensorFlow
Large Scale Deep Learning with TensorFlow Large Scale Deep Learning with TensorFlow
Large Scale Deep Learning with TensorFlow Jen Aman
 
TensorFrames: Google Tensorflow on Apache Spark
TensorFrames: Google Tensorflow on Apache SparkTensorFrames: Google Tensorflow on Apache Spark
TensorFrames: Google Tensorflow on Apache SparkDatabricks
 
STRIP: stream learning of influence probabilities.
STRIP: stream learning of influence probabilities.STRIP: stream learning of influence probabilities.
STRIP: stream learning of influence probabilities.Albert Bifet
 

Was ist angesagt? (20)

Python as the Zen of Data Science
Python as the Zen of Data SciencePython as the Zen of Data Science
Python as the Zen of Data Science
 
SciPy 2019: How to Accelerate an Existing Codebase with Numba
SciPy 2019: How to Accelerate an Existing Codebase with NumbaSciPy 2019: How to Accelerate an Existing Codebase with Numba
SciPy 2019: How to Accelerate an Existing Codebase with Numba
 
Getting started with TensorFlow
Getting started with TensorFlowGetting started with TensorFlow
Getting started with TensorFlow
 
SciPy 2010 Review
SciPy 2010 ReviewSciPy 2010 Review
SciPy 2010 Review
 
Introduction To TensorFlow
Introduction To TensorFlowIntroduction To TensorFlow
Introduction To TensorFlow
 
A Short Course in Data Stream Mining
A Short Course in Data Stream MiningA Short Course in Data Stream Mining
A Short Course in Data Stream Mining
 
Intro to Python
Intro to PythonIntro to Python
Intro to Python
 
TensorFlow 101
TensorFlow 101TensorFlow 101
TensorFlow 101
 
Session 2
Session 2Session 2
Session 2
 
Webinar: Deep Learning with H2O
Webinar: Deep Learning with H2OWebinar: Deep Learning with H2O
Webinar: Deep Learning with H2O
 
深層学習フレームワーク概要とChainerの事例紹介
深層学習フレームワーク概要とChainerの事例紹介深層学習フレームワーク概要とChainerの事例紹介
深層学習フレームワーク概要とChainerの事例紹介
 
Deep Learning on Qubole Data Platform
Deep Learning on Qubole Data PlatformDeep Learning on Qubole Data Platform
Deep Learning on Qubole Data Platform
 
[Update] PyTorch Tutorial for NTU Machine Learing Course 2017
[Update] PyTorch Tutorial for NTU Machine Learing Course 2017[Update] PyTorch Tutorial for NTU Machine Learing Course 2017
[Update] PyTorch Tutorial for NTU Machine Learing Course 2017
 
Mining Frequent Closed Graphs on Evolving Data Streams
Mining Frequent Closed Graphs on Evolving Data StreamsMining Frequent Closed Graphs on Evolving Data Streams
Mining Frequent Closed Graphs on Evolving Data Streams
 
Migrating from matlab to python
Migrating from matlab to pythonMigrating from matlab to python
Migrating from matlab to python
 
TensorFlow Dev Summit 2017 요약
TensorFlow Dev Summit 2017 요약TensorFlow Dev Summit 2017 요약
TensorFlow Dev Summit 2017 요약
 
Online learning, Vowpal Wabbit and Hadoop
Online learning, Vowpal Wabbit and HadoopOnline learning, Vowpal Wabbit and Hadoop
Online learning, Vowpal Wabbit and Hadoop
 
Large Scale Deep Learning with TensorFlow
Large Scale Deep Learning with TensorFlow Large Scale Deep Learning with TensorFlow
Large Scale Deep Learning with TensorFlow
 
TensorFrames: Google Tensorflow on Apache Spark
TensorFrames: Google Tensorflow on Apache SparkTensorFrames: Google Tensorflow on Apache Spark
TensorFrames: Google Tensorflow on Apache Spark
 
STRIP: stream learning of influence probabilities.
STRIP: stream learning of influence probabilities.STRIP: stream learning of influence probabilities.
STRIP: stream learning of influence probabilities.
 

Ähnlich wie Standardizing arrays -- Microsoft Presentation

Standardizing on a single N-dimensional array API for Python
Standardizing on a single N-dimensional array API for PythonStandardizing on a single N-dimensional array API for Python
Standardizing on a single N-dimensional array API for PythonRalf Gommers
 
Azure 機器學習 - 使用Python, R, Spark, CNTK 深度學習
Azure 機器學習 - 使用Python, R, Spark, CNTK 深度學習 Azure 機器學習 - 使用Python, R, Spark, CNTK 深度學習
Azure 機器學習 - 使用Python, R, Spark, CNTK 深度學習 Herman Wu
 
Python array API standardization - current state and benefits
Python array API standardization - current state and benefitsPython array API standardization - current state and benefits
Python array API standardization - current state and benefitsRalf Gommers
 
Deep Dive into Apache MXNet on AWS
Deep Dive into Apache MXNet on AWSDeep Dive into Apache MXNet on AWS
Deep Dive into Apache MXNet on AWSKristana Kane
 
Intellectual technologies
Intellectual technologiesIntellectual technologies
Intellectual technologiesPolad Saruxanov
 
1645 goldenberg using our laptop
1645 goldenberg using our laptop1645 goldenberg using our laptop
1645 goldenberg using our laptopRising Media, Inc.
 
Role of python in hpc
Role of python in hpcRole of python in hpc
Role of python in hpcDr Reeja S R
 
summer training report on python
summer training report on pythonsummer training report on python
summer training report on pythonShubham Yadav
 
Cassandra Summit 2014: Apache Spark - The SDK for All Big Data Platforms
Cassandra Summit 2014: Apache Spark - The SDK for All Big Data PlatformsCassandra Summit 2014: Apache Spark - The SDK for All Big Data Platforms
Cassandra Summit 2014: Apache Spark - The SDK for All Big Data PlatformsDataStax Academy
 
Machine learning from software developers point of view
Machine learning from software developers point of viewMachine learning from software developers point of view
Machine learning from software developers point of viewPierre Paci
 
Eclipse Con Europe 2014 How to use DAWN Science Project
Eclipse Con Europe 2014 How to use DAWN Science ProjectEclipse Con Europe 2014 How to use DAWN Science Project
Eclipse Con Europe 2014 How to use DAWN Science ProjectMatthew Gerring
 
PRESENTATION ON PYTHON.pptx
PRESENTATION ON PYTHON.pptxPRESENTATION ON PYTHON.pptx
PRESENTATION ON PYTHON.pptxabhishek364864
 
Basic of python for data analysis
Basic of python for data analysisBasic of python for data analysis
Basic of python for data analysisPramod Toraskar
 

Ähnlich wie Standardizing arrays -- Microsoft Presentation (20)

Standardizing on a single N-dimensional array API for Python
Standardizing on a single N-dimensional array API for PythonStandardizing on a single N-dimensional array API for Python
Standardizing on a single N-dimensional array API for Python
 
Python
PythonPython
Python
 
Distributed Deep Learning + others for Spark Meetup
Distributed Deep Learning + others for Spark MeetupDistributed Deep Learning + others for Spark Meetup
Distributed Deep Learning + others for Spark Meetup
 
Azure 機器學習 - 使用Python, R, Spark, CNTK 深度學習
Azure 機器學習 - 使用Python, R, Spark, CNTK 深度學習 Azure 機器學習 - 使用Python, R, Spark, CNTK 深度學習
Azure 機器學習 - 使用Python, R, Spark, CNTK 深度學習
 
Python array API standardization - current state and benefits
Python array API standardization - current state and benefitsPython array API standardization - current state and benefits
Python array API standardization - current state and benefits
 
Deep Dive into Apache MXNet on AWS
Deep Dive into Apache MXNet on AWSDeep Dive into Apache MXNet on AWS
Deep Dive into Apache MXNet on AWS
 
Intellectual technologies
Intellectual technologiesIntellectual technologies
Intellectual technologies
 
1645 goldenberg using our laptop
1645 goldenberg using our laptop1645 goldenberg using our laptop
1645 goldenberg using our laptop
 
Scientific Python
Scientific PythonScientific Python
Scientific Python
 
Role of python in hpc
Role of python in hpcRole of python in hpc
Role of python in hpc
 
summer training report on python
summer training report on pythonsummer training report on python
summer training report on python
 
MAVRL Workshop 2014 - Python Materials Genomics (pymatgen)
MAVRL Workshop 2014 - Python Materials Genomics (pymatgen)MAVRL Workshop 2014 - Python Materials Genomics (pymatgen)
MAVRL Workshop 2014 - Python Materials Genomics (pymatgen)
 
Shivam PPT.pptx
Shivam PPT.pptxShivam PPT.pptx
Shivam PPT.pptx
 
Cassandra Summit 2014: Apache Spark - The SDK for All Big Data Platforms
Cassandra Summit 2014: Apache Spark - The SDK for All Big Data PlatformsCassandra Summit 2014: Apache Spark - The SDK for All Big Data Platforms
Cassandra Summit 2014: Apache Spark - The SDK for All Big Data Platforms
 
Machine learning from software developers point of view
Machine learning from software developers point of viewMachine learning from software developers point of view
Machine learning from software developers point of view
 
Eclipse Con Europe 2014 How to use DAWN Science Project
Eclipse Con Europe 2014 How to use DAWN Science ProjectEclipse Con Europe 2014 How to use DAWN Science Project
Eclipse Con Europe 2014 How to use DAWN Science Project
 
Python libraries
Python librariesPython libraries
Python libraries
 
PRESENTATION ON PYTHON.pptx
PRESENTATION ON PYTHON.pptxPRESENTATION ON PYTHON.pptx
PRESENTATION ON PYTHON.pptx
 
Distributed deep learning_over_spark_20_nov_2014_ver_2.8
Distributed deep learning_over_spark_20_nov_2014_ver_2.8Distributed deep learning_over_spark_20_nov_2014_ver_2.8
Distributed deep learning_over_spark_20_nov_2014_ver_2.8
 
Basic of python for data analysis
Basic of python for data analysisBasic of python for data analysis
Basic of python for data analysis
 

Mehr von Travis Oliphant

PyData Barcelona Keynote
PyData Barcelona KeynotePyData Barcelona Keynote
PyData Barcelona KeynoteTravis Oliphant
 
Python for Data Science with Anaconda
Python for Data Science with AnacondaPython for Data Science with Anaconda
Python for Data Science with AnacondaTravis Oliphant
 
Fast and Scalable Python
Fast and Scalable PythonFast and Scalable Python
Fast and Scalable PythonTravis Oliphant
 
Scaling PyData Up and Out
Scaling PyData Up and OutScaling PyData Up and Out
Scaling PyData Up and OutTravis Oliphant
 
Scale up and Scale Out Anaconda and PyData
Scale up and Scale Out Anaconda and PyDataScale up and Scale Out Anaconda and PyData
Scale up and Scale Out Anaconda and PyDataTravis Oliphant
 
Anaconda and PyData Solutions
Anaconda and PyData SolutionsAnaconda and PyData Solutions
Anaconda and PyData SolutionsTravis Oliphant
 
Continuum Analytics and Python
Continuum Analytics and PythonContinuum Analytics and Python
Continuum Analytics and PythonTravis Oliphant
 
Effectively using Open Source with conda
Effectively using Open Source with condaEffectively using Open Source with conda
Effectively using Open Source with condaTravis Oliphant
 
Blaze: a large-scale, array-oriented infrastructure for Python
Blaze: a large-scale, array-oriented infrastructure for PythonBlaze: a large-scale, array-oriented infrastructure for Python
Blaze: a large-scale, array-oriented infrastructure for PythonTravis Oliphant
 
Numba: Array-oriented Python Compiler for NumPy
Numba: Array-oriented Python Compiler for NumPyNumba: Array-oriented Python Compiler for NumPy
Numba: Array-oriented Python Compiler for NumPyTravis Oliphant
 

Mehr von Travis Oliphant (16)

PyData Barcelona Keynote
PyData Barcelona KeynotePyData Barcelona Keynote
PyData Barcelona Keynote
 
Python for Data Science with Anaconda
Python for Data Science with AnacondaPython for Data Science with Anaconda
Python for Data Science with Anaconda
 
Fast and Scalable Python
Fast and Scalable PythonFast and Scalable Python
Fast and Scalable Python
 
Scaling PyData Up and Out
Scaling PyData Up and OutScaling PyData Up and Out
Scaling PyData Up and Out
 
Scale up and Scale Out Anaconda and PyData
Scale up and Scale Out Anaconda and PyDataScale up and Scale Out Anaconda and PyData
Scale up and Scale Out Anaconda and PyData
 
Anaconda and PyData Solutions
Anaconda and PyData SolutionsAnaconda and PyData Solutions
Anaconda and PyData Solutions
 
Continuum Analytics and Python
Continuum Analytics and PythonContinuum Analytics and Python
Continuum Analytics and Python
 
Bids talk 9.18
Bids talk 9.18Bids talk 9.18
Bids talk 9.18
 
Effectively using Open Source with conda
Effectively using Open Source with condaEffectively using Open Source with conda
Effectively using Open Source with conda
 
London level39
London level39London level39
London level39
 
PyData Boston 2013
PyData Boston 2013PyData Boston 2013
PyData Boston 2013
 
Blaze: a large-scale, array-oriented infrastructure for Python
Blaze: a large-scale, array-oriented infrastructure for PythonBlaze: a large-scale, array-oriented infrastructure for Python
Blaze: a large-scale, array-oriented infrastructure for Python
 
Numba: Array-oriented Python Compiler for NumPy
Numba: Array-oriented Python Compiler for NumPyNumba: Array-oriented Python Compiler for NumPy
Numba: Array-oriented Python Compiler for NumPy
 
Numba lightning
Numba lightningNumba lightning
Numba lightning
 
PyData Introduction
PyData IntroductionPyData Introduction
PyData Introduction
 
Numba
NumbaNumba
Numba
 

Kürzlich hochgeladen

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 

Kürzlich hochgeladen (20)

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 

Standardizing arrays -- Microsoft Presentation

  • 1. © 2017 Continuum Analytics - Confidential & Proprietary© 2018 Quansight - Confidential & Proprietary Standardizing ND-Arrays (Tensors) in Python Quansight Labs travis@quansight.com @quansightai @teoliphant Python Summit, December 2018
  • 2. 1998 20182001 2015 2009 20122005 … 2001 2006 Python Data Analysis and Machine Learning Time-Line 1991 2003 2014 2008 2010 2016 2009
  • 3. Maintenance Problem — Funding for Community Devs Full-time: 2 Full-time: 0 Full-time: 1/2 Open Source is too important to be just left to volunteer time — current situation is not working to sustain millions of users: • No funding for creators of these libraries to continue their work • GPU support could have been added to NumPy years ago • SciPy took 17 years to hit 1.0 • NumPy should already be at 2.0 — but not without full-time guidance and leadership Full-time: 2 Full-time: 0
  • 4. Company 2012 - Created Two Orgs for Sustainability Community Enterprise software company initially built on services and supporting open-source. Became
  • 5. Quansight — continuing Continuum momentum Replaced by Spin Out Incubate 2012 2018 ? ? Key. Members of the management team at Continuum Analytics ==> Anaconda was our first (spin-out) company. 2015 2019 and beyond…
  • 6. Build and Connect Companies and Communities to Solve Challenging Problems with Data Continuing my quest to find more ways to pay developers to work on open source!
  • 7. Open Source Directions Webinar series to promote and encourage accessible publicity about what community developers are thinking about.
  • 8. LABS Sustaining the Future Open-source innovation and maintenance around the entire data- science and AI workflow. • Hire and fund a “PyData Core Team” • GPU Support for NumPy Ecosystem • Improve foundations of Array computing • JupyterLab development and plugins • Data Catalog standards and demos • Packaging (conda-forge, PyPA, etc.) • Cross Language Integration uarray — unified array interface and “symbolic" NumPy xnd — re-factored NumPy (low-level cross-language libraries for N-D (tensor) computing) Partnered with NumFOCUS and Ursa Labs (supporting Apache Arrow) Bokeh Adapted from Jake Vanderplas PyCon 2017 Keynote http://quansight.com/labs
  • 10. NumPy was created to merge array objects in Python and unify PyData community Numeric Numarray NumPy 2005 to 2006
  • 11. Now a large community effort SciPy ~ 673 contributors NumPy ~ 709 contributors
  • 12. Bokeh Adapted from Jake Vanderplas PyCon 2017 Keynote
  • 13. Python’s Scientific Ecosystem Bokeh Adapted from Jake Vanderplas PyCon
  • 15. Now array-like objects everywhere Sparse Arrays Neon CUDArray
  • 16. We have a “divided” community again! Numeric Numarray NumPy
  • 17. Real problem is packages have little re-use FastAI skorch Pyro Eduard anyrl Braid PyMC4 MLFlow torchdiffeq
  • 18. Two additional efforts in 2006 Buffer Protocol (PEP 3118) __array_interface__ Way for all Python objects to share memory using NumPy-like data-structures (strided memory layout with a shape). “memoryview” Type system not solved at the time (punted to the struct module syntax extended with character codes) (“I 2s f”) == dtype(‘u4, 2S, f’) Protocol approach. Any object can define this attribute to explain how it could be interpreted as an array — still tied to NumPy structure (strided layout)
  • 19. What if we revisit these earlier efforts Buffer Protocol (PEP 3118) __array_interface__ Cross-language buffer-protocol plus numpy-like math libraries uarray New project to formalize and generalize array protocol for Python while that downstream projects can depend on (rather than a single array)
  • 20. NumPy’s Key Parts dtype umath ndarray Description of what is “in the array” — data-description language but missing key primitives (pointer, missing-data types, categoricals, new float types, etc.) Strictly extensible —- but not easily. Innovation was ability to map to any memory pointer that you could describe via dtype “language” and then “slice and dice” Pointer to data described by “dtype” with shape and strides information and powerful “indexing” capabilities. Mapping pointers to the start of a data-structure you can describe with dtype and then applying (generalized) ufuncs is the essence of array-oriented computing Math and functions for arrays. Started as “scalar” kernels (ufuncs) that are applied over the array. DEShaw added “generalized ufuncs” which allowed the kernel applied over the array to involve “inner-dimensions” (i.e. dot, cholesky, svd, argmax, can be a kernel)
  • 21. libndtypes libgumath libxnd C-libraries with defined API/ABI Language Bindings (Python, Ruby, …) ndtypes gumath xnd Generalization of dtype. Description of “any” container Generalization of numpy array container and Universal functions (arbitray kernels applied over the data) Need: C++, Scala, Node, F#, C#, Go, Java Not a NumPy replacement — but could be used by NumPy!
  • 22. Is a generalization of Arrow — you could describe an Arrow container with XND Like Pandas columns are NumPy arrays.
  • 23. Unified (or Universal) Array Interface Need to fix the “string / bytes” problem of the array world! Logical array vs. strided-pointer of numpy “uarray” interface …… CuPy
  • 24. Big Hairy Audacious Goal (BHAG) Enhance the Array ecosystem (initially for Python) with an abstract interface that downstream libraries can use (with a concrete interface based on xnd). • Reuse as much of the existing ecosystem as possible. • Easily allow multiple implementations of an array (sparse, hardware-backed, delayed) with a common interface. • Libraries (e.g. SciPy and PyData) that depend only on the interface could be compiled down to hardware or use a backend runtime.
  • 25. Collaboration with Mathematics Apply reduction rules from the "Mathematics of Arrays” on code that uses the array_interface. Lenore Mullin worked with Ken Iverson on APL and has since developed a formal mathematics of arrays that shows how arbitrary array-based cacluations (based on the Psi function) can be consistently defined, simplified and formalized to be optimally implemented on arbitrary hardware. https://www.researchgate.net/profile/Lenore_Mullin https://arxiv.org/abs/0907.0796 Tensors and n-d Arrays: A Mathematics of Arrays (MoA), psi-Calculus and the Composition of Tensor and Array Operations
  • 26. Similar to but learning from…
  • 27. Current NumPy (API is huge…) • Generalized ufuncs on top of this including Segmentation (Grouping) and reduction • Input/Output Rules for reducing and simplifying functions • Method for defining pipelines of functions (with automatic differentiation) Compute/Transform Creation/Reading Reporting/Output Indexing/Subsetting MetaData/Attributes Other Total Functions 33 7 6 12 11 2 71 Methods 226 170 22 38 21 68 545 NumPy API
  • 28. What is an array (or tensor)? Fundamental concepts: • shape (a named tuple) • a function that takes a tuple of indexes and returns another array (Psi function) • A (“dtype” or “memory-type”) (what are the elements) • Math that works with arrays. Other important concepts: • for each dimension an “index” mapping from index space to 0..N-1 (labels) • Data pointer (including device ID) • Slicing, sub-selection, and indexing capability • conversion from (0-d array) to Python scalar type • Optional bit-array for masking missing data • Functions for concatenation • Functions for creating and filling the array (from a file, from a string, from Python objects, from ODBC) Core API that might be necessary
  • 29. First part of the general Idea __uarray__ —> return an object that implements the array interface uarray interface: (strawperson phase…) required __u_psi__ : function mapping from a sequence of integers to an mtype __u_shape__: a named tuple showing the shape of the uarray (or None if unknown) __u_mtype__ : What this array contains: The Python type object in each element of the array __u_attr__ : named tuple of attributes (version, ndim, jagged, strided, c-like, f-like, …) optional __u_llvm__ : return named tuple of llvm snippets for psi function __u_llfuncs__ : return named tuple of low-level function pointers __u_psi_dim__: function mapping from an sequence of integers to a __uarray__ one dimension smaller __u_setelement__ : a function that sets an element of the array with an object of type mtype __u_getelement__ : a function that gets __u_fromiter__ : function to build a array from an iterator __u_frombuffer__ : function to build a “gamma-based” uarray from a buffer __u_concat__ : concatenate a sequence of __uarray__ objects along an axis
  • 30. Core C-API from NumPy PyArray_FromAny PyArray_Shape PyArray_New PyArray_Fill PyArray_Copy PyArray_Take PyArray_Put PyArray_NDIM PyArray_GETITEM PyArray_SETITEM … * EquivArrTypes * GetItem * SetItem * CopySwapN * CopySwap * ScanFunc * FromStr * FillFunc * meta-data Core Array Container DTtype Basic Idea: Provide a place for these function-pointers in Python TypeObject
  • 31. Start of a Proposal Core Array Container dtype Mtype tp_as_ndarray PyNDArrayMethods Analagous to PySequenceMethods Standardized function pointers for “bits” In an “element” of a data-structure. Inherit from PyHeapTypeObject