Introduction to numpy matrices syntax.
https://www.kdnuggets.com/2017/03/working-numpy-matrices.html
#numpy #Python #tutorial
https://www.kdnuggets.com/2017/03/working-numpy-matrices.html
#numpy #Python #tutorial
Forwarded from Machinelearning
ΠΠΎ ΠΌΠ΅ΡΠ΅ ΡΠΎΡΡΠ° ΠΎΠ±ΡΠ΅ΠΌΠΎΠ² Π΄Π°Π½Π½ΡΡ ΠΈ ΡΠ»ΠΎΠΆΠ½ΠΎΡΡΠΈ Π²ΡΡΠΈΡΠ»Π΅Π½ΠΈΠΉ, Π²ΡΡΠΈΡΠ»Π΅Π½ΠΈΡ Π½Π° Python ΠΈ NumPy, ΠΎΡΠ½ΠΎΠ²Π°Π½Π½ΡΠ΅ Π½Π° CPU, Π½ΡΠΆΠ΄Π°ΡΡΡΡ Π² ΡΡΠΊΠΎΡΠ΅Π½ΠΈΠΈ Π΄Π»Ρ Π²ΡΠΏΠΎΠ»Π½Π΅Π½ΠΈΡ ΡΠΎΠ²ΡΠ΅ΠΌΠ΅Π½Π½ΡΡ ΠΈΡΡΠ»Π΅Π΄ΠΎΠ²Π°Π½ΠΈΠΉ.
cuPyNumeric ΡΠ°Π·ΡΠ°Π±ΠΎΡΠ°Π½Π°, ΡΡΠΎΠ±Ρ ΡΡΠ°ΡΡ Π·Π°ΠΌΠ΅Π½ΠΎΠΉ Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠΈ NumPy, ΠΏΡΠ΅Π΄ΠΎΡΡΠ°Π²Π»ΡΡ ΡΠΎΠΎΠ±ΡΠ΅ΡΡΠ²Ρ Python ΡΠ°ΡΠΏΡΠ΅Π΄Π΅Π»Π΅Π½Π½ΡΠ΅ ΠΈ ΡΡΠΊΠΎΡΠ΅Π½Π½ΡΠ΅ Π²ΡΡΠΈΡΠ»Π΅Π½ΠΈΡ Π½Π° ΠΏΠ»Π°ΡΡΠΎΡΠΌΠ΅ NVIDIA. cuPyNumeric ΠΏΠΎΠ·Π²ΠΎΠ»ΡΠ΅Ρ ΠΌΠ°ΡΡΡΠ°Π±ΠΈΡΠΎΠ²Π°ΡΡ Π²ΡΡΠΈΡΠ»Π΅Π½ΠΈΡ Π±Π΅Π· ΠΈΠ·ΠΌΠ΅Π½Π΅Π½ΠΈΡ ΠΊΠΎΠ΄Π° ΠΏΡΠΎΠ΅ΠΊΡΠΎΠ² Ρ ΠΎΠ΄Π½ΠΎΠ³ΠΎ CPU Π΄ΠΎ ΡΡΠΏΠ΅ΡΠΊΠΎΠΌΠΏΡΡΡΠ΅ΡΠΎΠ² Ρ Π½Π΅ΡΠΊΠΎΠ»ΡΠΊΠΈΠΌΠΈ GPU ΠΈ Π²ΡΡΠΈΡΠ»ΠΈΡΠ΅Π»ΡΠ½ΡΠΌΠΈ Π½ΠΎΠ΄Π°ΠΌΠΈ.
ΠΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠ° ΠΏΠΎΡΡΡΠΎΠ΅Π½Π° Π½Π° Legate, ΠΏΠΎΠ΄Π΄Π΅ΡΠΆΠΈΠ²Π°Π΅Ρ ΡΠΎΠ΄Π½ΠΎΠΉ Python ΠΈ ΠΈΠ½ΡΠ΅ΡΡΠ΅ΠΉΡ NumPy. cuPyNumeric Π΄ΠΎΡΡΡΠΏΠ΅Π½ ΠΈΠ· conda (Π²Π΅ΡΡΠΈΡ Π½Π΅ Π½ΠΈΠΆΠ΅ 24.1) Π² legate channel. ΠΠ° ΡΠΈΡΡΠ΅ΠΌΠ°Ρ Ρ GPU ΠΏΠ°ΠΊΠ΅ΡΡ, ΠΏΠΎΠ΄Π΄Π΅ΡΠΆΠΈΠ²Π°ΡΡΠΈΠ΅ Π³ΡΠ°ΡΠΈΡΠ΅ΡΠΊΠΈΠ΅ ΡΡΠΊΠΎΡΠΈΡΠ΅Π»ΠΈ Π±ΡΠ΄ΡΡ Π²ΡΠ±ΡΠ°Π½Ρ Π°Π²ΡΠΎΠΌΠ°ΡΠΈΡΠ΅ΡΠΊΠΈ Π²ΠΎ Π²ΡΠ΅ΠΌΡ ΡΡΡΠ°Π½ΠΎΠ²ΠΊΠΈ.
ΠΡΠΈΠΌΠ΅Ρ ΡΡΡΠ΅ΠΊΡΠΈΠ²Π½ΠΎΡΡΠΈ cuPyNumeric - ΠΎΠ±ΡΠ°Π±ΠΎΡΠΊΠ° 10 Π’Π ΠΌΠΈΠΊΡΠΎΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΠΉ ΠΌΠ½ΠΎΠ³ΠΎΡΠ°ΠΊΡΡΡΠ½ΠΎΠΉ ΠΌΠΈΠΊΡΠΎΡΠΊΠΎΠΏΠΈΠΈ Π² Π²ΠΈΠ΄Π΅ ΠΎΠ΄Π½ΠΎΠ³ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π° NumPy Π·Π° ΠΎΠ΄ΠΈΠ½ Π΄Π΅Π½Ρ Ρ Π²ΠΈΠ·ΡΠ°Π»ΠΈΠ·Π°ΡΠΈΠΉ Π² ΡΠ΅ΠΆΠΈΠΌΠ΅ ΡΠ΅Π°Π»ΡΠ½ΠΎΠ³ΠΎ Π²ΡΠ΅ΠΌΠ΅Π½ΠΈ.
# Create new conda env
conda create -n myenv -c conda-forge -c legate cupynumeric
# Test via example from repo
$ legate examples/black_scholes.py
Running black scholes on 10K options...
Elapsed Time: 129.017 ms
@ai_machinelearning_big_data
#AI #ML #NumPy #NVIDIA #cuPyNumeric
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
π15π₯6β€3
The Evolution and Dependencies of Scientific Python Libraries
Numerical computing libraries like NumPy and SciPy rely on foundational mathematical code spanning decades. Until recently, NumPy depended on Fortran-based BLAS/LAPACK implementations for linear algebra operations. Modern versions now use OpenBLAS, which replaces Fortran code with optimized C implementations. SciPy, however, still incorporates Fortran 77 code for certain functionalities, such as ARPACK (used in eigenvalue computations) and FFTPACK (for Fourier transforms). These dependencies stem from legacy libraries like BLAS (1970s), LAPACK (1980s), and MINPACK (optimization), which remain widely used due to their mathematically stable, battle-tested algorithms like Simulated Annealing.
Simulated Annealing: A 1953 Algorithm in Modern ML
Imagine searching for the largest mushroom in a forest. Gradient methods risk settling for a local maximum, but Simulated Annealing (SciPyβs optimize) balances exploration and exploitation: early random βhigh-energyβ steps avoid local traps, then gradually refines toward the global optimum.
Originally devised to model atomic behavior in molten metals (Metropolis Algorithm, 1953), it mimics annealingβslow cooling ensures uniform atomic arrangement. Scientists introduced probabilistic acceptance of suboptimal states to escape flawed structures. Thise method was adopted to optimize ML models, logistics, and pattern recognition, making the familiar Python code use bindings which are ~15 years older than Python itself.
Source: Facebook post (Ru)
#SciPy #Fortran #NumPy #Math
Numerical computing libraries like NumPy and SciPy rely on foundational mathematical code spanning decades. Until recently, NumPy depended on Fortran-based BLAS/LAPACK implementations for linear algebra operations. Modern versions now use OpenBLAS, which replaces Fortran code with optimized C implementations. SciPy, however, still incorporates Fortran 77 code for certain functionalities, such as ARPACK (used in eigenvalue computations) and FFTPACK (for Fourier transforms). These dependencies stem from legacy libraries like BLAS (1970s), LAPACK (1980s), and MINPACK (optimization), which remain widely used due to their mathematically stable, battle-tested algorithms like Simulated Annealing.
Simulated Annealing: A 1953 Algorithm in Modern ML
Imagine searching for the largest mushroom in a forest. Gradient methods risk settling for a local maximum, but Simulated Annealing (SciPyβs optimize) balances exploration and exploitation: early random βhigh-energyβ steps avoid local traps, then gradually refines toward the global optimum.
Originally devised to model atomic behavior in molten metals (Metropolis Algorithm, 1953), it mimics annealingβslow cooling ensures uniform atomic arrangement. Scientists introduced probabilistic acceptance of suboptimal states to escape flawed structures. Thise method was adopted to optimize ML models, logistics, and pattern recognition, making the familiar Python code use bindings which are ~15 years older than Python itself.
Source: Facebook post (Ru)
#SciPy #Fortran #NumPy #Math
π12β€4π€·ββ1