>>> import numpy as np
>>> A = np.array([[1,2,3,4],[5,6,7,8]])
>>> A
array([[1, 2, 3, 4],
[5, 6, 7, 8]])
>>> A[:,2] # returns the third columm
>>> import pandas as pd
>>>aa = pd.DataFrame(A[:,2].ravel())
>>>aa
>>> import numpy as np
>>> A = np.array([[1,2,3,4],[5,6,7,8]])
>>> A
array([[1, 2, 3, 4],
[5, 6, 7, 8]])
>>> A[:,2] # returns the third columm
>>> import pandas as pd
>>>aa = pd.DataFrame(A[:,2].ravel())
>>>aa
import scipy.io as sio
test = sio.loadmat('test.mat')
test
{'a': array([[[ 1., 4., 7., 10.],
[ 2., 5., 8., 11.],
[ 3., 6., 9., 12.]]]),
'__version__': '1.0',
'__header__': 'MATLAB 5.0 MAT-file, written by
Octave 3.6.3, 2013-02-17 21:02:11 UTC',
'__globals__': []}
>>> oct_a = test['a']
>>> oct_a
yourstring = yourstring.encode('ascii', 'ignore').decode('ascii')
org.apache.log4j.BasicConfigurator.configure();
sudo apt-get install gfortran libopenblas-dev liblapack-dev
python setup.py install orpip install scipy
yarn-site.xml:<property>
<name>yarn.nodemanager.vmem-check-enabled</name>
<value>false</value>
<description>Whether virtual memory limits will be enforced for containers.</description>
</property>
true.yarn-site.xml change this to a higher value than is currently set<property>
<name>yarn.nodemanager.vmem-pmem-ratio</name>
<value>5</value>
<description>Ratio between virtual memory to physical memory when setting memory limits for containers. Container allocations are expressed in terms of physical memory, and virtual memory usage is allowed to exceed this allocation by this ratio.</description>
</property>
2.1<configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.aux-services.mapreduce_shuffle.class</name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
</configuration>
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp27-none-linux_x86_64.whl
#$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0rc2-py2-none-any.whl
$ pip install keras
Before we get too far we should check the contents of our keras.json configuration file. You can find this file in ~/.keras/keras.json .
$gedit ~/.keras/keras.json .
add "image_dim_ordering": "tf" in the file and file contents should look lik
{
"image_dim_ordering": "tf",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "tensorflow"
}
You might be wondering what exactly image_dim_ordering controls.
Using TensorFlow, images are represented as NumPy arrays with the shape (height, width, depth), where the depth is the number of channels in the image.
However, if you are using Theano, images are instead assumed to be represented as (depth, height, width).
Find CV2.so
$ cd /
$ sudo find . -name '*cv2.so*'
./Users/adrianrosebrock/.virtualenvs/cv/lib/python2.7/site-packages/cv2.so
./Users/adrianrosebrock/.virtualenvs/gurus/lib/python2.7/site-packages/cv2.so
./Users/adrianrosebrock/.virtualenvs/keras_th/lib/python2.7/site-packages/cv2.so
./usr/local/lib/python2.7/site-packages/cv2.so
and copy that to virtual environment
$ cd ~/.virtualenvs/keras_tf/lib/python2.7/site-packages/
$ ln -s /usr/local/lib/python2.7/site-packages/cv2.so cv2.so
$ cd ~
------------------------------------------------
References
Content taken from
|