TensorFlow
TensorFlow is a machine learning library released by Google as open source. www.tensorflow.org
This is the conclusion I made after reading a machine learning book for a while and touching TensorFlow.
** TensorFlow is not something that machine learning beginners can easily use **
With TensorFlow, you can intuitively incorporate the concept of machine learning into your code. However, for that purpose, it is necessary to know the theory of machine learning in advance. If you don't understand the terms such as "neural network" and "structural pattern mining", you need to stop and investigate.
However, if you like mathematics, the world where everything is expressed by mathematical formulas is strangely fun. If you know the algorithm and how to use it, you can certainly implement interesting things at a considerable level.
Well, it's the same even if you look here and install it, but I will write it for the time being. It will be completed in about 5 minutes. https://www.tensorflow.org/versions/master/get_started/os_setup.html
Check the version of python. Ok if 2.7 or higher
$ python -V
Python 2.7.10
install pip
$ sudo easy_install pip
Install virtualenv
$ sudo pip install --upgrade virtualenv
Create a virtualenv environment in ~ / tensorflow
(change the folder specification if you want to put it in another location)
$ virtualenv --system-site-packages ~/tensorflow
Activate tensorflow. After execution, the command prompt display will be (tensorflow) $.
$ source ~/tensorflow/bin/activate
Install TensorFlow
(tensorflow)$ pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl
end.
In response to the feeling of "I want to move anything because it doesn't matter!" Before a difficult theory, I will start with Python code that even inexperienced Python users can easily understand.
x = 1
y = x + 2
print(y)
Write this code and save it as test.py. And when you run it
(tensorflow)$ python test.py
3
Naturally, the result is 3.
Next, let's rewrite this a little like TensorFlow.
import tensorflow as tf
x = tf.constant(1, name='x')
y = tf.Variable(x + 2, name='y')
print(y)
This is the result of saving and executing with test2.py.
(tensorflow) $ python test2.py
<tensorflow.python.ops.variables.Variable object at 0x10f6e5110>
Something is obviously different. The reason is that it is performing a different process than the previous code.
Explain the processing contents line by line in the code of test2.py
In other words, the subtle difference is that y is only defined, and the numerical value is not yet entered like the previous code.
If you modify this to a proper code, it will be like this.
import tensorflow as tf
x = tf.constant(1, name='x')
y = tf.Variable(x + 2, name='y')
model = tf.initialize_all_variables()
with tf.Session() as session:
session.run(model)
print(session.run(y))
Explanation for each line
Then, the result is 3 as shown.
(tensorflow) hellow $ python test2.py
can't determine number of CPU cores: assuming 4
I tensorflow/core/common_runtime/local_device.cc:25] Local device intra op parallelism threads: 4
can't determine number of CPU cores: assuming 4
I tensorflow/core/common_runtime/local_session.cc:45] Local session inter op parallelism threads: 4
3
You may think that the above example is "troublesome", but this is just a simple example. And this is where the normal code and TensorFlow are a little different. If you think, "It's not that easy, but explain" natural language processing "or" future prediction "," if you don't understand this, you'll end up coming back here later. I wrote it from here first because it would end up. If you're excited about the news that AlphaGo has defeated the world champion of Go, and you're excited by the Amazon Echo, which responds nicely just by talking, you're sure to be immersed in the world of machine learning with TensorFlow. No, machine learning Omoroi! hot!
This introductory book will be interesting in earnest from the next time onwards.
"Puzzle that can be solved by most engineers, but not only by the bottom 10% of bad engineers?" I made some series. If you are interested, please try to solve it. By the way, this puzzle has nothing to do with TensorFlow. http://tango-ruby.hatenablog.com/entry/2015/11/30/122814