title

TensorFlow Basics - Deep Learning with Neural Networks p. 2

description

Welcome to part two of Deep Learning with Neural Networks and TensorFlow, and part 44 of the Machine Learning tutorial series. In this tutorial, we are going to be covering some basics on what TensorFlow is, and how to begin using it.
Libraries like TensorFlow and Theano are not simply deep learning libraries, they are libraries *for* deep learning. They are actually just number-crunching libraries, much like Numpy is. The difference is, however, a package like TensorFlow allows us to perform specific machine learning number-crunching operations like derivatives on huge matricies with large efficiency. We can also easily distribute this processing across our CPU cores, GPU cores, or even multiple devices like multiple GPUs. But that's not all! We can even distribute computations across a distributed network of computers with TensorFlow. So, while TensorFlow is mainly being used with machine learning right now, it actually stands to have uses in other fields, since really it is just a massive array manipulation library.
What is a tensor? Up to this point in the machine learning series, we've been working mainly with vectors (numpy arrays), and a tensor can be a vector. Most simply, a tensor is an array-like object, and, as you've seen, an array can hold your matrix, your vector, and really even a scalar.
Installing TensorFlow via Ubuntu and virtualbox: https://pythonprogramming.net/installing-tensorflow-machine-learning-tutorial/
https://pythonprogramming.net
https://twitter.com/sentdex
https://www.facebook.com/pythonprogramming.net/
https://plus.google.com/+sentdex

detail

{'title': 'TensorFlow Basics - Deep Learning with Neural Networks p. 2', 'heatmap': [{'end': 98.575, 'start': 74.278, 'weight': 0.812}, {'end': 546.668, 'start': 513.288, 'weight': 0.78}], 'summary': "Covers deep learning with tensorflow & python, providing guidance on tensorflow installation for mac, linux, and windows, emphasizing the simplicity of installation for mac and linux users. it also discusses tensorflow's efficiency in code execution, introduces tensorflow as a matrix manipulation library, explains tensors' application in deep learning, and covers the basics of building and running computation graphs using tensorflow.", 'chapters': [{'end': 117.086, 'segs': [{'end': 52.504, 'src': 'embed', 'start': 26.085, 'weight': 0, 'content': [{'end': 30.208, 'text': 'Dude, there we go, come on.', 'start': 26.085, 'duration': 4.123}, {'end': 32.93, 'text': "And then you'll go down to the pip installation.", 'start': 30.348, 'duration': 2.582}, {'end': 37.913, 'text': "right?. You just run these very simple things and these very simple things and this very simple thing and you're done.", 'start': 32.93, 'duration': 4.983}, {'end': 40.315, 'text': "okay?. If you're on Windows, it's not so simple.", 'start': 37.913, 'duration': 2.402}, {'end': 50.582, 'text': "So if that's you, if you're on Windows, I have an optional tutorial for installing TensorFlow via Ubuntu via VirtualBox.", 'start': 40.735, 'duration': 9.847}, {'end': 52.504, 'text': 'If you need that, check that out.', 'start': 51.443, 'duration': 1.061}], 'summary': 'Tutorial on tensorflow installation for windows users available', 'duration': 26.419, 'max_score': 26.085, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/pnSBZ6TEVjY/pics/pnSBZ6TEVjY26085.jpg'}, {'end': 98.575, 'src': 'heatmap', 'start': 67.934, 'weight': 1, 'content': [{'end': 73.538, 'text': 'I did not want to pay for a cloud server that would have as much power as this, so I figured I might as well get used to that.', 'start': 67.934, 'duration': 5.604}, {'end': 80.242, 'text': "Anyway, so it's assuming you have TensorFlow already installed.", 'start': 74.278, 'duration': 5.964}, {'end': 82.944, 'text': "Also, I've got htop over here.", 'start': 80.983, 'duration': 1.961}, {'end': 92.691, 'text': "If you're not familiar, you can just do sudo apt-get install htop, and it just gives you a much better visual representation than top does.", 'start': 82.984, 'duration': 9.707}, {'end': 94.852, 'text': 'These are my CPUs.', 'start': 92.731, 'duration': 2.121}, {'end': 96.213, 'text': 'This is my memory, my RAM.', 'start': 94.912, 'duration': 1.301}, {'end': 98.575, 'text': 'Swap if I use it, God forbid.', 'start': 96.554, 'duration': 2.021}], 'summary': 'The speaker discusses using a powerful local server and demonstrates the use of htop for visual system monitoring.', 'duration': 26.918, 'max_score': 67.934, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/pnSBZ6TEVjY/pics/pnSBZ6TEVjY67934.jpg'}], 'start': 1.837, 'title': 'Deep learning with tensorflow & python', 'summary': 'Provides guidance on tensorflow installation for mac, linux, and windows, and emphasizes the simplicity of installation for mac and linux users, while highlighting the use of htop for system monitoring.', 'chapters': [{'end': 117.086, 'start': 1.837, 'title': 'Deep learning with tensorflow & python', 'summary': 'Discusses the installation of tensorflow for mac, linux, and windows, and highlights the use of htop for system monitoring, emphasizing the simplicity of installation for mac and linux users.', 'duration': 115.249, 'highlights': ['The installation of TensorFlow is simple for Mac and Linux users, requiring only a few commands from the terminal, as highlighted by the speaker.', 'The speaker also mentions an optional tutorial for Windows users to install TensorFlow via Ubuntu using VirtualBox, indicating the complexity of installation for Windows users.', "The use of htop for system monitoring is showcased, providing a visual representation of CPU, memory, RAM, and processes, with a recommendation for installation using 'sudo apt-get install htop'."]}], 'duration': 115.249, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/pnSBZ6TEVjY/pics/pnSBZ6TEVjY1837.jpg', 'highlights': ['The installation of TensorFlow is simple for Mac and Linux users, requiring only a few commands from the terminal, as highlighted by the speaker.', "The use of htop for system monitoring is showcased, providing a visual representation of CPU, memory, RAM, and processes, with a recommendation for installation using 'sudo apt-get install htop'.", 'The speaker also mentions an optional tutorial for Windows users to install TensorFlow via Ubuntu using VirtualBox, indicating the complexity of installation for Windows users.']}, {'end': 340.413, 'segs': [{'end': 151.126, 'src': 'embed', 'start': 117.086, 'weight': 0, 'content': [{'end': 120.988, 'text': "And then over here is where I'm just gonna run the actual code, and that's that.", 'start': 117.086, 'duration': 3.902}, {'end': 124.15, 'text': 'So TensorFlow does have.', 'start': 122.049, 'duration': 2.101}, {'end': 129.953, 'text': "I feel like I'd be doing you a disservice if I don't tell you, but for the most part you write a TensorFlow program and then you run it okay?", 'start': 124.15, 'duration': 5.803}, {'end': 135.475, 'text': "It's part of what makes TensorFlow as efficient as it is.", 'start': 130.413, 'duration': 5.062}, {'end': 141.138, 'text': "is you set up your code kind of in the background, as it's like abstract, and then, when it comes time to run it,", 'start': 135.475, 'duration': 5.663}, {'end': 151.126, 'text': 'It runs like pretty much everything kind of in a chunk, not like Python, like Python is a very kind of slow compared to like really efficient C++,', 'start': 142.319, 'duration': 8.807}], 'summary': 'Tensorflow allows efficient execution of code by setting it up in the background and running it in chunks, making it more efficient than python.', 'duration': 34.04, 'max_score': 117.086, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/pnSBZ6TEVjY/pics/pnSBZ6TEVjY117086.jpg'}, {'end': 241.759, 'src': 'embed', 'start': 211.167, 'weight': 3, 'content': [{'end': 212.267, 'text': 'Like, what is it actually doing for us?', 'start': 211.167, 'duration': 1.1}, {'end': 221.809, 'text': 'So libraries like TensorFlow or Theano and stuff like that, what they are at their inner core is just matrix manipulation libraries or even better,', 'start': 212.287, 'duration': 9.522}, {'end': 225.05, 'text': 'put in like Python terms, array manipulation.', 'start': 221.809, 'duration': 3.241}, {'end': 228.031, 'text': "not even Python terms like C terms, I guess I don't know.", 'start': 225.05, 'duration': 2.981}, {'end': 232.313, 'text': 'Anyway, array manipulation libraries.', 'start': 230.792, 'duration': 1.521}, {'end': 233.074, 'text': "That's what they do.", 'start': 232.333, 'duration': 0.741}, {'end': 238.217, 'text': "So you might ask, what's a tensor? A tensor is just your array-like object.", 'start': 233.374, 'duration': 4.843}, {'end': 239.377, 'text': "So it's just an array.", 'start': 238.297, 'duration': 1.08}, {'end': 241.759, 'text': 'It might have a bunch of values.', 'start': 240.258, 'duration': 1.501}], 'summary': 'Libraries like tensorflow and theano are matrix manipulation tools, working with array-like objects.', 'duration': 30.592, 'max_score': 211.167, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/pnSBZ6TEVjY/pics/pnSBZ6TEVjY211167.jpg'}, {'end': 314.435, 'src': 'embed', 'start': 273.73, 'weight': 2, 'content': [{'end': 282.735, 'text': "the only place that really needs to be able to do, let's say, optimization on 600 million variables or something, or in batches.", 'start': 273.73, 'duration': 9.005}, {'end': 287.318, 'text': "But anyways, the other thing that's kind of cool about TensorFlow is,", 'start': 283.276, 'duration': 4.042}, {'end': 292.601, 'text': "if you look into it generally it's called a library for machine learning or for deep learning.", 'start': 287.318, 'duration': 5.283}, {'end': 298.024, 'text': 'But really TensorFlow, if you really start looking into it, I would say is actually a deep learning library,', 'start': 293.341, 'duration': 4.683}, {'end': 307.111, 'text': 'because it has just tons of deep learning functions that you would need pre-built for you that make it a non-Numpy-like thing.', 'start': 298.024, 'duration': 9.087}, {'end': 311.754, 'text': "But at least at its foundation, it's more like NumPy than it is like Scikit-learn.", 'start': 307.171, 'duration': 4.583}, {'end': 314.435, 'text': 'Scikit-learn is so very high level.', 'start': 312.074, 'duration': 2.361}], 'summary': 'Tensorflow offers deep learning functions, with 600 million variable optimization capability.', 'duration': 40.705, 'max_score': 273.73, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/pnSBZ6TEVjY/pics/pnSBZ6TEVjY273730.jpg'}], 'start': 117.086, 'title': 'Tensorflow efficiency and introduction', 'summary': "Discusses tensorflow's efficiency in code execution, emphasizing abstract code setup and efficient chunk execution, compared to slower line-by-line execution in python. it also introduces tensorflow as a matrix manipulation library, explaining tensors' application in deep learning and its capability to handle optimization on a large scale.", 'chapters': [{'end': 154.409, 'start': 117.086, 'title': 'Tensorflow efficiency and code execution', 'summary': 'Discusses the efficiency of tensorflow in code execution, emphasizing abstract code setup and efficient chunk execution, compared to the slower line-by-line execution in python.', 'duration': 37.323, 'highlights': ["TensorFlow program setup is abstract, leading to efficient chunk execution as compared to Python's slower line-by-line execution.", 'Running a TensorFlow program involves setting up the code in the background and then executing it, resulting in efficient execution compared to Python.']}, {'end': 340.413, 'start': 154.409, 'title': 'Introduction to tensorflow', 'summary': 'Introduces tensorflow as a matrix manipulation library, explaining the concept of tensors and its application in deep learning, highlighting its capability to handle optimization on a large scale and its distinction as a deep learning library with pre-built functions.', 'duration': 186.004, 'highlights': ['TensorFlow as a deep learning library with pre-built functions TensorFlow is distinguished as a deep learning library with numerous pre-built deep learning functions, making it more like NumPy at its foundation and suitable for deep learning tasks.', "Application of tensors in deep learning and optimization on a large scale TensorFlow's capability to handle optimization on a large scale, such as optimization on 600 million variables or in batches, makes it primarily suitable for deep learning tasks.", 'Introduction to TensorFlow as a matrix manipulation library The chapter introduces TensorFlow as a matrix manipulation library, focusing on the concept of tensors as array-like objects and functions on tensors for problem-solving.']}], 'duration': 223.327, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/pnSBZ6TEVjY/pics/pnSBZ6TEVjY117086.jpg', 'highlights': ['Running a TensorFlow program involves setting up the code in the background and then executing it, resulting in efficient execution compared to Python.', "TensorFlow program setup is abstract, leading to efficient chunk execution as compared to Python's slower line-by-line execution.", 'TensorFlow as a deep learning library with pre-built functions TensorFlow is distinguished as a deep learning library with numerous pre-built deep learning functions, making it more like NumPy at its foundation and suitable for deep learning tasks.', 'Introduction to TensorFlow as a matrix manipulation library The chapter introduces TensorFlow as a matrix manipulation library, focusing on the concept of tensors as array-like objects and functions on tensors for problem-solving.', "Application of tensors in deep learning and optimization on a large scale TensorFlow's capability to handle optimization on a large scale, such as optimization on 600 million variables or in batches, makes it primarily suitable for deep learning tasks."]}, {'end': 948.722, 'segs': [{'end': 461.322, 'src': 'embed', 'start': 427.093, 'weight': 0, 'content': [{'end': 429.154, 'text': "It'll be a tf.constant and a value.", 'start': 427.093, 'duration': 2.061}, {'end': 431.092, 'text': "We'll say 6.", 'start': 429.274, 'duration': 1.818}, {'end': 433.755, 'text': "So in this case, in the graph, it's a constant.", 'start': 431.092, 'duration': 2.663}, {'end': 434.595, 'text': "It won't change.", 'start': 433.835, 'duration': 0.76}, {'end': 436.958, 'text': "So yeah, it's a 5 and a 6.", 'start': 434.996, 'duration': 1.962}, {'end': 438.299, 'text': 'But these can also be variables.', 'start': 436.958, 'duration': 1.341}, {'end': 442.323, 'text': "And you can have these placeholders you'll see a lot and all that kind of stuff.", 'start': 438.419, 'duration': 3.904}, {'end': 445.746, 'text': 'But this is meant to be just a really simple example that I can do really quickly.', 'start': 442.343, 'duration': 3.403}, {'end': 447.088, 'text': "So there's that.", 'start': 446.667, 'duration': 0.421}, {'end': 453.734, 'text': 'Then you could say the result equals, and you could do something as simple as x1 times x2.', 'start': 447.428, 'duration': 6.306}, {'end': 461.322, 'text': "And I'm not 100% certain that's as efficient as what I'm about to show you.", 'start': 454.875, 'duration': 6.447}], 'summary': "Demonstrating tf.constant with a value of 6 in a graph, explaining it won't change. variables and placeholders also covered.", 'duration': 34.229, 'max_score': 427.093, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/pnSBZ6TEVjY/pics/pnSBZ6TEVjY427093.jpg'}, {'end': 546.668, 'src': 'heatmap', 'start': 513.288, 'weight': 0.78, 'content': [{'end': 524.253, 'text': 'I am NOT where I need to be Desktop what I call TF tuts or something oh my gosh What did I call this thing? Oh, capital T.', 'start': 513.288, 'duration': 10.965}, {'end': 528.956, 'text': "Nice Alright, so Python 3, don't forget the 3, and then tfbasics.py.", 'start': 524.253, 'duration': 4.703}, {'end': 529.957, 'text': "We'll run that.", 'start': 529.376, 'duration': 0.581}, {'end': 533.559, 'text': 'And we can see the result is just a tensor.', 'start': 531.058, 'duration': 2.501}, {'end': 535.861, 'text': "At the moment, it's an abstract tensor.", 'start': 533.86, 'duration': 2.001}, {'end': 538.623, 'text': "It doesn't actually have any value because nothing's actually run.", 'start': 535.881, 'duration': 2.742}, {'end': 546.668, 'text': 'Like, in normal Python, if we ran this code, this would be executed, right? Especially if it was the original x1 times x2.', 'start': 539.163, 'duration': 7.505}], 'summary': 'Python 3 code tfbasics.py outputs an abstract tensor result.', 'duration': 33.38, 'max_score': 513.288, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/pnSBZ6TEVjY/pics/pnSBZ6TEVjY513288.jpg'}, {'end': 611.517, 'src': 'embed', 'start': 581.5, 'weight': 1, 'content': [{'end': 584.421, 'text': "It's an abstract tensor in our computation graph.", 'start': 581.5, 'duration': 2.921}, {'end': 590.044, 'text': 'okay?. Now to actually see the result, you run it in the session.', 'start': 584.421, 'duration': 5.623}, {'end': 592.726, 'text': "so to get a session, I'm just gonna make some space here.", 'start': 590.044, 'duration': 2.682}, {'end': 598.99, 'text': "This is probably a little big and To run the session, you just do, well, there's a few things you can do.", 'start': 592.746, 'duration': 6.244}, {'end': 606.254, 'text': 'A lot of times you might see something like this like ses, or for ses equals tf.Session, okay?', 'start': 599.01, 'duration': 7.244}, {'end': 611.517, 'text': 'That begins the session or actually, well, sort of begins the session, but gives us mostly our ses variable.', 'start': 606.935, 'duration': 4.582}], 'summary': 'Using tf.session to run computation graph for abstract tensor.', 'duration': 30.017, 'max_score': 581.5, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/pnSBZ6TEVjY/pics/pnSBZ6TEVjY581500.jpg'}, {'end': 858.689, 'src': 'embed', 'start': 830.85, 'weight': 2, 'content': [{'end': 839.716, 'text': 'But mainly the big thing to take away here is that you have this computation graph Where you kind of model everything.', 'start': 830.85, 'duration': 8.866}, {'end': 853.861, 'text': 'So the number of nodes in our network and the number of layers and the starting values and stuff like that is going to be built into our computation graph.', 'start': 839.816, 'duration': 14.045}, {'end': 858.689, 'text': 'And then, when we run the session,', 'start': 855.747, 'duration': 2.942}], 'summary': 'Computation graph models network with nodes, layers, and starting values.', 'duration': 27.839, 'max_score': 830.85, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/pnSBZ6TEVjY/pics/pnSBZ6TEVjY830850.jpg'}, {'end': 900.437, 'src': 'embed', 'start': 874.877, 'weight': 3, 'content': [{'end': 881.062, 'text': "that's all going to run and be modifying the weights and such for us, to the point where we're not even going to code that.", 'start': 874.877, 'duration': 6.185}, {'end': 885.846, 'text': "We don't have to code the logic that's going to go through and modify those weights.", 'start': 881.462, 'duration': 4.384}, {'end': 887.547, 'text': "It's just going to happen.", 'start': 886.226, 'duration': 1.321}, {'end': 891.19, 'text': 'We just have to tell TensorFlow, like, this is what we want you to do.', 'start': 887.587, 'duration': 3.603}, {'end': 894.392, 'text': 'We want you to minimize this cost function and stuff like that.', 'start': 891.25, 'duration': 3.142}, {'end': 900.437, 'text': "But as far as like everything else that's involved, TensorFlow pretty much takes over from there, which is, I think, crazy.", 'start': 894.792, 'duration': 5.645}], 'summary': 'Using tensorflow automates weight modification and logic coding, minimizing the cost function without manual intervention.', 'duration': 25.56, 'max_score': 874.877, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/pnSBZ6TEVjY/pics/pnSBZ6TEVjY874877.jpg'}], 'start': 341.373, 'title': 'Tensorflow basics', 'summary': 'Covers the basics of building and running computation graphs using tensorflow, including model definition, constants creation, and session execution. it also explains the use of computation graph and sessions, focusing on building and running a neural network with automatic weight modification and optimization capabilities.', 'chapters': [{'end': 630.187, 'start': 341.373, 'title': 'Tensorflow basics: building and running computation graphs', 'summary': 'Discusses the basics of building and running computation graphs using tensorflow, including defining models, creating constants, and running sessions to obtain results.', 'duration': 288.814, 'highlights': ['TensorFlow allows for defining and abstractly building computation graphs, providing efficiency for processing on GPUs or similar hardware.', 'Defining constants and variables within the graph, such as tf.constant with values like 5 and 6, allows for building simple examples quickly.', 'Running sessions, like ses.run, is used to obtain results from the computation graph, providing a tangible output from the abstract tensor results.', 'The use of tf.Session() and ses.run for running sessions in TensorFlow to obtain actual results from the computation graph.', 'The chapter also touches on the concept of placeholders, tf.multiplication for simple arithmetic operations, and the use of tf.Session for running sessions to obtain results.']}, {'end': 948.722, 'start': 630.187, 'title': 'Understanding tensorflow basics', 'summary': 'Explains the basics of tensorflow, including the use of computation graph and sessions, highlighting the process of building and running a neural network in tensorflow, emphasizing its automatic weight modification and optimization capabilities.', 'duration': 318.535, 'highlights': ['The chapter emphasizes the use of computation graph in TensorFlow to model the network, where the number of nodes, layers, and starting values are built into the graph, and then the session is run with an optimizer to manage all the weights and outputs, based on the cost function, illustrating the automatic weight modification and optimization capabilities of TensorFlow.', 'The transcript discusses the importance of building the computation graph and defining the session as two major chunks in TensorFlow, with the session being responsible for running the graph and managing the weight modifications and outputs, providing a clear understanding of the fundamental components and operations in TensorFlow.', 'The tutorial introduces the concept of using TensorFlow to minimize a cost function and automate the weight modification process, highlighting the convenience and efficiency of TensorFlow in managing the logic of modifying weights without requiring explicit coding, showcasing the automatic optimization capabilities of TensorFlow.', 'The speaker shares a preview of the next tutorial, where the focus will be on building the computation graph and modeling the network, followed by running the session, providing a clear roadmap for the upcoming content and inviting audience engagement for questions, comments, and suggestions.']}], 'duration': 607.349, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/pnSBZ6TEVjY/pics/pnSBZ6TEVjY341373.jpg', 'highlights': ['Defining constants and variables within the graph, such as tf.constant with values like 5 and 6, allows for building simple examples quickly.', 'The use of tf.Session() and ses.run for running sessions in TensorFlow to obtain actual results from the computation graph.', 'The chapter emphasizes the use of computation graph in TensorFlow to model the network, where the number of nodes, layers, and starting values are built into the graph, and then the session is run with an optimizer to manage all the weights and outputs, based on the cost function, illustrating the automatic weight modification and optimization capabilities of TensorFlow.', 'The tutorial introduces the concept of using TensorFlow to minimize a cost function and automate the weight modification process, highlighting the convenience and efficiency of TensorFlow in managing the logic of modifying weights without requiring explicit coding, showcasing the automatic optimization capabilities of TensorFlow.']}], 'highlights': ['The installation of TensorFlow is simple for Mac and Linux users, requiring only a few commands from the terminal, as highlighted by the speaker.', 'Running a TensorFlow program involves setting up the code in the background and then executing it, resulting in efficient execution compared to Python.', 'TensorFlow as a deep learning library with pre-built functions TensorFlow is distinguished as a deep learning library with numerous pre-built deep learning functions, making it more like NumPy at its foundation and suitable for deep learning tasks.', 'Introduction to TensorFlow as a matrix manipulation library The chapter introduces TensorFlow as a matrix manipulation library, focusing on the concept of tensors as array-like objects and functions on tensors for problem-solving.', 'The tutorial introduces the concept of using TensorFlow to minimize a cost function and automate the weight modification process, highlighting the convenience and efficiency of TensorFlow in managing the logic of modifying weights without requiring explicit coding, showcasing the automatic optimization capabilities of TensorFlow.']}