Silver Oak College of Computer Application: Subject:Machine Learning
Silver Oak College of Computer Application: Subject:Machine Learning
• Conclusion:
The machine learning workflow involves several iterative steps, starting from data collection to
deploying the trained model for real-world use. Each step is crucial for building accurate and reliable
machine learning models. By following this workflow and continuously improving the model, we can
leverage the power of machine learning to solve a wide range of problems effectively.
• Machine Learning, as the name suggests, is the science of programming a computer by which they are able
to learn from different kinds of data.
• A more general definition given by Arthur Samuel is – “Machine Learning is the field of study that gives
computers the ability to learn without being explicitly programmed.” They are typically used to solve
various types of life problems.
• In the older days, people used to perform Machine Learning tasks by manually coding all the algorithms
and mathematical and statistical formulas.
• This made the processing time-consuming, tedious, and inefficient. But in the modern days, it is become
very much easy and more efficient compared to the olden days with various python libraries, frameworks,
and modules.
• Today, Python is one of the most popular programming languages for this task and it has replaced many
languages in the industry, one of the reasons is its vast collection of libraries.
• Python libraries that are used in Machine Learning are:
• Numpy
• Scikit-learn
• Pandas
• Matplotlib
• 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 Tensor Flow uses NumPy internally for manipulation of Tensors.
• NumPy is a Python library used for working with arrays.
• Functions:
• array() : We can create a NumPy ndarray object by using the array() function.
• concatenate() : we can join the array.
• arange(): This function is used to create an array with a range of values.
• array_split(): We use array_split() for splitting arrays, we pass it the array we want to split and the
number of splits.
• sort() : The NumPy ndarray object has a function called sort(), that will sort a specified array.
• random.randint(): This function is used to create an array with random integer values between a
specified range.
• max(): This function is used to find the maximum value in an array.
• min(): This function is used to find the minimum value in an array.
• mean(): This function is used to find the mean value of an array.
• median(): This function is used to find the median value of an array.
• dot(): This function is used to find the dot product of two arrays.
• Example: # Find Median
import numpy as np arr = np.array([1, 2, 3])
# Creating two arrays of rank 2 median_value = np.median(arr)
x = np.array([[1, 2], [3, 4]])
y = np.array([[5, 6], [7, 8]]) print(median_value)
data_table = pd.DataFrame(data)
print(data_table)
• Matplotlib is a low level graph plotting library in python that serves as a visualization utility.
• Matplotlib is a very popular Python library for data visualization. Like Pandas, it is not directly related to
Machine Learning. It particularly comes in handy when a programmer wants to visualize the patterns in the
data. It is a 2D plotting library used for creating 2D graphs and plots. A module named pyplot makes it easy
for programmers for plotting as it provides features to control line styles, font properties, formatting axes,
etc. It provides various kinds of graphs and plots for data visualization, viz., histogram, error charts, bar
chats, etc,
• Functions:
• plot() : This function is used to create line charts, scatter plots, and other types of plots. It takes x and y
values as inputs and can also accept optional arguments such as line style, marker style, and color. This
function is the backbone of most Matplotlib visualizations.
• xlabel() & ylabel() : These functions are used to label the x-axis and y-axis, respectively. They take a
string as input and can also accept optional arguments such as font size, font weight, and color.
• title() : This function is used to add a title to the plot. It takes a string as input and can also accept
optional arguments such as font size, font weight, and color.
• grid() : This function to add grid lines to the plot.
• scatter() : This function plots one dot for each observation. It needs two arrays of the same length, one
for the values of the x-axis, and one for values on the y-axis.
• bar(): This function is used for Bar graph.
Example:
import matplotlib.pyplot as plt
# data to display on plots
x = [3, 1, 3]
y = [3, 2, 1]
plt.plot(x, y)
plt.title("Line Chart")
plt.legend(["Line"])
plt.show()
# This will plot a simple bar chart
plt.bar(x, y)
# Title to the plot
plt.title("Bar Chart")