Machine Learning Study Plan.

Machine Learning Study Plan: 2024
|-- Week 1: Introduction to Machine Learning
| |-- ML Fundamentals
| | |-- What is ML?
| | |-- Types of ML
| | |-- Supervised vs. Unsupervised Learning
| |-- Setting up for ML
| | |-- Python and Libraries
| | |-- Jupyter Notebooks
| | |-- Datasets
| |-- First ML Project
| | |-- Linear Regression
|
|-- Week 2: Intermediate ML Concepts
| |-- Classification Algorithms
| | |-- Logistic Regression
| | |-- Decision Trees
| |-- Model Evaluation
| | |-- Accuracy, Precision, Recall, F1 Score
| | |-- Confusion Matrix
| |-- Clustering
| | |-- K-Means
| | |-- Hierarchical Clustering
|
|-- Week 3: Advanced ML Techniques
| |-- Ensemble Methods
| | |-- Random Forest
| | |-- Gradient Boosting
| | |-- Bagging and Boosting
| |-- Dimensionality Reduction
| | |-- PCA
| | |-- t-SNE
| | |-- Autoencoders
| |-- SVM
| | |-- SVM
| | |-- Kernel Methods
|
|-- Week 4: Deep Learning
| |-- Neural Networks
| | |-- Introduction
| | |-- Activation Functions
| |-- (CNN)
| | |-- Image Classification
| | |-- Object Detection
| | |-- Transfer Learning
| |-- (RNN)
| | |-- Time Series
| | |-- NLP
|
|-- Week 5-8: Specialized ML Topics
| |-- Reinforcement Learning
| | |-- Markov Decision Processes (MDP)
| | |-- Q-Learning
| | |-- Policy Gradient
| | |-- Deep Reinforcement Learning
| |-- NLP and Text Analysis
| | |-- Text Preprocessing
| | |-- Named Entity Recognition
| | |-- Text Classification
| |-- Computer Vision
| | |-- Image Processing
| | |-- Object Detection
| | |-- Image Generation
| | |-- Style Transfer
|
|-- Week 9-11: Real-world App and Projects
| |-- Capstone Project
| | |-- Data Collection
| | |-- Model Building
| | |-- Evaluation and Optimization
| | |-- Presentation
| |-- Kaggle Competitions
| | |-- Data Science Community
| |-- Industry-based Projects
|
|-- Week 12: Post-Project Learning
| |-- Model Deployment
| | |-- Docker
| | |-- Cloud Platforms (AWS, GCP, Azure)
| |-- MLOps
| | |-- Model Monitoring
| | |-- Model Version Control
| |-- Continuing Education
| | |-- Advanced Topics
| | |-- Research Papers
| | |-- New Dev
|
|-- Resources and Community
| |-- Online Courses (Coursera, 365datascience, kncmap-technologies)
| |-- Books (ISLR, Introduction to ML with Python)
| |-- Data Science Blogs and Podcasts
| |-- GitHub Repo
| |-- Data Science Communities (Kaggle)

Week 1: Introduction to Machine Learning:

Machine Learning Fundamentals:

Machine learning has transformed the way we approach problems and make decisions in various fields, from finance and healthcare to entertainment and marketing. In this article, we will delve into the fundamentals of machine learning, exploring its applications and the core concepts that underpin its functionality. Whether you’re new to the field or seeking to deepen your understanding, this guide will provide you with a solid foundation in machine learning.

Relationship between Artificial Intelligence, Machine Learning, Deep Learning, and Artificial Neural Networks:

Artificial Intelligence (AI), Machine Learning (ML), Deep Learning (DL), and Artificial Neural Networks (ANNs) are interconnected concepts within the field of computer science and data analysis. Here’s how they relate to each other:

  1. Artificial Intelligence (AI): AI is a broad field focused on creating intelligent agents that can simulate human-like reasoning, problem-solving, and decision-making. It encompasses a wide range of techniques, including ML and DL, as well as rule-based systems, expert systems, and natural language processing. AI aims to build machines capable of general or specialized intelligence.
  2. Machine Learning (ML): ML is a subset of AI that focuses on developing algorithms and models that enable computers to improve their performance on a task by learning from data. ML encompasses various methods, including supervised, unsupervised, and reinforcement learning, and it involves the optimization of model parameters to make accurate predictions or decisions based on input data.
  3. Deep Learning (DL): DL is a specialized subfield of ML that deals with artificial neural networks containing multiple layers (deep architectures). DL excels at automatically learning hierarchical features and representations from raw data. It has achieved remarkable success in areas like computer vision, natural language processing, and speech recognition.
  4. Artificial Neural Networks (ANNs): ANNs are computational models inspired by the human brain’s neural structure. They consist of interconnected nodes (neurons) organized into layers. Each connection between nodes has a weight, and these weights are adjusted during training to learn patterns and relationships in data. ANNs form the foundation of deep learning and can model complex functions and features.

AI is the broader goal of enabling machines to exhibit human-like intelligence, while ML is a subset of AI that focuses on data-driven learning and optimization. DL is a specialized technique within ML that utilizes deep architectures of artificial neural networks to automatically learn complex patterns, and ANNs are the building blocks of DL. These concepts are interconnected and collectively contribute to the advancement of intelligent systems and data analysis.

What is Machine Learning?

At its core, machine learning is a subset of artificial intelligence (AI) that empowers computers to learn and make decisions from data without being explicitly programmed. In other words, machine learning algorithms enable computers to identify patterns, recognize trends, and make predictions by learning from examples and past experiences. This ability to learn from data and adapt over time is what sets machine learning apart and makes it a powerful tool for solving complex problems.

Applications of Machine Learning

Machine learning finds applications across a wide range of domains, including:

  1. Finance: Predicting stock prices, credit risk assessment, fraud detection.
  2. Healthcare: Disease diagnosis, medical image analysis, drug discovery.
  3. Marketing: Customer segmentation, recommendation systems, personalized advertising.
  4. Natural Language Processing (NLP): Sentiment analysis, language translation, chatbots.
  5. Computer Vision: Object detection, facial recognition, autonomous vehicles.
  6. Gaming: Character behavior modeling, opponent AI, procedural content generation.
  7. Manufacturing: Quality control, predictive maintenance, supply chain optimization.

These are just a few examples, showcasing the diverse and impactful applications of machine learning in today’s world.

Types of Machine Learning

Machine learning can be broadly categorized into three main types:

  1. Supervised Learning: In supervised learning, the algorithm learns from labeled examples in the form of input-output pairs. It aims to map inputs to correct outputs by identifying patterns in the data. Common algorithms include linear regression (for regression tasks) and classification algorithms like decision trees, support vector machines, and neural networks.
  2. Unsupervised Learning: Unsupervised learning involves learning patterns and structures from unlabeled data. Clustering and dimensionality reduction are typical tasks in unsupervised learning. K-means clustering and principal component analysis (PCA) are popular unsupervised algorithms.
  3. Reinforcement Learning: Reinforcement learning is inspired by behavioral psychology, where an agent learns how to interact with an environment to maximize rewards. It involves taking actions in an environment to achieve a specific goal. Reinforcement learning is widely used in robotics, game playing, and autonomous systems.
  4. Semi-Supervised Learning(optinal): Semi-supervised learning is a machine learning paradigm that leverages a small labeled dataset and a larger unlabeled dataset to improve model performance by combining supervised and unsupervised techniques. It’s used in scenarios where obtaining fully labeled data is costly or time-consuming, such as in medical image analysis and natural language processing tasks.

Core Concepts and Terminology

Features and Labels

In machine learning, data is typically represented as features and labels. Features are the input variables that the algorithm uses to make predictions or decisions. For example, in a medical diagnosis model, features might include patient age, blood pressure, and cholesterol levels. Labels, on the other hand, are the desired outputs or outcomes that the algorithm is trying to predict. In the medical diagnosis example, the label could indicate whether a patient has a specific disease or not.

Training and Testing

The process of developing a machine learning model involves training it on a dataset and evaluating its performance. The dataset is divided into two parts: the training set and the testing set. The training set is used to teach the model and adjust its parameters so that it can learn from the data. The testing set, which the model has never seen before, is used to assess its performance and generalization ability. The goal is to build a model that can make accurate predictions on new, unseen data.

Overfitting and Underfitting

Two common challenges in machine learning are overfitting and underfitting.

  1. Overfitting occurs when a model learns the training data too well and captures noise, leading to poor performance on new data.
  2. Underfitting, on the other hand, occurs when a model is too simple to capture the underlying patterns in the data, resulting in poor performance on both training and testing data.
  3. Optimal fitting in machine learning refers to finding the right balance between model complexity and data representation, where the model captures underlying patterns without overfitting (capturing noise) or underfitting (oversimplifying), resulting in better generalization to new, unseen data.

Balancing between these two extremes is essential for building a model that can generalize well to new data.

Best Python libraries for Machine Learning

Python libraries that are used in Machine Learning are: 
 

  • Numpy
  • Scipy
  • Scikit-learn
  • Theano
  • TensorFlow
  • Keras
  • PyTorch
  • Pandas
  • Matplotlib

Numpy

NumPy is a very popular python library for large multi-dimensional array and matrix processing, with the help of a large collection of high-level mathematical functions. It is very useful for fundamental scientific computations in Machine Learning. It is particularly useful for linear algebra, Fourier transform, and random number capabilities. High-end libraries like TensorFlow uses NumPy internally for manipulation of Tensors. 

import numpy as np
data = np.array([[1,2,3,4,5,6,7,8],[11,22,33,44,55,66,77,88]])
print(type(data), data.size, data.ndim)
data
<class 'numpy.ndarray'> 16 2
array([[ 1, 2, 3, 4, 5, 6, 7, 8],
[11, 22, 33, 44, 55, 66, 77, 88]])

This will print the type, size, and number of dimensions of the data array and then display the array itself. Let’s break down what each part does:

  • type(data) returns the type of data, which should be <class 'numpy.ndarray'>.
  • data.size returns the total number of elements in the array.
  • data.ndim returns the number of dimensions of the array.
  • The last line, data, will display the array.
# Python program using NumPy 
# for some basic mathematical
# operations
import numpy as np
# Creating two arrays of rank 2
x = np.array([[1, 2], [3, 4]])
y = np.array([[5, 6], [7, 8]])
# Creating two arrays of rank 1
v = np.array([9, 10])
w = np.array([11, 12])
# Inner product of vectors
print(np.dot(v, w), "\n")
# Matrix and Vector product
print(np.dot(x, v), "\n")
# Matrix and matrix product
print(np.dot(x, y))

219
[29 67]
[[19 22]
[43 50]]

Another example solving linear equations

import numpy as np
x_values = []
y_values = []
startingValue = float(input("Enter a starting value: "))
endValue = float(input("Enter the ending Value: "))
while startingValue <= endValue:
x = x_values.append(startingValue)
y = 2 * startingValue + 12
y = y_values.append(y)
startingValue += 5
print(x_values, y_values)
coordinates = np.array([x_values, y_values])
print(coordinates)

Enter a starting value: 5
Enter the ending Value: 60
[5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 35.0, 40.0, 45.0, 50.0, 55.0, 60.0] [22.0, 32.0, 42.0, 52.0, 62.0, 72.0, 82.0, 92.0, 102.0, 112.0, 122.0, 132.0]
[[ 5. 10. 15. 20. 25. 30. 35. 40. 45. 50. 55. 60.]
[ 22. 32. 42. 52. 62. 72. 82. 92. 102. 112. 122. 132.]]

More on Numpy Data Type

  • Data type Object (dtype) in NumPy

Methods in Numpy:

all()diag()hypot()ones_like()
any()diagflat()absolute()full_like()
take()diag_indices()ceil()sin()
put()asmatrix()floor()cos()
apply_along_axis()bmat()degrees()tan()
apply_over_axes()eye()radians()sinh()
argmin()roll()npv()cosh()
argmax()identity()fv()tanh()
nanargmin()arange()pv()arcsin()
nanargmax()place()power()arccos()
amax()extract()float_power()exp()
amin()compress()log()exp2()
insert()rot90()log1()fix()
delete()tile()log2()logical_or()
append()reshape()log10()logical_and()
around()ravel()dot()logical_not()
flip()isinf()vdot()logical_xor()
fliplr()isrealobj()trunc()array_equal()
flipud()isscalar()divide()array_equiv()
triu()isneginf()floor_divide()arctan2()
tril()isposinf()true_divide()equal()
tri()iscomplex()random.rand()not_equal()
empty()isnan()random.randn()less()
empty_like()iscomplexobj()ndarray.flat()less_equal()
zeros()isreal()expm1()greater()
zeros_like()isfinite()bincount()greater_equal()
ones()isfortran()rint()prod()
arctan()cbrt()square()
Array Creation:
zeros(): Create an array filled with zeros.
zeros_like(): Create an array of zeros with the same shape and type as a given array.
ones(): Create an array filled with ones.
ones_like(): Create an array of ones with the same shape and type as a given array.
empty(): Create an array without initializing its values.
empty_like(): Create an uninitialized array with the same shape and type as a given array.
full_like(): Create a full array with the same shape and type as a given array.
eye(): Create a 2-D array with ones on the diagonal and zeros elsewhere.
identity(): Create a square identity matrix.
arange(): Create an array with evenly spaced values within a given interval.
tile(): Construct an array by repeating A the number of times given by reps.
Array Manipulation:
reshape(): Give a new shape to an array without changing its data.
ravel(): Return a contiguous flattened array.
transpose(): Permute the dimensions of an array.
roll(): Roll array elements along a specified axis.
flip(): Reverse the order of elements in an array along the given axis.
fliplr(): Flip array in the left/right direction.
flipud(): Flip array in the up/down direction.
rot90(): Rotate an array by 90 degrees in the plane specified by axes.
append(): Append values to the end of an array.
insert(): Insert values along the given axis before the given indices.
delete(): Delete sub-arrays along the given axis.
compress(): Return selected slices of an array along given axis.
Array Indexing:
take(): Take elements from an array along an axis.
put(): Replaces specified elements of an array with given values.
place(): Change elements of an array based on conditional and input values.
extract(): Return the elements of an array that satisfy some condition.
Statistical Functions:
amax(): Return the maximum of an array or maximum along an axis.
amin(): Return the minimum of an array or minimum along an axis.
nanargmax(): Return the indices of the maximum values in an array, ignoring NaNs.
nanargmin(): Return the indices of the minimum values in an array, ignoring NaNs.
argmax(): Return the indices of the maximum values along an axis.
argmin(): Return the indices of the minimum values along an axis.
Mathematical Functions:
hypot(): Given the “legs” of a right triangle, return its hypotenuse.
absolute(): Calculate the absolute value element-wise.
ceil(): Return the ceiling of the input, element-wise.
floor(): Return the floor of the input, element-wise.
trunc(): Return the truncated value of the input, element-wise.
exp(): Calculate the exponential of all elements in the input array.
exp2(): Calculate 2**p for all p in the input array.
log(): Natural logarithm, element-wise.
log2(): Base-2 logarithm of x.
log10(): Base-10 logarithm of x.
sqrt(): Return the positive square root of an array, element-wise.
square(): Return the element-wise square of the input.
power(): First array elements raised to powers from second array, element-wise.
float_power(): First array elements raised to powers from second array, element-wise.
degrees(): Convert angles from radians to degrees.
radians(): Convert angles from degrees to radians.
sin(): Trigonometric sine, element-wise.
cos(): Trigonometric cosine, element-wise.
tan(): Trigonometric tangent, element-wise.
arcsin(): Inverse sine, element-wise.
arccos(): Inverse cosine, element-wise.
arctan(): Inverse tangent, element-wise.
sinh(): Hyperbolic sine, element-wise.
cosh(): Hyperbolic cosine, element-wise.
tanh(): Hyperbolic tangent, element-wise.
arctan2(): Element-wise arc tangent of x1/x2 choosing the quadrant correctly.
Logical Functions:
logical_and(): Compute the truth value of x1 AND x2 element-wise.
logical_or(): Compute the truth value of x1 OR x2 element-wise.
logical_not(): Compute the truth value of NOT x element-wise.
logical_xor(): Compute the truth value of x1 XOR x2 element-wise.
all(): Test whether all array elements along a given axis evaluate to True.
any(): Test whether any array element along a given axis evaluates to True.
Comparison Functions:
equal(): Return (x1 == x2) element-wise.
not_equal(): Return (x1 != x2) element-wise.
greater(): Return (x1 > x2) element-wise.
greater_equal(): Return (x1 >= x2) element-wise.
less(): Return (x1 < x2) element-wise.
less_equal(): Return (x1 <= x2) element-wise.
Array Properties:
isinf(): Test element-wise for positive or negative infinity.
isneginf(): Test element-wise for negative infinity.
isposinf(): Test element-wise for positive infinity.
isnan(): Test element-wise for NaNs.
isfinite(): Test element-wise for finiteness (not infinity or NaN).
isreal(): Returns a boolean array where true indicates a real number.
iscomplex(): Returns a boolean array where true indicates a complex number.
isrealobj(): Returns True if x is a not complex type or an array of complex numbers.
iscomplexobj(): Returns True if x is of a complex type or an array of complex numbers.
isscalar(): Returns True if the type of num is a scalar type.
isfortran(): Returns True if the array is Fortran contiguous but not C contiguous.
Financial Functions:
npv(): Compute the net present value of a cash flow series.
fv(): Compute the future value of a series of cash flows.
pv(): Compute the present value of a series of cash flows.
Linear Algebra:
dot(): Dot product of two arrays.
vdot(): Return the dot product of two vectors.
diag(): Extract a diagonal or construct a diagonal array.
diagflat(): Create a 2-D array with the flattened input as a diagonal.
diag_indices(): Return the indices to access the main diagonal of an array.
Miscellaneous:
random.rand(): Random values in a given shape.
random.randn(): Return a sample (or samples) from the “standard normal” distribution.
ndarray.flat(): A 1-D iterator over the array.
array_equal(): True if two arrays have the same shape and elements, False otherwise.
array_equiv(): Returns True if input arrays are shape consistent and all elements equal.
around(): Evenly round to the given number of decimals.
bmat(): Build a matrix object from a string, nested sequence, or array.
asmatrix(): Interpret the input as a matrix.
apply_along_axis(): Apply a function to 1-D slices along the given axis.
apply_over_axes(): Apply a function repeatedly over multiple axes.
nan_to_num(): Replace NaN with zero and infinity with large finite numbers.
bincount(): Count the number of occurrences of each value in an array of non-negative ints.
prod(): Return the product of array elements over a given axis.
This is not an exhaustive list but covers many commonly used functions in NumPy.
import numpy as np
import numpy_financial as npf
# Create arrays
print("Creating arrays:")
a = np.zeros((2, 3))
print("Zeros array:\n", a)
b = np.ones((2, 3))
print("Ones array:\n", b)
c = np.empty((2, 3))
print("Empty array:\n", c)
d = np.eye(3)
print("Identity matrix:\n", d)
e = np.arange(10)
print("Arange array:\n", e)
f = np.tile(e, (2, 1))
print("Tiled array:\n", f)
# Array manipulation
print("\nArray manipulation:")
g = np.reshape(a, (3, 2))
print("Reshaped array:\n", g)
h = np.ravel(g)
print("Flattened array:\n", h)
i = np.transpose(b)
print("Transposed array:\n", i)
j = np.roll(e, 2)
print("Rolled array:\n", j)
k = np.flip(e)
print("Flipped array:\n", k)
l = np.flipud(d)
print("Flip up-down:\n", l)
m = np.rot90(d)
print("Rotate 90 degrees:\n", m)
n = np.append(e, [10, 11, 12])
print("Appended array:\n", n)
o = np.insert(e, 2, [100, 200])
print("Inserted array:\n", o)
p = np.delete(e, [1, 2])
print("Deleted elements:\n", p)
q = np.compress([1, 0, 1, 0, 1, 0, 1, 0, 1, 0], e)
print("Compressed array:\n", q)
# Statistical functions
print("\nStatistical functions:")
r = np.amax(e)
print("Max value:", r)
s = np.amin(e)
print("Min value:", s)
t = np.argmax(e)
print("Index of max value:", t)
u = np.argmin(e)
print("Index of min value:", u)
# Mathematical functions
print("\nMathematical functions:")
v = np.hypot(3, 4)
print("Hypotenuse:", v)
w = np.absolute([-1, -2, 3])
print("Absolute values:", w)
x = np.ceil([1.2, 2.3, 3.4])
print("Ceiling values:", x)
y = np.floor([1.2, 2.3, 3.4])
print("Floor values:", y)
z = np.trunc([1.2, 2.3, 3.4])
print("Truncated values:", z)
aa = np.exp([1, 2, 3])
print("Exponential values:", aa)
ab = np.log([1, 2, 3])
print("Logarithm values:", ab)
ac = np.sqrt([1, 4, 9])
print("Square root values:", ac)
ad = np.power([1, 2, 3], 2)
print("Power values:", ad)
ae = np.degrees(np.pi)
print("Radians to degrees:", ae)
af = np.radians([0, 45, 90])
print("Degrees to radians:", af)
ag = np.sin(np.pi / 2)
print("Sine value:", ag)
ah = np.cos(np.pi)
print("Cosine value:", ah)
ai = np.tan(np.pi / 4)
print("Tangent value:", ai)
aj = np.arcsin(1)
print("Inverse sine value:", aj)
ak = np.arccos(1)
print("Inverse cosine value:", ak)
al = np.arctan(1)
print("Inverse tangent value:", al)
am = np.sinh(1)
print("Hyperbolic sine value:", am)
an = np.cosh(1)
print("Hyperbolic cosine value:", an)
ao = np.tanh(1)
print("Hyperbolic tangent value:", ao)
ap = np.arctan2(1, 1)
print("Arctan2 value:", ap)
# Logical functions
print("\nLogical functions:")
aq = np.logical_and([True, False], [False, False])
print("Logical AND:", aq)
ar = np.logical_or([True, False], [False, False])
print("Logical OR:", ar)
as_ = np.logical_not([True, False])
print("Logical NOT:", as_)
at = np.logical_xor([True, False], [False, False])
print("Logical XOR:", at)
au = np.all([True, True, False])
print("All elements true:", au)
av = np.any([True, False, False])
print("Any element true:", av)
# Comparison functions
print("\nComparison functions:")
aw = np.equal([1, 2, 3], [1, 2, 3])
print("Equal:", aw)
ax = np.not_equal([1, 2, 3], [1, 2, 4])
print("Not equal:", ax)
ay = np.greater([1, 2, 3], [0, 2, 2])
print("Greater:", ay)
az = np.greater_equal([1, 2, 3], [1, 2, 2])
print("Greater or equal:", az)
ba = np.less([1, 2, 3], [2, 2, 4])
print("Less:", ba)
bb = np.less_equal([1, 2, 3], [2, 2, 4])
print("Less or equal:", bb)
# Array properties
print("\nArray properties:")
bc = np.isinf([1, np.inf, -np.inf])
print("Is infinity:", bc)
bd = np.isneginf([1, -np.inf, np.inf])
print("Is negative infinity:", bd)
be = np.isposinf([1, np.inf, -np.inf])
print("Is positive infinity:", be)
bf = np.isnan([1, np.nan, 3])
print("Is NaN:", bf)
bg = np.isfinite([1, np.inf, np.nan])
print("Is finite:", bg)
bh = np.isreal([1, 2 + 0j, 3])
print("Is real:", bh)
bi = np.iscomplex([1, 2 + 1j, 3])
print("Is complex:", bi)
bj = np.isscalar(3.1)
print("Is scalar:", bj)
bk = np.isfortran(np.array([[1, 2], [3, 4]], order='F'))
print("Is Fortran contiguous:", bk)
# Financial functions
print("\nFinancial functions:")
cash_flows = [-1000, 300, 300, 300, 300]
bl = npf.npv(0.1, cash_flows)
print("Net present value:", bl)
# Linear algebra
print("\nLinear algebra:")
bm = np.dot([1, 2], [3, 4])
print("Dot product:", bm)
bn = np.vdot([1, 2], [3, 4])
print("Vector dot product:", bn)
bo = np.diag([1, 2, 3])
print("Diagonal array:\n", bo)
bp = np.diagflat([[1, 2], [3, 4]])
print("Diagonal flat array:\n", bp)
bq = np.diag_indices(3)
print("Diagonal indices:", bq)
# Random functions
print("\nRandom functions:")
br = np.random.rand(2, 3)
print("Random values:\n", br)
bs = np.random.randn(2, 3)
print("Standard normal random values:\n", bs)
# Array equivalence
print("\nArray equivalence:")
bt = np.array_equal([1, 2], [1, 2])
print("Array equal:", bt)
bu = np.array_equiv([1, 2], [1, 2])
print("Array equivalent:", bu)
# Other functions
print("\nOther functions:")
bv = np.nan_to_num([1, np.nan, np.inf])
print("NaN to num:", bv)
bw = np.bincount([1, 1, 2, 2, 2, 3])
print("Bincount:", bw)
bx = np.prod([1, 2, 3, 4])
print("Product of elements:", bx)
# Print all
print("\nShowing all functions with examples executed successfully.")

Creating arrays:
Zeros array:
[[0. 0. 0.]
[0. 0. 0.]]
Ones array:
[[1. 1. 1.]
[1. 1. 1.]]
Empty array:
[[1. 1. 1.]
[1. 1. 1.]]
Identity matrix:
[[1. 0. 0.]
[0. 1. 0.]
[0. 0. 1.]]
Arange array:
[0 1 2 3 4 5 6 7 8 9]
Tiled array:
[[0 1 2 3 4 5 6 7 8 9]
[0 1 2 3 4 5 6 7 8 9]]
Array manipulation:
Reshaped array:
[[0. 0.]
[0. 0.]
[0. 0.]]
Flattened array:
[0. 0. 0. 0. 0. 0.]
Transposed array:
[[1. 1.]
[1. 1.]
[1. 1.]]
Rolled array:
[8 9 0 1 2 3 4 5 6 7]
Flipped array:
[9 8 7 6 5 4 3 2 1 0]
Flip up-down:
[[0. 0. 1.]
[0. 1. 0.]
[1. 0. 0.]]
Rotate 90 degrees:
[[0. 0. 1.]
[0. 1. 0.]
[1. 0. 0.]]
Appended array:
[ 0 1 2 3 4 5 6 7 8 9 10 11 12]
Inserted array:
[ 0 1 100 200 2 3 4 5 6 7 8 9]
Deleted elements:
[0 3 4 5 6 7 8 9]
Compressed array:
[0 2 4 6 8]
Statistical functions:
Max value: 9
Min value: 0
Index of max value: 9
Index of min value: 0
Mathematical functions:
Hypotenuse: 5.0
Absolute values: [1 2 3]
Ceiling values: [2. 3. 4.]
Floor values: [1. 2. 3.]
Truncated values: [1. 2. 3.]
Exponential values: [ 2.71828183 7.3890561 20.08553692]
Logarithm values: [0. 0.69314718 1.09861229]
Square root values: [1. 2. 3.]
Power values: [1 4 9]
Radians to degrees: 180.0
Degrees to radians: [0. 0.78539816 1.57079633]
Sine value: 1.0
Cosine value: -1.0
Tangent value: 0.9999999999999999
Inverse sine value: 1.5707963267948966
Inverse cosine value: 0.0
Inverse tangent value: 0.7853981633974483
Hyperbolic sine value: 1.1752011936438014
Hyperbolic cosine value: 1.5430806348152437
Hyperbolic tangent value: 0.7615941559557649
Arctan2 value: 0.7853981633974483
Logical functions:
Logical AND: [False False]
Logical OR: [ True False]
Logical NOT: [False True]
Logical XOR: [ True False]
All elements true: False
Any element true: True
Comparison functions:
Equal: [ True True True]
Not equal: [False False True]
Greater: [ True False True]
Greater or equal: [ True True True]
Less: [ True False True]
Less or equal: [ True True True]
Array properties:
Is infinity: [False True True]
Is negative infinity: [False True False]
Is positive infinity: [False True False]
Is NaN: [False True False]
Is finite: [ True False False]
Is real: [ True True True]
Is complex: [False True False]
Is scalar: True
Is Fortran contiguous: True
Financial functions:
Net present value: -49.04036609521219
Linear algebra:
Dot product: 11
Vector dot product: 11
Diagonal array:
[[1 0 0]
[0 2 0]
[0 0 3]]
Diagonal flat array:
[[1 0 0 0]
[0 2 0 0]
[0 0 3 0]
[0 0 0 4]]
Diagonal indices: (array([0, 1, 2]), array([0, 1, 2]))
Random functions:
Random values:
[[0.41881471 0.93987263 0.98513916]
[0.03033517 0.20903192 0.13852383]]
Standard normal random values:
[[ 0.59040804 1.18000044 0.58541594]
[-1.78584691 -1.5988533 1.89104066]]
Array equivalence:
Array equal: True
Array equivalent: True
Other functions:
NaN to num: [1.00000000e+000 0.00000000e+000 1.79769313e+308]
Bincount: [0 2 3 1]
Product of elements: 24
Showing all functions with examples executed successfully.

Leave a Reply

Your email address will not be published. Required fields are marked *