Join the conversation
differnce kia python ka chilla aur data scince and ai me
Reply
will u not teach us vector spaces
Reply
very good lecture by baba jee
Reply
Algebra has numerous applications in various fields, including science, engineering, economics, computer science, and data analysis, where it is used to model and solve problems, analyze data, and make predictions, playing a crucial role in understanding and describing the world around us.
Reply
Algebra has numerous applications in various fields, including science, engineering, economics, computer science, and data analysis, where it is used to model and solve problems, analyze data, and make predictions, playing a crucial role in understanding and describing the world around us.
Reply
Done
Reply
GOOD HOGIA SIR
Reply
done sir g .....
DONE
Reply
Algebra is a part of mathematics that deals with symbols and the standards for controlling those symbols. The more basic parts of algebra are called elementary algebra, and the more abstract types are called Abstract Algebra or modern algebra.
Algebraic Expression
Let us consider the pattern below. It has been created using marbles. Here we see that the first column has 2 marbles, the second column has 3 marbles, the third column has 4 marbles and so on.https://d138zd1ktt9iqe.cloudfront.net/media/seo_landing_files/a2-1603869569.png
Thus we observe that every new column increases by 1 marble. We can write the representation asThe number of marbles used in a column =position of the column + 1or asthe number of marbles used in a column = n + 1.Here n represents the position of the column. So ‘n’ is an example for a variable that can take any value 1,2,3… so on. Thus n + 1 is the algebraic expression formed with n as variable and constant 1.
Variable
Speed of a car imageA variable is a number that does not have a fixed value. The picture and the list below show some real-life examples, where the value of a variable changes with the change in place and time.The temperature in different places also change.
The height of a growing child changes with time.
The speed of a car changes with time.
The age of people keeps on increasing year by year.
https://d138zd1ktt9iqe.cloudfront.net/media/seo_landing_files/a3-1603869675.png
Constant
The value remains fixed for specific numbers that represent quantities or ideas that will not change. For example, the date of birth of a particular person, the normal human body temperature and capacity of a given container.
Examples
1. Amanda has 10 storybooks more than Alex. Express the number of storybooks Amanda has in terms of the number of storybooks Alex has.Let the number of storybooks Alex has = yTherefore the number of storybooks Amanda has = y + 102. Sweets from a big box are equally distributed in 10 small boxes. Express the number of sweets in one small box in terms of the total number of sweets.Let x be the total number of sweets.
Number of sweet boxes = 10Therefore, the number of sweets in one box is = x/10
Solving Equations
Let us see how practical applications of algebra can be used to solve equations. You will often see equations like 3x + 4 = 5, where you want to find x.Consider a situation from our daily life.The cost of a book is £5 more than the cost of a pen. Let us take the cost of the pen as £x. Then the cost of the book is £ (x + 5) . If the cost of the book is £20, what is the cost of the pen?We know that the book’s cost is x + 5 and it is given that x + 5 = 20. This is an equation in the variable x.A table is prepared as shown below for various values of x:x 8 9 10 11 12 13 14 15 16
x + 5 13 14 14 16 17 18 19 20 21It is clear from the table that x + 5 = 20 only for x = 15. So, the cost of the pen is £15.In general we say that x = 15 is the solution of the equation x + 5 = 20. This is the trial and error method where we substitute different values for the variable that satisfies the given equation.An equation has two parts which are connected by an equal to sign. The two parts or sides of an equation are denoted as LHS (Left Hand Side) and RHS (Right Hand Side). If LHS = RHS we get an equation. 2x = 6 is analgebraic equation, whereas 3x > 10 or 4x < 12 are not equations.
Solving an equation using the Principle of Balances
Consider the balance given in the figure.
https://d138zd1ktt9iqe.cloudfront.net/media/seo_landing_files/a4-1603870066.png
Four circles balance one square and a circle on the other side. The idea is we have to find out how many circles will balance a square. If we remove the circle from the left pan, we have only the square there. Since we removed a circle from the left pan, we have to remove the circle from the right pan also. Then there will be three circles in the right pan.Now the balance looks like the one shown on the right. This is called the principle of balances. Using balancing equations, we can solve equations in a systematic way.
Example:Solve using the principle of balances:
Benjamin's mother is three times as old as Benjamin. If Benjamin's mother is 39 years old, find Benjamin's age.Solution:Let Benjamin's age be x.Benjamin’s mother's age 3x = 393x/3 = 39/3 {Dividing by 3 on both the sides }So, Benjamin’s age = 13.
The same quantity can be added or subtracted to both sides of the equation. If the same amount is multiplied or divided on both the sides of an equation, it remains the same.
hen people think of data science in general, or of specific sub-fields like natural language processing, machine learning or computer vision, they rarely consider linear algebra. We often overlook linear algebra because the contemporary tools we use to implement data science algorithms do an excellent job of hiding the underlying math that makes everything work.Most of the time, people avoid getting into linear algebra because it’s difficult or hard to understand. Fair enough, but familiarity with linear algebra is nevertheless an essential skill for data scientists and computer engineers.“But Sara,” you might say, “I can implement many algorithms in machine learning and data science without needing to know the math!” While that may be true to an extent, having a grasp on the fundamental mathematical principles behind the algorithms gives you a new perspective of that algorithm, hence opening up more avenues for you to explore.In this article, I’ll discuss applications of linear algebra in three data science sub-fields. Let’s jump in!
LINEAR ALGEBRA APPLICATIONS FOR DATA SCIENTISTS
Machine learning: loss functions and recommender systems
Natural language processing: word embedding
Computer vision: image convolution
. Machine Learning
Machine learning is, without a doubt, the most widely-known application of artificial intelligence (AI). Using machine learning algorithms, systems can automatically learn and improve with experience without human interference. Machine learning functions by building programs that access and analyze data (whether static or dynamic ) to find patterns and learn from. Once the program discovers relationships in the data, it can apply this knowledge to new data sets. (You can read more about how algorithms learn here.).Linear algebra has several applications in machine learning, such as loss functions, regularization, support vector classification and many more. For our purposes, we’ll look at linear algebra in loss functions.LOSS FUNCTION
So, we know machine learning algorithms work by collecting data, analyzing it, and building a model using one of many approaches (linear regression, logistic regression, decision tree, random forest, etc.). Then, based on the results, they can predict future data queries.But...How can you measure the accuracy of your prediction model?Well, by using linear algebra — loss functions, in particular. In short, loss functions are a method of evaluating the accuracy of your prediction models. Will your model perform well with new data sets? If your model is totally off, your loss function will output a higher number. Whereas, with a good model, the loss function will output a lower number.Regression is modeling a relationship between a dependent variable, Y, and several independent variables, Xi’s. After plotting these points, we try to fit a line in space on these variables and then use this line to predict future values of Xi’s.There are many types of loss functions, some of which are more complicated than others; however, the most commonly used two are Mean Squared Error and Mean Absolute Error.Mean Squared Error
Mean Squared Error (MSE) is probably the most used loss error approach because it’s easy to understand, implement and generally works quite well in most regression problems. Most Python libraries like NumPy, Scikit, and TensorFlow have their own built-in implementation of the MSE functionality. Nevertheless, they all work based on the same equation:linear algebra data science
Here, N is the number of data points in both the observed and predicted values.Steps of calculating the MSE:Calculate the difference between each pair of the observed and predicted values.Take the square of the difference.Add the squared differences together to find the cumulative value.Calculate the average error of the cumulative sum.Here is the Python code to calculate and plot the MSE.#Import needed libraries
import matplotlib.pyplot as plt
#Set data
x = list(range(1,6)) #data points
y = [1,1,2,2,4] #original values
y_bar = [0.6,1.29,1.99,2.69,3.4] #predicted values
summation = 0
n = len(y)
for i in range(0, n):
# finding the difference between observed and predicted value
difference = y[i] - y_bar[i]
squared_difference = difference**2 # taking square of the differene
# taking a sum of all the differences
summation = summation + squared_difference
MSE = summation/n # get the average of all
print("The Mean Square Error is: ", MSE)
#Plot relationship
plt.scatter(x, y, color='#06AED5')
plt.plot(x, y_bar, color='#1D3557', linewidth=2)
plt.xlabel('Data Points', fontsize=12)
plt.ylabel('Output', fontsize=12)
plt.title("MSE")
Most data scientists don’t like to use the MSE because it may not be a perfect representation of the error. However, we usually use the MSE as an intermediate step to Root Mean Squared Error (RMSE), which you can find easily by taking the square root of the MSE.Mean Absolute Error
The Mean Absolute Error (MAE) is quite similar to the MSE; the difference is, we calculate the absolute difference between the observed data and the protected one.linear algebra data science
The MAE cost is more robust compared to MSE. However, a disadvantage of MAE is that handling the absolute or modulus operator in mathematical equations isn’t easy. Even so, MAE is the most intuitive of all the loss function calculating methods.2. Computer Vision
Computer vision is a field of artificial intelligence that trains computers to interpret and understand the visual world by using images, videos and deep learning models. Doing so allows algorithms to accurately identify and classify objects. In other words, algorithms learn to see visual data.In computer vision, we use linear algebra in applications such as image recognition including some image processing techniques such as image convolution and image representation as tensors (or as we call them in linear algebra, vectors).IMAGE CONVOLUTION
I know what you’re thinking. “Convolution” sounds pretty...convoluted. The truth is, it’s really not! Even if you don’t think you’ve ever done computer vision before, I’m sure you’ve either done image convolution or at least seen it in action. Have you ever blurred or smoothed an image? That’s convolution!Convolutions are one of the fundamental building-blocks in computer vision in general (and image processing in particular). To put it succinctly, convolution is an element-wise multiplication of two matrices followed by a sum. In image processing applications, a multidimensional array represents mages. An array is multi-dimensional when it has rows and columns representing the pixels of the image as well as other dimensions for the color data. For example, RGB images have a depth of three and we use them to describe any pixel’s corresponding red, green and blue color.LOOKING FOR MORE APPLICATIONS OF COMPUTER VISION?
How Do Self-Driving Cars Work?One way to think about image convolution is to think about the image as a big matrix and a kernel (i.e. the convolutional matrix) as a small matrix used for blurring, sharpening, edge detection or any other image processing functions. So, this kernel passes on top of the image sliding from left to right and in a top to bottom motion. While doing that, it applies some mathematical operation at each (x, y) coordinate of the image to produce a convoluted image.Different kernels perform different types of image convolutions. Kernels are always square matrices. They are often 3x3 but you can reshape it based on the image dimensions.To perform image convolution in Python, data scientists mostly use the OpenCV library. However, we can create arbitrary images using NumPy to practice our knowledge. Here’s a Python code to detect vertical edges in a “fake” image (NumPy array).
#Import needed libraries
import numpy as np
import matplotlib.pyplot as plt# Create three images with different features
plain_img = np.array([np.array([100, 100]), np.array([100, 100])])
img_with_edge = np.array([np.array([100, 0]), np.array([100, 0])])#Create a kernel to detect vertical edges (sobel, gradient edge detecting kernel)
kernel_vertical = np.array([np.array([2, -2]), np.array([2, -2])])#Function to apply a kernel to an image
# elementwise multiplication followed by a sum
def apply_kernel(img, kernel):
return True if(np.sum(np.multiply(img, kernel))!=0) else False#---------------------------------------------------------------------------------# Plain Image (image with no edges)
plt.imshow(plain_img)
plt.axis('off')
plt.show()#Printing results of applying kernal 0 if an edge is not found
if apply_kernel(plain_img,kernel_vertical):
print("An edge has been found")
else:
print("No edges were found")#---------------------------------------------------------------------------------#Image with an edge
plt.imshow(img_with_edge)
plt.axis('off')
plt.show()#Printing results of applying kernel 0 if an edge is not found
if apply_kernel(img_with_edge,kernel_vertical):
print("An edge has been found")
else:
print("No edges were found")3. Natural Language Processing
Natural Language Processing (NLP) is a branch of artificial intelligence that deals with the interaction between computers and humans using natural language — most often, English. NLP includes applications such as ChatBots, speech recognition and text analysis. I assure you, you’ve used an NLP application before. Have you ever used Grammarly or any other text grammar editors? What about digital assistants like Siri or Alexa? They are built based on the concepts of NLP.
WORD EMBEDDING
Computers can’t understand text data — not on their own anyway. That's why we perform NLP techniques on text: We need to represent the test data numerically. Here’s where algebra comes in! Word embedding is a type of word representation that allows machine learning algorithms to understand words with similar meanings.Okay, where’s the math?Word embeddings represent words as vectors of numbers while preserving their context in the document. These representations are obtained by training different neural networks on a large amount of text called a corpus, a language modeling learning technique. One of the most used word embedding techniques is called Word2vec.
https://builtin.com/sites/www.builtin.com/files/styles/ckeditor_optimize/public/inline-images/5_linear%20algebra%20data%20science.png
Reply
Done
Reply