Forwarded from Artem Ryblov’s Data Science Weekly
Problem Solving with Algorithms and Data Structures using Python by Brad Miller and David Ranum, Luther College
This textbook is about computer science. It is also about Python. However, there is much more.
The study of algorithms and data structures is central to understanding what computer science is all about. Learning computer science is not unlike learning any other type of difficult subject matter. The only way to be successful is through deliberate and incremental exposure to the fundamental ideas. A beginning computer scientist needs practice so that there is a thorough understanding before continuing on to the more complex parts of the curriculum. In addition, a beginner needs to be given the opportunity to be successful and gain confidence.
This textbook is designed to serve as a text for a first course on data structures and algorithms, typically taught as the second course in the computer science curriculum. Even though the second course is considered more advanced than the first course, this book assumes you are beginners at this level. You may still be struggling with some of the basic ideas and skills from a first computer science course and yet be ready to further explore the discipline and continue to practice problem solving.
Authors cover abstract data types and data structures, writing algorithms, and solving problems. They look at a number of data structures and solve classic problems that arise. The tools and techniques that you learn here will be applied over and over as you continue your study of computer science.
Links:
- Site
- Book
Navigational hashtags: #armbooks #armcourses
General hashtags: #python #algorithms #datastructures #programming #cs #computerscience
@data_science_weekly
This textbook is about computer science. It is also about Python. However, there is much more.
The study of algorithms and data structures is central to understanding what computer science is all about. Learning computer science is not unlike learning any other type of difficult subject matter. The only way to be successful is through deliberate and incremental exposure to the fundamental ideas. A beginning computer scientist needs practice so that there is a thorough understanding before continuing on to the more complex parts of the curriculum. In addition, a beginner needs to be given the opportunity to be successful and gain confidence.
This textbook is designed to serve as a text for a first course on data structures and algorithms, typically taught as the second course in the computer science curriculum. Even though the second course is considered more advanced than the first course, this book assumes you are beginners at this level. You may still be struggling with some of the basic ideas and skills from a first computer science course and yet be ready to further explore the discipline and continue to practice problem solving.
Authors cover abstract data types and data structures, writing algorithms, and solving problems. They look at a number of data structures and solve classic problems that arise. The tools and techniques that you learn here will be applied over and over as you continue your study of computer science.
Links:
- Site
- Book
Navigational hashtags: #armbooks #armcourses
General hashtags: #python #algorithms #datastructures #programming #cs #computerscience
@data_science_weekly
Forwarded from EasyData
Привет, друзья!
Сегодня поговорим про Numba - инструмент, который превращает обычный Python-код в "почти C" по скорости🏃♂️
Numba - это JIT-компилятор (Just-In-Time) для Python. Если вкратце, то он анализирует функции и компилирует их в машинный код прямо во время исполнения. То есть, вместо интерпретируемого Python код исполняется как скомпилированный.
Воспользоваться возможностями Numba крайне легко - нужно просто добавить декоратори всё! 🧑💻
Но пара нюансов всё же есть:
➡️ Во-первых, не все операции могут быть ускорены таким способом. Общий рецепт таков: "чем проще и численно интенсивнее функция, тем лучше". Вот несколько типичных примеров, которые хороши для Numba:
1. численные циклы (циклы for, while)
2. операции с массивами numpy
3. алгоритмы оптимизации, матричные вычисления
4. генерация чисел и математические функции (sin, exp, sqrt, и т.д.)
5. фильтрация, агрегация и другие различные манипуляции над массивами
6. простые симуляции (например, метод Монте-Карло)
➡️ А во-вторых, при первом запуске функция с Numba может работать даже медленнее обычной Python-версии🙂 Всё потому, что в первый раз Numba не просто выполняет код, а сначала компилирует его в машинный код - и это занимает время. Но уже со второго вызова скомпилированный вариант готов и работает в разы быстрее, как настоящий нативный код.
А насколько быстрым получается код с добавлением Numba - смотрите на скринах:) Замеры проведены на втором запуске😉
Документация библиотеки +:
➡️ с список Python-операций, которые могут быть ускорены
➡️ с аналогичный список для Numpy-функций
Хорошей недели и гармоничных распределений!☀️
#python@data_easy
Сегодня поговорим про Numba - инструмент, который превращает обычный Python-код в "почти C" по скорости
Numba - это JIT-компилятор (Just-In-Time) для Python. Если вкратце, то он анализирует функции и компилирует их в машинный код прямо во время исполнения. То есть, вместо интерпретируемого Python код исполняется как скомпилированный.
Воспользоваться возможностями Numba крайне легко - нужно просто добавить декоратор
@njit к функции,
@njit
def sigmoid_numba(x):
return 1 / (1 + np.exp(-x))
Но пара нюансов всё же есть:
1. численные циклы (циклы for, while)
2. операции с массивами numpy
3. алгоритмы оптимизации, матричные вычисления
4. генерация чисел и математические функции (sin, exp, sqrt, и т.д.)
5. фильтрация, агрегация и другие различные манипуляции над массивами
6. простые симуляции (например, метод Монте-Карло)
А насколько быстрым получается код с добавлением Numba - смотрите на скринах:) Замеры проведены на втором запуске😉
Документация библиотеки +:
Хорошей недели и гармоничных распределений!
#python@data_easy
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM