mirror of
https://github.com/wassname/keras-js.git
synced 2026-09-10 12:15:12 +08:00
483 lines
18 KiB
Plaintext
483 lines
18 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stderr",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"Using TensorFlow backend.\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"import numpy as np\n",
|
|
"from keras.models import Model\n",
|
|
"from keras.layers import Input\n",
|
|
"from keras.layers.pooling import MaxPooling1D\n",
|
|
"from keras import backend as K"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"def format_decimal(arr, places=6):\n",
|
|
" return [round(x * 10**places) / 10**places for x in arr]"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"### MaxPooling1D"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"**[pooling.MaxPooling1D.0] input 6x6, pool_length=2, stride=None, border_mode='valid'**"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 16,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"in shape: (6, 6)\n",
|
|
"in: [-0.570441, -0.454673, -0.285321, 0.237249, 0.282682, 0.428035, 0.160547, -0.332203, 0.546391, 0.272735, 0.010827, -0.763164, -0.442696, 0.381948, -0.676994, 0.753553, -0.031788, 0.915329, -0.738844, 0.269075, 0.434091, 0.991585, -0.944288, 0.258834, 0.162138, 0.565201, -0.492094, 0.170854, -0.139788, -0.710674, 0.406968, 0.705926, -0.094137, -0.793497, -0.040684, 0.522292]\n",
|
|
"out shape: (3, 6)\n",
|
|
"out: [0.160547, -0.332203, 0.546391, 0.272735, 0.282682, 0.428035, -0.442696, 0.381948, 0.434091, 0.991585, -0.031788, 0.915329, 0.406968, 0.705926, -0.094137, 0.170854, -0.040684, 0.522292]\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"data_in_shape = (6, 6)\n",
|
|
"L = MaxPooling1D(pool_length=2, stride=None, border_mode='valid')\n",
|
|
"\n",
|
|
"layer_0 = Input(shape=data_in_shape)\n",
|
|
"layer_1 = L(layer_0)\n",
|
|
"model = Model(input=layer_0, output=layer_1)\n",
|
|
"\n",
|
|
"# set weights to random (use seed for reproducibility)\n",
|
|
"np.random.seed(250)\n",
|
|
"data_in = 2 * np.random.random(data_in_shape) - 1\n",
|
|
"print('')\n",
|
|
"print('in shape:', data_in_shape)\n",
|
|
"print('in:', format_decimal(data_in.ravel().tolist()))\n",
|
|
"result = model.predict(np.array([data_in]))\n",
|
|
"print('out shape:', result[0].shape)\n",
|
|
"print('out:', format_decimal(result[0].ravel().tolist()))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"**[pooling.MaxPooling1D.1] input 6x6, pool_length=2, stride=1, border_mode='valid'**"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 17,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"in shape: (6, 6)\n",
|
|
"in: [0.275222, -0.793967, -0.468107, -0.841484, -0.295362, 0.78175, 0.068787, -0.261747, -0.625733, -0.042907, 0.861141, 0.85267, 0.956439, 0.717838, -0.99869, -0.963008, 0.013277, -0.180306, 0.832137, -0.385252, -0.524308, 0.659706, -0.905127, 0.526292, 0.832569, 0.084455, 0.23838, -0.046178, -0.735871, 0.776883, -0.394643, 0.498903, 0.029584, -0.17332, 0.628159, 0.445074]\n",
|
|
"out shape: (5, 6)\n",
|
|
"out: [0.275222, -0.261747, -0.468107, -0.042907, 0.861141, 0.85267, 0.956439, 0.717838, -0.625733, -0.042907, 0.861141, 0.85267, 0.956439, 0.717838, -0.524308, 0.659706, 0.013277, 0.526292, 0.832569, 0.084455, 0.23838, 0.659706, -0.735871, 0.776883, 0.832569, 0.498903, 0.23838, -0.046178, 0.628159, 0.776883]\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"data_in_shape = (6, 6)\n",
|
|
"L = MaxPooling1D(pool_length=2, stride=1, border_mode='valid')\n",
|
|
"\n",
|
|
"layer_0 = Input(shape=data_in_shape)\n",
|
|
"layer_1 = L(layer_0)\n",
|
|
"model = Model(input=layer_0, output=layer_1)\n",
|
|
"\n",
|
|
"# set weights to random (use seed for reproducibility)\n",
|
|
"np.random.seed(251)\n",
|
|
"data_in = 2 * np.random.random(data_in_shape) - 1\n",
|
|
"print('')\n",
|
|
"print('in shape:', data_in_shape)\n",
|
|
"print('in:', format_decimal(data_in.ravel().tolist()))\n",
|
|
"result = model.predict(np.array([data_in]))\n",
|
|
"print('out shape:', result[0].shape)\n",
|
|
"print('out:', format_decimal(result[0].ravel().tolist()))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"**[pooling.MaxPooling1D.2] input 6x6, pool_length=2, stride=3, border_mode='valid'**"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 18,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"in shape: (6, 6)\n",
|
|
"in: [-0.989173, -0.133618, -0.505338, 0.023259, 0.503982, -0.303769, -0.436321, 0.793911, 0.416102, 0.806405, -0.098342, -0.738022, -0.982676, 0.805073, 0.741244, -0.941634, -0.253526, -0.136544, -0.295772, 0.207565, -0.517246, -0.686963, -0.176235, -0.354111, -0.862411, -0.969822, 0.200074, 0.290718, -0.038623, 0.294839, 0.247968, 0.557946, -0.455596, 0.6624, 0.879529, -0.466772]\n",
|
|
"out shape: (2, 6)\n",
|
|
"out: [-0.436321, 0.793911, 0.416102, 0.806405, 0.503982, -0.303769, -0.295772, 0.207565, 0.200074, 0.290718, -0.038623, 0.294839]\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"data_in_shape = (6, 6)\n",
|
|
"L = MaxPooling1D(pool_length=2, stride=3, border_mode='valid')\n",
|
|
"\n",
|
|
"layer_0 = Input(shape=data_in_shape)\n",
|
|
"layer_1 = L(layer_0)\n",
|
|
"model = Model(input=layer_0, output=layer_1)\n",
|
|
"\n",
|
|
"# set weights to random (use seed for reproducibility)\n",
|
|
"np.random.seed(252)\n",
|
|
"data_in = 2 * np.random.random(data_in_shape) - 1\n",
|
|
"print('')\n",
|
|
"print('in shape:', data_in_shape)\n",
|
|
"print('in:', format_decimal(data_in.ravel().tolist()))\n",
|
|
"result = model.predict(np.array([data_in]))\n",
|
|
"print('out shape:', result[0].shape)\n",
|
|
"print('out:', format_decimal(result[0].ravel().tolist()))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"**[pooling.MaxPooling1D.3] input 6x6, pool_length=2, stride=None, border_mode='same'**"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 20,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"in shape: (6, 6)\n",
|
|
"in: [-0.47588, 0.366985, 0.040173, 0.015578, -0.906159, 0.241982, -0.771299, -0.443554, -0.56404, -0.17751, 0.541277, -0.233327, 0.024369, 0.858275, 0.496191, 0.980574, -0.59522, 0.480899, 0.392553, -0.191718, 0.055121, 0.289836, -0.498339, 0.800408, 0.132679, -0.716649, 0.840092, -0.088837, -0.538209, -0.580887, -0.370128, -0.924933, -0.161736, -0.205619, 0.793729, -0.354472]\n",
|
|
"out shape: (3, 6)\n",
|
|
"out: [-0.47588, 0.366985, 0.040173, 0.015578, 0.541277, 0.241982, 0.392553, 0.858275, 0.496191, 0.980574, -0.498339, 0.800408, 0.132679, -0.716649, 0.840092, -0.088837, 0.793729, -0.354472]\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"data_in_shape = (6, 6)\n",
|
|
"L = MaxPooling1D(pool_length=2, stride=None, border_mode='same')\n",
|
|
"\n",
|
|
"layer_0 = Input(shape=data_in_shape)\n",
|
|
"layer_1 = L(layer_0)\n",
|
|
"model = Model(input=layer_0, output=layer_1)\n",
|
|
"\n",
|
|
"# set weights to random (use seed for reproducibility)\n",
|
|
"np.random.seed(253)\n",
|
|
"data_in = 2 * np.random.random(data_in_shape) - 1\n",
|
|
"print('')\n",
|
|
"print('in shape:', data_in_shape)\n",
|
|
"print('in:', format_decimal(data_in.ravel().tolist()))\n",
|
|
"result = model.predict(np.array([data_in]))\n",
|
|
"print('out shape:', result[0].shape)\n",
|
|
"print('out:', format_decimal(result[0].ravel().tolist()))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"**[pooling.MaxPooling1D.4] input 6x6, pool_length=2, stride=1, border_mode='same'**"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 36,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"in shape: (6, 6)\n",
|
|
"in: [0.024124, 0.280236, -0.680013, -0.042458, -0.164273, 0.358409, 0.511014, -0.585272, -0.481578, 0.692702, 0.64189, -0.400252, -0.922248, -0.735105, -0.533918, 0.071402, 0.310474, 0.369868, 0.767931, -0.842066, -0.091189, 0.835301, -0.480484, 0.950819, -0.002131, 0.086491, -0.480947, 0.405572, -0.083803, -0.921447, -0.291545, 0.674087, -0.560444, 0.881432, 0.076544, 0.63549]\n",
|
|
"out shape: (6, 6)\n",
|
|
"out: [0.511014, 0.280236, -0.481578, 0.692702, 0.64189, 0.358409, 0.511014, -0.585272, -0.481578, 0.692702, 0.64189, 0.369868, 0.767931, -0.735105, -0.091189, 0.835301, 0.310474, 0.950819, 0.767931, 0.086491, -0.091189, 0.835301, -0.083803, 0.950819, -0.002131, 0.674087, -0.480947, 0.881432, 0.076544, 0.63549, -0.291545, 0.674087, -0.560444, 0.881432, 0.076544, 0.63549]\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"data_in_shape = (6, 6)\n",
|
|
"L = MaxPooling1D(pool_length=2, stride=1, border_mode='same')\n",
|
|
"\n",
|
|
"layer_0 = Input(shape=data_in_shape)\n",
|
|
"layer_1 = L(layer_0)\n",
|
|
"model = Model(input=layer_0, output=layer_1)\n",
|
|
"\n",
|
|
"# set weights to random (use seed for reproducibility)\n",
|
|
"np.random.seed(254)\n",
|
|
"data_in = 2 * np.random.random(data_in_shape) - 1\n",
|
|
"print('')\n",
|
|
"print('in shape:', data_in_shape)\n",
|
|
"print('in:', format_decimal(data_in.ravel().tolist()))\n",
|
|
"result = model.predict(np.array([data_in]))\n",
|
|
"print('out shape:', result[0].shape)\n",
|
|
"print('out:', format_decimal(result[0].ravel().tolist()))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"**[pooling.MaxPooling1D.5] input 6x6, pool_length=2, stride=3, border_mode='same'**"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 37,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"in shape: (6, 6)\n",
|
|
"in: [-0.072127, -0.553929, -0.355552, -0.936405, 0.556627, -0.482815, -0.225337, -0.640315, 0.023246, -0.638412, -0.797304, 0.284959, -0.569771, -0.685286, 0.002481, 0.398436, 0.11345, 0.416629, -0.526713, 0.962183, 0.021732, 0.922994, 0.07991, -0.164385, 0.461494, -0.982877, -0.142158, 0.175741, -0.124041, -0.875609, -0.528708, -0.911127, 0.782257, -0.509403, 0.573973, -0.151309]\n",
|
|
"out shape: (2, 6)\n",
|
|
"out: [-0.072127, -0.553929, 0.023246, -0.638412, 0.556627, 0.284959, 0.461494, 0.962183, 0.021732, 0.922994, 0.07991, -0.164385]\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"data_in_shape = (6, 6)\n",
|
|
"L = MaxPooling1D(pool_length=2, stride=3, border_mode='same')\n",
|
|
"\n",
|
|
"layer_0 = Input(shape=data_in_shape)\n",
|
|
"layer_1 = L(layer_0)\n",
|
|
"model = Model(input=layer_0, output=layer_1)\n",
|
|
"\n",
|
|
"# set weights to random (use seed for reproducibility)\n",
|
|
"np.random.seed(255)\n",
|
|
"data_in = 2 * np.random.random(data_in_shape) - 1\n",
|
|
"print('')\n",
|
|
"print('in shape:', data_in_shape)\n",
|
|
"print('in:', format_decimal(data_in.ravel().tolist()))\n",
|
|
"result = model.predict(np.array([data_in]))\n",
|
|
"print('out shape:', result[0].shape)\n",
|
|
"print('out:', format_decimal(result[0].ravel().tolist()))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"**[pooling.MaxPooling1D.6] input 6x6, pool_length=3, stride=None, border_mode='valid'**"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 40,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"in shape: (6, 6)\n",
|
|
"in: [-0.908432, 0.172241, -0.59352, -0.831514, -0.948016, -0.194126, -0.242576, -0.89432, 0.610714, -0.24071, -0.245859, 0.500851, 0.088791, 0.04635, 0.908568, -0.232197, -0.175815, -0.177919, -0.535898, 0.04802, 0.512585, 0.854168, 0.283045, 0.282488, -0.126263, 0.772568, 0.403228, 0.721107, -0.043311, -0.799013, -0.683105, -0.52703, 0.838417, 0.915738, 0.180207, -0.181716]\n",
|
|
"out shape: (2, 6)\n",
|
|
"out: [0.088791, 0.172241, 0.908568, -0.232197, -0.175815, 0.500851, -0.126263, 0.772568, 0.838417, 0.915738, 0.283045, 0.282488]\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"data_in_shape = (6, 6)\n",
|
|
"L = MaxPooling1D(pool_length=3, stride=None, border_mode='valid')\n",
|
|
"\n",
|
|
"layer_0 = Input(shape=data_in_shape)\n",
|
|
"layer_1 = L(layer_0)\n",
|
|
"model = Model(input=layer_0, output=layer_1)\n",
|
|
"\n",
|
|
"# set weights to random (use seed for reproducibility)\n",
|
|
"np.random.seed(256)\n",
|
|
"data_in = 2 * np.random.random(data_in_shape) - 1\n",
|
|
"print('')\n",
|
|
"print('in shape:', data_in_shape)\n",
|
|
"print('in:', format_decimal(data_in.ravel().tolist()))\n",
|
|
"result = model.predict(np.array([data_in]))\n",
|
|
"print('out shape:', result[0].shape)\n",
|
|
"print('out:', format_decimal(result[0].ravel().tolist()))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"**[pooling.MaxPooling1D.7] input 7x7, pool_length=3, stride=1, border_mode='same'**"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 41,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"in shape: (7, 7)\n",
|
|
"in: [0.859653, 0.613312, 0.262871, 0.484585, 0.518061, -0.718848, -0.351388, -0.501557, 0.017192, -0.026869, -0.768317, -0.476893, -0.895809, 0.764782, 0.862057, 0.021243, 0.004039, 0.760431, 0.72102, 0.395305, 0.930351, 0.425255, -0.000952, -0.060338, -0.095258, 0.173776, -0.645557, 0.196502, 0.27885, -0.6868, -0.551196, 0.726361, -0.382779, 0.61877, 0.023847, -0.451251, 0.065412, -0.708225, -0.815011, -0.926643, 0.323493, -0.063352, 0.16365, -0.030438, -0.054635, 0.193949, -0.574495, 0.022988, 0.36335]\n",
|
|
"out shape: (7, 7)\n",
|
|
"out: [0.859653, 0.613312, 0.262871, 0.484585, 0.518061, -0.718848, 0.764782, 0.862057, 0.613312, 0.262871, 0.760431, 0.72102, 0.395305, 0.930351, 0.862057, 0.021243, 0.004039, 0.760431, 0.72102, 0.395305, 0.930351, 0.862057, 0.021243, 0.004039, 0.760431, 0.72102, 0.61877, 0.930351, 0.425255, 0.065412, -0.060338, 0.726361, 0.173776, 0.61877, 0.196502, 0.27885, 0.065412, -0.054635, 0.726361, -0.382779, 0.61877, 0.36335, 0.16365, 0.065412, -0.054635, 0.193949, -0.574495, 0.323493, 0.36335]\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"data_in_shape = (7, 7)\n",
|
|
"L = MaxPooling1D(pool_length=3, stride=1, border_mode='same')\n",
|
|
"\n",
|
|
"layer_0 = Input(shape=data_in_shape)\n",
|
|
"layer_1 = L(layer_0)\n",
|
|
"model = Model(input=layer_0, output=layer_1)\n",
|
|
"\n",
|
|
"# set weights to random (use seed for reproducibility)\n",
|
|
"np.random.seed(257)\n",
|
|
"data_in = 2 * np.random.random(data_in_shape) - 1\n",
|
|
"print('')\n",
|
|
"print('in shape:', data_in_shape)\n",
|
|
"print('in:', format_decimal(data_in.ravel().tolist()))\n",
|
|
"result = model.predict(np.array([data_in]))\n",
|
|
"print('out shape:', result[0].shape)\n",
|
|
"print('out:', format_decimal(result[0].ravel().tolist()))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"**[pooling.MaxPooling1D.8] input 7x7, pool_length=3, stride=3, border_mode='same'**"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 42,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"in shape: (7, 7)\n",
|
|
"in: [-0.830746, 0.315868, -0.173506, 0.415541, -0.957882, 0.658995, 0.795264, -0.147083, -0.042061, 0.230065, 0.388847, -0.277524, -0.268423, 0.35691, -0.515291, -0.37555, 0.367489, 0.753251, -0.60764, -0.16741, -0.893275, -0.814508, -0.437352, 0.062193, -0.003077, 0.560767, -0.646034, -0.283879, 0.097661, 0.401756, -0.236235, -0.199824, -0.252007, -0.335503, 0.414988, 0.301686, 0.309765, -0.349835, -0.274081, 0.383308, -0.782973, -0.667924, 0.282556, -0.932491, 0.954125, 0.837689, 0.219229, -0.583405, -0.018424]\n",
|
|
"out shape: (3, 7)\n",
|
|
"out: [-0.147083, 0.315868, 0.230065, 0.415541, -0.277524, 0.658995, 0.795264, 0.097661, 0.401756, 0.367489, 0.753251, 0.560767, -0.16741, 0.414988, 0.301686, 0.309765, 0.954125, 0.837689, 0.383308, -0.583405, -0.018424]\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"data_in_shape = (7, 7)\n",
|
|
"L = MaxPooling1D(pool_length=3, stride=3, border_mode='same')\n",
|
|
"\n",
|
|
"layer_0 = Input(shape=data_in_shape)\n",
|
|
"layer_1 = L(layer_0)\n",
|
|
"model = Model(input=layer_0, output=layer_1)\n",
|
|
"\n",
|
|
"# set weights to random (use seed for reproducibility)\n",
|
|
"np.random.seed(258)\n",
|
|
"data_in = 2 * np.random.random(data_in_shape) - 1\n",
|
|
"print('')\n",
|
|
"print('in shape:', data_in_shape)\n",
|
|
"print('in:', format_decimal(data_in.ravel().tolist()))\n",
|
|
"result = model.predict(np.array([data_in]))\n",
|
|
"print('out shape:', result[0].shape)\n",
|
|
"print('out:', format_decimal(result[0].ravel().tolist()))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"anaconda-cloud": {},
|
|
"kernelspec": {
|
|
"display_name": "Python [default]",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.5.2"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 0
|
|
}
|