title

10.6: Neural Networks: Matrix Math Part 1 - The Nature of Code

description

In this video, I introduce the idea of "Linear Algebra" and explore the matrix math required for a simple neural network library.
Next video: https://youtu.be/n6q9D2wd1bE
This video is part of Chapter 10 of The Nature of Code (http://natureofcode.com/book/chapter-10-neural-networks/)
This video is also part of session 4 of my Spring 2017 ITP "Intelligence and Learning" course (https://github.com/shiffman/NOC-S17-2-Intelligence-Learning/tree/master/week4-neural-networks)
Support this channel on Patreon: https://patreon.com/codingtrain
To buy Coding Train merchandise: https://www.designbyhumans.com/shop/codingtrain/
To donate to the Processing Foundation: https://processingfoundation.org/
Send me your questions and coding challenges!: https://github.com/CodingTrain/Rainbow-Topics
Contact:
Twitter: https://twitter.com/shiffman
The Coding Train website: http://thecodingtrain.com/
Links discussed in this video:
The Nature of Code: http://natureofcode.com/
Session 4 of Intelligence and Learning: https://github.com/shiffman/NOC-S17-2-Intelligence-Learning/tree/master/week4-neural-networks
My Simple Artificial Neural Network JavaScript Library: https://github.com/shiffman/Neural-Network-p5
Khan Academy's Linear Algebra class: https://www.khanacademy.org/math/linear-algebra
3Blue1Brown's Essence of Linear Algebra: https://www.youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab
Brendan Fortuner's Linear algebra cheat sheet for deep learning: https://medium.com/towards-data-science/linear-algebra-cheat-sheet-for-deep-learning-cd67aba4526c
Math.js: http://mathjs.org/
GPU.js: http://gpu.rocks/
Books discussed in this video:
Tariq Rashid's Make Your Own Neural Network: http://amzn.to/2tcVeFS
Marvin Minsky's Perceptrons: http://amzn.to/2u8Jv8f
Source Code for the all Video Lessons: https://github.com/CodingTrain/Rainbow-Code
p5.js: https://p5js.org/
Processing: https://processing.org
The Nature of Code playlist: https://www.youtube.com/user/shiffman/playlists?view_as=subscriber&shelf_id=6&view=50&sort=dd
For More Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
For More Intelligence and Learning: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6YJ3XfHhT2Mm4Y5I99nrIKX
Help us caption & translate this video!
http://amara.org/v/8Q8P/
ðŸ“„ Code of Conduct: https://github.com/CodingTrain/Code-of-Conduct

detail

{'title': '10.6: Neural Networks: Matrix Math Part 1 - The Nature of Code', 'heatmap': [{'end': 422.281, 'start': 388.496, 'weight': 0.74}, {'end': 710.9, 'start': 685.14, 'weight': 0.808}, {'end': 845.145, 'start': 829.943, 'weight': 0.709}], 'summary': 'Series explores the fundamentals of neural networks, focusing on neural network library programming, linear algebra, vector operations, matrix operations in javascript, and the creation of a custom matrix library, providing practical insights and demonstrations for implementation.', 'chapters': [{'end': 124.726, 'segs': [{'end': 73.817, 'src': 'embed', 'start': 26.469, 'weight': 0, 'content': [{'end': 40.977, 'text': "And I want to reference actually there's a nice Medium post about what linear algebra you need to know for deep learning that I will show you on my laptop in a second and link to it in the video where I read that post this morning.", 'start': 26.469, 'duration': 14.508}, {'end': 43.879, 'text': 'It helped me gather my thoughts for this particular set of videos.', 'start': 40.997, 'duration': 2.882}, {'end': 49.702, 'text': "So what I've done so far is I've established that we need this idea.", 'start': 43.919, 'duration': 5.783}, {'end': 62.415, 'text': "of linear algebra in order to perform some of the math in the neural network library that I'm building.", 'start': 51.573, 'duration': 10.842}, {'end': 71.156, 'text': 'So what I want to do is take a break from the neural network stuff itself and look at the linear algebra stuff in a vacuum and, yes, finally,', 'start': 62.855, 'duration': 8.301}, {'end': 73.817, 'text': 'actually hopefully write some code,', 'start': 71.156, 'duration': 2.661}], 'summary': 'Linear algebra essential for neural network math in the library being built.', 'duration': 47.348, 'max_score': 26.469, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uSzGdfdOoG8/pics/uSzGdfdOoG826469.jpg'}, {'end': 136.532, 'src': 'embed', 'start': 105.34, 'weight': 3, 'content': [{'end': 106.84, 'text': 'This is not a course in linear algebra.', 'start': 105.34, 'duration': 1.5}, {'end': 109.781, 'text': "There's actually some great linear algebra videos on Khan Academy.", 'start': 106.86, 'duration': 2.921}, {'end': 111.622, 'text': "Probably there's some other ones out there.", 'start': 110.221, 'duration': 1.401}, {'end': 114.443, 'text': 'I will link to additional resources in the description of this video.', 'start': 111.722, 'duration': 2.721}, {'end': 121.725, 'text': 'What I want to do is cover the aspects of linear algebra that are necessary or relevant to the neural network stuff.', 'start': 114.463, 'duration': 7.262}, {'end': 124.726, 'text': 'and kind of leave out the rest.', 'start': 123.506, 'duration': 1.22}, {'end': 131.35, 'text': "So I'm going to give that an attempt and see how it goes and write code along with it and you'll let me know how that goes.", 'start': 124.886, 'duration': 6.464}, {'end': 132.73, 'text': "Okay, so here's the thing.", 'start': 131.53, 'duration': 1.2}, {'end': 136.532, 'text': 'There are two key concepts in linear algebra.', 'start': 133.531, 'duration': 3.001}], 'summary': 'Covering necessary linear algebra for neural networks, linking to additional resources.', 'duration': 31.192, 'max_score': 105.34, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uSzGdfdOoG8/pics/uSzGdfdOoG8105340.jpg'}], 'start': 1.018, 'title': 'Neural network library and linear algebra', 'summary': 'Discusses programming a neural network library and the importance of understanding linear algebra for implementation, stressing core aspects for building the library.', 'chapters': [{'end': 124.726, 'start': 1.018, 'title': 'Neural network library and linear algebra', 'summary': 'Discusses the process of programming a neural network library and the relevance of linear algebra to the implementation, emphasizing the need to understand the core aspects of linear algebra for building the neural network library.', 'duration': 123.708, 'highlights': ['The relevance of linear algebra in performing mathematical operations within the neural network library is emphasized, with the focus on understanding the necessary core aspects of linear algebra for the implementation.', 'The importance of referencing a Medium post about the required linear algebra for deep learning is mentioned, providing valuable insights for gathering thoughts and understanding the concepts.', 'The intention to take a break from the neural network implementation to focus on the essential linear algebra concepts and to write code that can be applied to the neural network is highlighted, indicating a practical approach to the learning process.', 'The mention of old linear algebra textbooks and the acknowledgment of additional resources, such as Khan Academy videos, for learning linear algebra are discussed, indicating the utilization of diverse learning materials for understanding relevant concepts.']}], 'duration': 123.708, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uSzGdfdOoG8/pics/uSzGdfdOoG81018.jpg', 'highlights': ['The relevance of linear algebra in performing mathematical operations within the neural network library is emphasized, with the focus on understanding the necessary core aspects of linear algebra for the implementation.', 'The intention to take a break from the neural network implementation to focus on the essential linear algebra concepts and to write code that can be applied to the neural network is highlighted, indicating a practical approach to the learning process.', 'The importance of referencing a Medium post about the required linear algebra for deep learning is mentioned, providing valuable insights for gathering thoughts and understanding the concepts.', 'The mention of old linear algebra textbooks and the acknowledgment of additional resources, such as Khan Academy videos, for learning linear algebra are discussed, indicating the utilization of diverse learning materials for understanding relevant concepts.']}, {'end': 447.176, 'segs': [{'end': 194.351, 'src': 'embed', 'start': 167.925, 'weight': 1, 'content': [{'end': 174.53, 'text': 'That two-dimensional vector from, and of course it could be a z if it were a three-dimensional vector for all the computer graphics and animation,', 'start': 167.925, 'duration': 6.605}, {'end': 176.151, 'text': "physics, simulation stuff I've done in previous videos.", 'start': 174.53, 'duration': 1.621}, {'end': 183.026, 'text': 'We could consider a vector as just an n-dimensional list of values.', 'start': 178.063, 'duration': 4.963}, {'end': 187.228, 'text': 'And I could make the notation like this.', 'start': 184.827, 'duration': 2.401}, {'end': 191.83, 'text': 'And I could say x0, x1, x2, x3, x4, x5.', 'start': 187.248, 'duration': 4.582}, {'end': 194.351, 'text': 'So this is a five-dimensional vector.', 'start': 192.45, 'duration': 1.901}], 'summary': 'Vectors can be represented as n-dimensional lists of values, e.g., a 5-dimensional vector as x0, x1, x2, x3, x4, x5.', 'duration': 26.426, 'max_score': 167.925, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uSzGdfdOoG8/pics/uSzGdfdOoG8167925.jpg'}, {'end': 277.102, 'src': 'embed', 'start': 218.44, 'weight': 0, 'content': [{'end': 228.104, 'text': "I'm going to use this square bracket notation for the algorithms and examples I'm going to demonstrate in this video and in future videos.", 'start': 218.44, 'duration': 9.664}, {'end': 229.705, 'text': "So that's the idea of a vector.", 'start': 228.725, 'duration': 0.98}, {'end': 234.999, 'text': 'Now, if you also recall, We can do math with vectors.', 'start': 229.765, 'duration': 5.234}, {'end': 237.681, 'text': 'And there are a few different kinds of operations.', 'start': 235.459, 'duration': 2.222}, {'end': 240.802, 'text': "There's the idea of a scalar operation.", 'start': 238.661, 'duration': 2.141}, {'end': 244.744, 'text': "Let's say I have the vector 2, 3.", 'start': 241.043, 'duration': 3.701}, {'end': 248.687, 'text': 'And I multiply that by the number 2.', 'start': 244.745, 'duration': 3.942}, {'end': 253.63, 'text': 'I could take this scalar value, the single value, and multiply it by each component of the vector.', 'start': 248.687, 'duration': 4.943}, {'end': 259.19, 'text': 'And I would now have 4, 6.', 'start': 255.491, 'duration': 3.699}, {'end': 263.515, 'text': 'There also are operations that are referred to as element-wise.', 'start': 259.192, 'duration': 4.323}, {'end': 271.019, 'text': 'This is the kind of operation that I did over and over again if I had a velocity vector and a position vector.', 'start': 266.176, 'duration': 4.843}, {'end': 277.102, 'text': 'So if I had a position vector, that was something like 2, 3.', 'start': 271.479, 'duration': 5.623}], 'summary': 'Introduction to vector operations including scalar and element-wise operations.', 'duration': 58.662, 'max_score': 218.44, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uSzGdfdOoG8/pics/uSzGdfdOoG8218440.jpg'}, {'end': 358.556, 'src': 'embed', 'start': 333.127, 'weight': 3, 'content': [{'end': 338.128, 'text': 'We really needed the dot product to figure out how to get a moving agent to follow a path.', 'start': 333.127, 'duration': 5.001}, {'end': 350.23, 'text': 'And the way the dot product works is we take two vectors and get a single scalar value.', 'start': 338.748, 'duration': 11.482}, {'end': 354.713, 'text': 'So you can see these scalar operations, a vector by a times a single number, we get a vector.', 'start': 350.53, 'duration': 4.183}, {'end': 358.556, 'text': 'These element-wise operations, a vector plus a vector, we get a vector.', 'start': 354.933, 'duration': 3.623}], 'summary': 'Dot product used to guide moving agent on a path.', 'duration': 25.429, 'max_score': 333.127, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uSzGdfdOoG8/pics/uSzGdfdOoG8333127.jpg'}, {'end': 434.731, 'src': 'heatmap', 'start': 388.496, 'weight': 5, 'content': [{'end': 393.761, 'text': 'Kind of like that weighted sum thing that I was doing earlier in the neural network, in the perceptron stuff.', 'start': 388.496, 'duration': 5.265}, {'end': 402.15, 'text': 'So I would take 2 times negative 1, which is negative 2, plus 3 times 5, which is 15.', 'start': 394.022, 'duration': 8.128}, {'end': 405.073, 'text': 'And I would get 13.', 'start': 402.15, 'duration': 2.923}, {'end': 406.875, 'text': 'So that is the dot product.', 'start': 405.073, 'duration': 1.802}, {'end': 409.317, 'text': 'So I could take the next step.', 'start': 407.375, 'duration': 1.942}, {'end': 414.769, 'text': 'And I could start to write code for all these operations for vectors.', 'start': 410.663, 'duration': 4.106}, {'end': 422.281, 'text': "but I'm not going to bother with that, because ultimately what I need for the neural network library is the matrix stuff.", 'start': 414.769, 'duration': 7.512}, {'end': 427.948, 'text': "But I'm starting with the vector stuff because it's all going to translate It's all going to be analogous.", 'start': 422.381, 'duration': 5.567}, {'end': 434.731, 'text': "But I should point out that this is all in, if you're in p5.js, for example, there's p5.vector.js.", 'start': 428.168, 'duration': 6.563}], 'summary': 'Exploring dot product and vector operations for neural network library development.', 'duration': 46.235, 'max_score': 388.496, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uSzGdfdOoG8/pics/uSzGdfdOoG8388496.jpg'}], 'start': 124.886, 'title': 'Linear algebra and vector operations', 'summary': 'Explains vectors in linear algebra, their use in 2d and n-dimensional spaces, notations, and operations like scalar, element-wise, and vector multiplication. it also discusses the dot product, its application in pathfinding, vector operations, and insights into upcoming matrix operations, within the context of p5.js and neural network library development.', 'chapters': [{'end': 310.004, 'start': 124.886, 'title': 'Linear algebra: vectors and matrices', 'summary': 'Explains the concept of vectors in linear algebra, including their use in two-dimensional and n-dimensional spaces, various notations, and different kinds of operations such as scalar, element-wise, and vector multiplication.', 'duration': 185.118, 'highlights': ['The chapter explains the concept of vectors in linear algebra, including their use in two-dimensional and n-dimensional spaces, various notations, and different kinds of operations such as scalar, element-wise, and vector multiplication.', 'Vectors can be used for forces, velocity, physics simulations, and computer graphics, and can be represented as n-dimensional lists of values.', 'The different kinds of operations on vectors include scalar operations, element-wise operations, and vector multiplication.']}, {'end': 447.176, 'start': 310.064, 'title': 'Dot product and vector operations', 'summary': 'Discusses the dot product and its application in pathfinding, emphasizing the importance of vector operations and providing insights into the upcoming matrix operations, all within the context of p5.js and neural network library development.', 'duration': 137.112, 'highlights': ["The dot product is used to calculate the angle between two vectors and for pathfinding in a moving agent's path, with a specific example of using the dot product to calculate the angle between vectors. The dot product is utilized to find the angle between two vectors and in pathfinding for moving agents, exemplified by its use in calculating the angle between vectors.", 'The dot product involves multiplying corresponding elements of two vectors and summing the results, and is a fundamental operation for matrix operations and neural network library development. The dot product entails multiplying corresponding elements of two vectors and summing the products, serving as a crucial operation for matrix operations and neural network library development.', 'The chapter emphasizes the transition from vector operations to matrix operations, highlighting their analogous nature and their significance in neural network library development. The chapter underscores the shift from vector operations to matrix operations, emphasizing their analogous nature and their importance in the development of neural network libraries.']}], 'duration': 322.29, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uSzGdfdOoG8/pics/uSzGdfdOoG8124886.jpg', 'highlights': ['The chapter explains the concept of vectors in linear algebra, including their use in two-dimensional and n-dimensional spaces, various notations, and different kinds of operations such as scalar, element-wise, and vector multiplication.', 'Vectors can be used for forces, velocity, physics simulations, and computer graphics, and can be represented as n-dimensional lists of values.', 'The different kinds of operations on vectors include scalar operations, element-wise operations, and vector multiplication.', "The dot product is used to calculate the angle between two vectors and for pathfinding in a moving agent's path, with a specific example of using the dot product to calculate the angle between vectors.", 'The dot product involves multiplying corresponding elements of two vectors and summing the results, and is a fundamental operation for matrix operations and neural network library development.', 'The chapter emphasizes the transition from vector operations to matrix operations, highlighting their analogous nature and their significance in neural network library development.']}, {'end': 771.428, 'segs': [{'end': 510.882, 'src': 'embed', 'start': 480.982, 'weight': 0, 'content': [{'end': 483.003, 'text': 'Data in a spreadsheet is in a matrix.', 'start': 480.982, 'duration': 2.021}, {'end': 488.124, 'text': 'The weights of connections in a neural network can be stored in a matrix.', 'start': 483.323, 'duration': 4.801}, {'end': 500.367, 'text': "So there are so many scenarios in programming where the numbers that we're working with are stored in a matrix and we can think of that like a two-dimensional array that we want to perform these kind of mathematical operations very,", 'start': 488.484, 'duration': 11.883}, {'end': 500.867, 'text': 'very often.', 'start': 500.367, 'duration': 0.5}, {'end': 510.882, 'text': 'So what is a matrix? A matrix, instead of a linear list of values, is a two-dimensional grid of values.', 'start': 501.287, 'duration': 9.595}], 'summary': 'Matrices are used for storing and manipulating two-dimensional data in various programming scenarios.', 'duration': 29.9, 'max_score': 480.982, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uSzGdfdOoG8/pics/uSzGdfdOoG8480982.jpg'}, {'end': 571.469, 'src': 'embed', 'start': 538.486, 'weight': 1, 'content': [{'end': 543.129, 'text': "So let's look at these kinds of mathematical operations now with a matrix.", 'start': 538.486, 'duration': 4.643}, {'end': 547.451, 'text': "So I could do a scalar, and this should be an a, I don't know, scalar operation.", 'start': 543.869, 'duration': 3.582}, {'end': 557.037, 'text': "So let's say I have the matrix 2, 3, negative 4, 9.", 'start': 547.491, 'duration': 9.546}, {'end': 564.486, 'text': 'And if I were to multiply that by the number 2, A scalar operation will just double all of these values.', 'start': 557.037, 'duration': 7.449}, {'end': 571.469, 'text': 'So this would give me then the matrix 4, 6, negative 8, 18.', 'start': 564.827, 'duration': 6.642}], 'summary': 'Multiplying a matrix by 2 doubles all its values.', 'duration': 32.983, 'max_score': 538.486, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uSzGdfdOoG8/pics/uSzGdfdOoG8538486.jpg'}, {'end': 653.432, 'src': 'embed', 'start': 622.424, 'weight': 2, 'content': [{'end': 624.125, 'text': "There's p5 as a matrix implementation.", 'start': 622.424, 'duration': 1.701}, {'end': 630.637, 'text': 'I am going to write my own just to kind of understand how it works.', 'start': 626.554, 'duration': 4.083}, {'end': 633.198, 'text': 'And then later, as part of this library,', 'start': 631.277, 'duration': 1.921}, {'end': 639.543, 'text': "I probably want to swap it out to have something more efficient that's going to actually do these matrix operations optimally.", 'start': 633.198, 'duration': 6.345}, {'end': 641.904, 'text': "But so let's create a new file.", 'start': 639.963, 'duration': 1.941}, {'end': 645.166, 'text': "I'm going to call it matrix.js.", 'start': 642.444, 'duration': 2.722}, {'end': 648.548, 'text': "And I'm going to write a constructor function.", 'start': 646.027, 'duration': 2.521}, {'end': 653.432, 'text': "And I'm going to call that matrix.", 'start': 651.75, 'duration': 1.682}], 'summary': 'Creating a matrix implementation in matrix.js for optimized matrix operations.', 'duration': 31.008, 'max_score': 622.424, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uSzGdfdOoG8/pics/uSzGdfdOoG8622424.jpg'}, {'end': 710.9, 'src': 'heatmap', 'start': 685.14, 'weight': 0.808, 'content': [{'end': 689.864, 'text': 'So for example, I can do this just here in the console now.', 'start': 685.14, 'duration': 4.724}, {'end': 699.851, 'text': "Oh, let's actually go to index.html and add in the neural network library and the matrix library now.", 'start': 690.204, 'duration': 9.647}, {'end': 706.897, 'text': 'And I should be able to say var m equals a new matrix, 3 comma 2.', 'start': 701.413, 'duration': 5.484}, {'end': 707.998, 'text': 'And I can see, there we go.', 'start': 706.897, 'duration': 1.101}, {'end': 710.9, 'text': 'I have a matrix object with three rows and two columns.', 'start': 708.018, 'duration': 2.882}], 'summary': 'Demonstrated creating a matrix with 3 rows and 2 columns in the console.', 'duration': 25.76, 'max_score': 685.14, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uSzGdfdOoG8/pics/uSzGdfdOoG8685140.jpg'}, {'end': 751.939, 'src': 'embed', 'start': 719.698, 'weight': 3, 'content': [{'end': 723.179, 'text': 'And this is 2 by 3, and I said 3 by 2, but whatever.', 'start': 719.698, 'duration': 3.481}, {'end': 726.4, 'text': "So let's initialize all the values as 0.", 'start': 724.12, 'duration': 2.28}, {'end': 736.504, 'text': 'So how do I do that? Well, ultimately, I need to have a variable.', 'start': 726.4, 'duration': 10.104}, {'end': 739.305, 'text': "And maybe I'll just actually call it matrix.", 'start': 736.704, 'duration': 2.601}, {'end': 740.825, 'text': 'You could call it values.', 'start': 739.905, 'duration': 0.92}, {'end': 741.466, 'text': "I don't know what to call it.", 'start': 740.845, 'duration': 0.621}, {'end': 744.987, 'text': "I'm going to call it matrix equals an array.", 'start': 741.486, 'duration': 3.501}, {'end': 751.939, 'text': 'Now, there are all sorts of sophisticated JavaScript ways.', 'start': 746.937, 'duration': 5.002}], 'summary': 'Initiated a 2x3 matrix with all values set to 0 in javascript.', 'duration': 32.241, 'max_score': 719.698, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uSzGdfdOoG8/pics/uSzGdfdOoG8719698.jpg'}], 'start': 447.376, 'title': 'Matrices in programming', 'summary': 'Introduces matrices in programming, demonstrating their relevance in storing pixels, spreadsheet data, and neural network weights, and discusses implementing a custom matrix library in javascript despite the availability of existing libraries.', 'chapters': [{'end': 589.937, 'start': 447.376, 'title': 'Understanding matrices in programming', 'summary': 'Introduces the concept of matrices in programming, explaining their relevance and use cases, such as storing pixels, data in a spreadsheet, and weights of connections in a neural network, and demonstrates a scalar operation on a matrix.', 'duration': 142.561, 'highlights': ['Matrices are two-dimensional grids of values, commonly used to store numbers in programming, with applications including pixel storage, spreadsheet data, and neural network connection weights.', 'The concept of a matrix is defined by its number of rows and columns, and mathematical operations, such as scalar operations, can be performed on matrices to manipulate their values.', 'A scalar operation on a matrix involves multiplying all of its values by a single number, effectively scaling the entire matrix.']}, {'end': 771.428, 'start': 589.977, 'title': 'Implementing a custom matrix library', 'summary': 'Discusses implementing a custom matrix library in javascript, despite the availability of existing extensive math.js, gpu.rocks, and p5 libraries, focusing on creating a constructor function and initializing values for a matrix with a plan to optimize later.', 'duration': 181.451, 'highlights': ['The chapter highlights the decision to create a custom matrix library in JavaScript despite the availability of existing extensive math.js, gpu.rocks, and p5 libraries, emphasizing the intention to understand the working principles and efficiency of matrix operations.', 'The speaker outlines the process of creating a constructor function for the matrix, specifying the number of rows and columns and demonstrating the instantiation of a matrix object with specific dimensions.', 'The chapter emphasizes the need to initialize the values of the matrix and discusses the approach of using an array for storing the values, with a focus on simplicity and the potential for future optimization.']}], 'duration': 324.052, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uSzGdfdOoG8/pics/uSzGdfdOoG8447376.jpg', 'highlights': ['Matrices store numbers in programming for pixels, spreadsheets, and neural networks.', 'Matrix operations include scalar operations for manipulating values.', 'Creating a custom matrix library in JavaScript to understand working principles and efficiency.', 'Emphasizing the need to initialize matrix values and using arrays for storage.']}, {'end': 1079.605, 'segs': [{'end': 909.065, 'src': 'heatmap', 'start': 829.943, 'weight': 0, 'content': [{'end': 831.304, 'text': "Let's go back to the browser.", 'start': 829.943, 'duration': 1.361}, {'end': 837.537, 'text': "And let's refresh the page and create that matrix again.", 'start': 833.212, 'duration': 4.325}, {'end': 845.145, 'text': 'And I should now see matrix has three rows and two columns, and then it has an array.', 'start': 838.638, 'duration': 6.507}, {'end': 853.322, 'text': 'Each one of these rows has two values, 00, 00, 00.', 'start': 846.747, 'duration': 6.575}, {'end': 857.927, 'text': 'So this is now we can see the data is actually stored in there.', 'start': 853.322, 'duration': 4.605}, {'end': 860.95, 'text': "So I've got the beginnings of a matrix library.", 'start': 858.247, 'duration': 2.703}, {'end': 865.294, 'text': 'Nothing about this is optimal or efficient, but I have a library,', 'start': 861.43, 'duration': 3.864}, {'end': 870.96, 'text': 'an object that stores the number of rows and the number of columns and creates a two dimensional array filled with zeros.', 'start': 865.294, 'duration': 5.666}, {'end': 880.987, 'text': "Okay, so now what I'm going to do So now we have the ability of a library to create this matrix.", 'start': 872.462, 'duration': 8.525}, {'end': 887.269, 'text': 'The next thing that I want to do is add a function that performs a scalar operation.', 'start': 881.427, 'duration': 5.842}, {'end': 892.43, 'text': "So for example, let's add a function that's called multiply.", 'start': 887.989, 'duration': 4.441}, {'end': 900.072, 'text': 'The wording of this is a little bit tricky, because ultimately matrix multiplication can mean a lot of different things.', 'start': 893.09, 'duration': 6.982}, {'end': 905.564, 'text': "But just for right now I'm going to write a function matrix.prototype.", 'start': 900.612, 'duration': 4.952}, {'end': 909.065, 'text': "that's part of the matrix object, all matrix objects.", 'start': 905.564, 'duration': 3.501}], 'summary': 'Creating a matrix library with 3 rows and 2 columns, filled with zeros, and adding a function for scalar operations.', 'duration': 90.429, 'max_score': 829.943, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uSzGdfdOoG8/pics/uSzGdfdOoG8829943.jpg'}, {'end': 974.765, 'src': 'embed', 'start': 948.955, 'weight': 1, 'content': [{'end': 953.679, 'text': "And then I'm going to quickly add another one for another scalar operation called add.", 'start': 948.955, 'duration': 4.724}, {'end': 959.34, 'text': "And I'm going to say plus equals.", 'start': 956.179, 'duration': 3.161}, {'end': 961.581, 'text': 'So again, this is this idea.', 'start': 960.18, 'duration': 1.401}, {'end': 962.881, 'text': "I've written two functions.", 'start': 961.621, 'duration': 1.26}, {'end': 964.702, 'text': 'These are scalar functions.', 'start': 963.121, 'duration': 1.581}, {'end': 968.983, 'text': 'I just want to take a single value and multiply every value in the matrix by that value.', 'start': 964.782, 'duration': 4.201}, {'end': 972.985, 'text': 'Or I want to take a single value and add it to every single value in the matrix.', 'start': 969.323, 'duration': 3.662}, {'end': 974.765, 'text': "That's what these two functions can do.", 'start': 973.285, 'duration': 1.48}], 'summary': 'Two scalar functions, multiply and add, for matrix operations.', 'duration': 25.81, 'max_score': 948.955, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uSzGdfdOoG8/pics/uSzGdfdOoG8948955.jpg'}], 'start': 771.748, 'title': 'Matrix operations in javascript', 'summary': "Covers the creation of a matrix library in javascript, including initializing matrices with 0 values, defining dimensions, and storing data. it also discusses the implementation of scalar operations such as 'multiply' and 'add' in a matrix object, with specific values and expected transformations demonstrated.", 'chapters': [{'end': 880.987, 'start': 771.748, 'title': 'Creating matrix library in javascript', 'summary': 'Demonstrates the process of creating a matrix library in javascript, including initializing a matrix with 0 values, defining its dimensions, and storing the data in a two-dimensional array.', 'duration': 109.239, 'highlights': ['The chapter describes the process of initializing a matrix with 0 values and defining its dimensions', 'It outlines the method of storing data in a two-dimensional array', 'The speaker acknowledges that the library created is not optimal or efficient']}, {'end': 1079.605, 'start': 881.427, 'title': 'Matrix scalar operations', 'summary': "Discusses the implementation of scalar operations in a matrix object, including the functions 'multiply' and 'add' which can perform scalar operations on a matrix, and demonstrates their use with specific values resulting in the expected matrix transformations.", 'duration': 198.178, 'highlights': ["The functions 'multiply' and 'add' are implemented to perform scalar operations on a matrix, allowing the user to multiply every value in the matrix by a single value or add a single value to every value in the matrix.", "The 'multiply' function loops through every row and column of the matrix to perform the scalar multiplication, while the 'add' function adds the specified value to every element in the matrix.", "The demonstration includes examples of using the 'add' and 'multiply' functions to transform a matrix, such as adding 5 to a matrix and then multiplying the matrix by -3 resulting in the expected matrix transformations."]}], 'duration': 307.857, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uSzGdfdOoG8/pics/uSzGdfdOoG8771748.jpg', 'highlights': ["The demonstration includes examples of using the 'add' and 'multiply' functions to transform a matrix, such as adding 5 to a matrix and then multiplying the matrix by -3 resulting in the expected matrix transformations.", "The functions 'multiply' and 'add' are implemented to perform scalar operations on a matrix, allowing the user to multiply every value in the matrix by a single value or add a single value to every value in the matrix.", 'It outlines the method of storing data in a two-dimensional array.', "The 'multiply' function loops through every row and column of the matrix to perform the scalar multiplication, while the 'add' function adds the specified value to every element in the matrix.", 'The chapter describes the process of initializing a matrix with 0 values and defining its dimensions.', 'The speaker acknowledges that the library created is not optimal or efficient.']}], 'highlights': ['The importance of referencing a Medium post about the required linear algebra for deep learning is mentioned, providing valuable insights for gathering thoughts and understanding the concepts.', 'The intention to take a break from the neural network implementation to focus on the essential linear algebra concepts and to write code that can be applied to the neural network is highlighted, indicating a practical approach to the learning process.', 'The relevance of linear algebra in performing mathematical operations within the neural network library is emphasized, with the focus on understanding the necessary core aspects of linear algebra for the implementation.', 'The chapter emphasizes the transition from vector operations to matrix operations, highlighting their analogous nature and their significance in neural network library development.', 'The dot product involves multiplying corresponding elements of two vectors and summing the results, and is a fundamental operation for matrix operations and neural network library development.', 'The chapter explains the concept of vectors in linear algebra, including their use in two-dimensional and n-dimensional spaces, various notations, and different kinds of operations such as scalar, element-wise, and vector multiplication.', 'Creating a custom matrix library in JavaScript to understand working principles and efficiency.', 'Matrices store numbers in programming for pixels, spreadsheets, and neural networks.', "The functions 'multiply' and 'add' are implemented to perform scalar operations on a matrix, allowing the user to multiply every value in the matrix by a single value or add a single value to every value in the matrix.", "The demonstration includes examples of using the 'add' and 'multiply' functions to transform a matrix, such as adding 5 to a matrix and then multiplying the matrix by -3 resulting in the expected matrix transformations."]}