2021-03-19 17:21:00 +00:00
|
|
|
{
|
|
|
|
"cells": [
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 1,
|
2021-03-26 20:01:05 +00:00
|
|
|
"id": "physical-coating",
|
2021-03-19 17:21:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"import numpy as np\n",
|
|
|
|
"import pandas as pd\n",
|
|
|
|
"import tensorflow as tf\n",
|
|
|
|
"tf.get_logger().setLevel('ERROR')\n",
|
|
|
|
"\n",
|
|
|
|
"import matplotlib.pyplot as plt\n",
|
|
|
|
"import matplotlib as mpl\n",
|
|
|
|
"import seaborn as sns\n",
|
2021-03-21 09:56:27 +00:00
|
|
|
"import json\n",
|
2021-03-19 17:21:00 +00:00
|
|
|
"\n",
|
|
|
|
"from sklearn.model_selection import train_test_split\n",
|
|
|
|
"\n",
|
|
|
|
"fig_dpi = 200\n",
|
|
|
|
"\n",
|
|
|
|
"%load_ext tensorboard"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
2021-03-26 20:01:05 +00:00
|
|
|
"id": "unable-security",
|
2021-03-19 17:21:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"# Scratchpad\n",
|
|
|
|
"Testbed"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 2,
|
2021-03-26 20:01:05 +00:00
|
|
|
"id": "precise-invalid",
|
2021-03-19 17:21:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"data = pd.read_csv('features.csv', header=None).T\n",
|
|
|
|
"data.columns = ['Clump thickness', 'Uniformity of cell size', 'Uniformity of cell shape', 'Marginal adhesion', 'Single epithelial cell size', 'Bare nuclei', 'Bland chomatin', 'Normal nucleoli', 'Mitoses']\n",
|
|
|
|
"labels = pd.read_csv('targets.csv', header=None).T\n",
|
|
|
|
"labels.columns = ['Benign', 'Malignant']"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 3,
|
2021-03-26 20:01:05 +00:00
|
|
|
"id": "equal-cooling",
|
2021-03-19 17:21:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
2021-03-21 09:56:27 +00:00
|
|
|
"data_train, data_test, labels_train, labels_test = train_test_split(data, labels, test_size=0.5, stratify=labels)"
|
2021-03-19 17:21:00 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-03-21 09:56:27 +00:00
|
|
|
"execution_count": 9,
|
2021-03-26 20:01:05 +00:00
|
|
|
"id": "valuable-illinois",
|
2021-03-19 17:21:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
2021-03-21 09:56:27 +00:00
|
|
|
"Model: \"sequential_1\"\n",
|
2021-03-19 17:21:00 +00:00
|
|
|
"_________________________________________________________________\n",
|
|
|
|
"Layer (type) Output Shape Param # \n",
|
|
|
|
"=================================================================\n",
|
2021-03-21 09:56:27 +00:00
|
|
|
"dense_2 (Dense) (None, 50) 500 \n",
|
2021-03-19 17:21:00 +00:00
|
|
|
"_________________________________________________________________\n",
|
2021-03-21 09:56:27 +00:00
|
|
|
"dense_3 (Dense) (None, 2) 102 \n",
|
2021-03-19 17:21:00 +00:00
|
|
|
"=================================================================\n",
|
|
|
|
"Total params: 602\n",
|
|
|
|
"Trainable params: 602\n",
|
|
|
|
"Non-trainable params: 0\n",
|
|
|
|
"_________________________________________________________________\n"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"layers = [tf.keras.layers.InputLayer(input_shape=(9,)), \n",
|
|
|
|
" tf.keras.layers.Dense(50, activation='sigmoid'), \n",
|
|
|
|
" tf.keras.layers.Dense(2, activation='softmax')]\n",
|
|
|
|
"\n",
|
|
|
|
"model = tf.keras.models.Sequential(layers)\n",
|
2021-03-21 09:56:27 +00:00
|
|
|
"model.compile('sgd', loss='categorical_crossentropy', metrics=['accuracy'])\n",
|
2021-03-19 17:21:00 +00:00
|
|
|
"model.summary()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-03-21 09:56:27 +00:00
|
|
|
"execution_count": null,
|
2021-03-26 20:01:05 +00:00
|
|
|
"id": "opened-terminology",
|
2021-03-19 17:21:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
2021-03-21 09:56:27 +00:00
|
|
|
"Epoch 1/50\n",
|
|
|
|
"10/10 [==============================] - 0s 16ms/step - loss: 0.6577 - accuracy: 0.6181 - val_loss: 0.6124 - val_accuracy: 0.6857\n"
|
2021-03-19 17:21:00 +00:00
|
|
|
]
|
2021-03-21 09:56:27 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"e=50\n",
|
|
|
|
"history = model.fit(data_train, labels_train, epochs=e, validation_split=0.1)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
2021-03-26 20:01:05 +00:00
|
|
|
"id": "forward-asthma",
|
2021-03-21 09:56:27 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"model.evaluate(data_test, \n",
|
|
|
|
" labels_test, \n",
|
|
|
|
" batch_size=128)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
2021-03-26 20:01:05 +00:00
|
|
|
"id": "local-program",
|
2021-03-21 09:56:27 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"json.loads(model.to_json())"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 8,
|
2021-03-26 20:01:05 +00:00
|
|
|
"id": "animated-raise",
|
2021-03-21 09:56:27 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
2021-03-19 17:21:00 +00:00
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/plain": [
|
2021-03-21 09:56:27 +00:00
|
|
|
"{'_self_setattr_tracking': True,\n",
|
|
|
|
" '_is_model_for_instrumentation': True,\n",
|
|
|
|
" '_instrumented_keras_api': True,\n",
|
|
|
|
" '_instrumented_keras_layer_class': False,\n",
|
|
|
|
" '_instrumented_keras_model_class': True,\n",
|
|
|
|
" '_trainable': True,\n",
|
|
|
|
" '_stateful': False,\n",
|
|
|
|
" 'built': True,\n",
|
|
|
|
" '_build_input_shape': TensorShape([None, 9]),\n",
|
|
|
|
" '_saved_model_inputs_spec': TensorSpec(shape=(None, 9), dtype=tf.float32, name='input_1'),\n",
|
|
|
|
" '_input_spec': None,\n",
|
|
|
|
" '_supports_masking': True,\n",
|
|
|
|
" '_name': 'sequential',\n",
|
|
|
|
" '_activity_regularizer': None,\n",
|
|
|
|
" '_trainable_weights': [],\n",
|
|
|
|
" '_non_trainable_weights': [],\n",
|
|
|
|
" '_updates': [],\n",
|
|
|
|
" '_thread_local': <_thread._local at 0x1e9b3938c70>,\n",
|
|
|
|
" '_callable_losses': [],\n",
|
|
|
|
" '_losses': [],\n",
|
|
|
|
" '_metrics': [],\n",
|
|
|
|
" '_metrics_lock': <unlocked _thread.lock object at 0x000001E9CF471E40>,\n",
|
|
|
|
" '_dtype_policy': <Policy \"float32\">,\n",
|
|
|
|
" '_compute_dtype_object': tf.float32,\n",
|
|
|
|
" '_autocast': False,\n",
|
|
|
|
" '_layers': [<tensorflow.python.keras.engine.input_layer.InputLayer at 0x1e9cf471eb0>,\n",
|
|
|
|
" <tensorflow.python.keras.layers.core.Dense at 0x1e9cf4c8f10>,\n",
|
|
|
|
" <tensorflow.python.keras.layers.core.Dense at 0x1e9cf518250>],\n",
|
|
|
|
" '_inbound_nodes_value': [],\n",
|
|
|
|
" '_outbound_nodes_value': [],\n",
|
|
|
|
" '_expects_training_arg': True,\n",
|
|
|
|
" '_default_training_arg': None,\n",
|
|
|
|
" '_expects_mask_arg': True,\n",
|
|
|
|
" '_dynamic': False,\n",
|
|
|
|
" '_initial_weights': None,\n",
|
|
|
|
" '_auto_track_sub_layers': False,\n",
|
|
|
|
" '_preserve_input_structure_in_config': False,\n",
|
|
|
|
" '_is_graph_network': True,\n",
|
|
|
|
" 'inputs': [<KerasTensor: shape=(None, 9) dtype=float32 (created by layer 'input_1')>],\n",
|
|
|
|
" 'outputs': [<KerasTensor: shape=(None, 2) dtype=float32 (created by layer 'dense_1')>],\n",
|
|
|
|
" 'input_names': ['input_1'],\n",
|
|
|
|
" 'output_names': ['dense_1'],\n",
|
|
|
|
" '_compute_output_and_mask_jointly': True,\n",
|
|
|
|
" '_distribution_strategy': None,\n",
|
|
|
|
" 'predict_function': None,\n",
|
|
|
|
" '_compiled_trainable_state': <WeakKeyDictionary at 0x1e9cf8449a0>,\n",
|
|
|
|
" '_training_state': None,\n",
|
|
|
|
" '_trackable_saver': <tensorflow.python.training.tracking.util.TrackableSaver at 0x1e9cf518640>,\n",
|
|
|
|
" '_steps_per_execution': <tf.Variable 'Variable:0' shape=() dtype=int64, numpy=1>,\n",
|
|
|
|
" '_train_counter': <tf.Variable 'Variable:0' shape=() dtype=int64, numpy=500>,\n",
|
|
|
|
" '_test_counter': <tf.Variable 'Variable:0' shape=() dtype=int64, numpy=3>,\n",
|
|
|
|
" '_predict_counter': <tf.Variable 'Variable:0' shape=() dtype=int64, numpy=0>,\n",
|
|
|
|
" '_base_model_initialized': True,\n",
|
|
|
|
" '_inferred_input_shape': None,\n",
|
|
|
|
" '_has_explicit_input_shape': True,\n",
|
|
|
|
" '_input_dtype': None,\n",
|
|
|
|
" '_layer_call_argspecs': {<tensorflow.python.keras.engine.input_layer.InputLayer at 0x1e9cf471eb0>: FullArgSpec(args=['self', 'inputs'], varargs=None, varkw='kwargs', defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={}),\n",
|
|
|
|
" <tensorflow.python.keras.layers.core.Dense at 0x1e9cf4c8f10>: FullArgSpec(args=['self', 'inputs'], varargs=None, varkw=None, defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={}),\n",
|
|
|
|
" <tensorflow.python.keras.layers.core.Dense at 0x1e9cf518250>: FullArgSpec(args=['self', 'inputs'], varargs=None, varkw=None, defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})},\n",
|
|
|
|
" '_created_nodes': set(),\n",
|
|
|
|
" '_graph_initialized': True,\n",
|
|
|
|
" '_use_legacy_deferred_behavior': False,\n",
|
|
|
|
" '_nested_inputs': <KerasTensor: shape=(None, 9) dtype=float32 (created by layer 'input_1')>,\n",
|
|
|
|
" '_nested_outputs': <KerasTensor: shape=(None, 2) dtype=float32 (created by layer 'dense_1')>,\n",
|
|
|
|
" '_enable_dict_to_input_mapping': True,\n",
|
|
|
|
" '_input_layers': [<tensorflow.python.keras.engine.input_layer.InputLayer at 0x1e9cf471eb0>],\n",
|
|
|
|
" '_output_layers': [<tensorflow.python.keras.layers.core.Dense at 0x1e9cf518250>],\n",
|
|
|
|
" '_input_coordinates': [(<tensorflow.python.keras.engine.input_layer.InputLayer at 0x1e9cf471eb0>,\n",
|
|
|
|
" 0,\n",
|
|
|
|
" 0)],\n",
|
|
|
|
" '_output_coordinates': [(<tensorflow.python.keras.layers.core.Dense at 0x1e9cf518250>,\n",
|
|
|
|
" 0,\n",
|
|
|
|
" 0)],\n",
|
|
|
|
" '_output_mask_cache': {},\n",
|
|
|
|
" '_output_tensor_cache': {},\n",
|
|
|
|
" '_output_shape_cache': {},\n",
|
|
|
|
" '_network_nodes': {'dense_1_ib-0', 'dense_ib-0', 'input_1_ib-0'},\n",
|
|
|
|
" '_nodes_by_depth': defaultdict(list,\n",
|
|
|
|
" {0: [<tensorflow.python.keras.engine.node.Node at 0x1e9cf831f70>],\n",
|
|
|
|
" 1: [<tensorflow.python.keras.engine.node.Node at 0x1e9cf518190>],\n",
|
|
|
|
" 2: [<tensorflow.python.keras.engine.node.Node at 0x1e9cf4c8d30>]}),\n",
|
|
|
|
" '_feed_input_names': ['input_1'],\n",
|
|
|
|
" '_feed_inputs': [<KerasTensor: shape=(None, 9) dtype=float32 (created by layer 'input_1')>],\n",
|
|
|
|
" '_feed_input_shapes': [(None, 9)],\n",
|
|
|
|
" '_tensor_usage_count': Counter({'2103716908480': 1,\n",
|
|
|
|
" '2103720484432': 1,\n",
|
|
|
|
" '2103720530848': 1}),\n",
|
|
|
|
" '_obj_reference_counts_dict': ObjectIdentityDictionary({<_ObjectIdentityWrapper wrapping <tensorflow.python.keras.optimizer_v2.gradient_descent.SGD object at 0x000001E9CF518430>>: 1, <_ObjectIdentityWrapper wrapping <tensorflow.python.keras.engine.compile_utils.LossesContainer object at 0x000001E9CF83D8E0>>: 1, <_ObjectIdentityWrapper wrapping <tensorflow.python.keras.engine.compile_utils.MetricsContainer object at 0x000001E9CF844940>>: 1, <_ObjectIdentityWrapper wrapping True>: 1, <_ObjectIdentityWrapper wrapping 'categorical_crossentropy'>: 1, <_ObjectIdentityWrapper wrapping <tensorflow.python.eager.def_function.Function object at 0x000001E9D6A4AEE0>>: 1, <_ObjectIdentityWrapper wrapping <tensorflow.python.eager.def_function.Function object at 0x000001E9F00CBA90>>: 1, <_ObjectIdentityWrapper wrapping <tensorflow.python.keras.callbacks.History object at 0x000001E9F2BBFB50>>: 1}),\n",
|
|
|
|
" '_run_eagerly': None,\n",
|
|
|
|
" '_self_unconditional_checkpoint_dependencies': [TrackableReference(name='optimizer', ref=<tensorflow.python.keras.optimizer_v2.gradient_descent.SGD object at 0x000001E9CF518430>)],\n",
|
|
|
|
" '_self_unconditional_dependency_names': {'optimizer': <tensorflow.python.keras.optimizer_v2.gradient_descent.SGD at 0x1e9cf518430>},\n",
|
|
|
|
" '_self_unconditional_deferred_dependencies': {},\n",
|
|
|
|
" '_self_update_uid': -1,\n",
|
|
|
|
" '_self_name_based_restores': set(),\n",
|
|
|
|
" '_self_saveable_object_factories': {},\n",
|
|
|
|
" 'optimizer': <tensorflow.python.keras.optimizer_v2.gradient_descent.SGD at 0x1e9cf518430>,\n",
|
|
|
|
" 'compiled_loss': <tensorflow.python.keras.engine.compile_utils.LossesContainer at 0x1e9cf83d8e0>,\n",
|
|
|
|
" 'compiled_metrics': <tensorflow.python.keras.engine.compile_utils.MetricsContainer at 0x1e9cf844940>,\n",
|
|
|
|
" '_is_compiled': True,\n",
|
|
|
|
" 'loss': 'categorical_crossentropy',\n",
|
|
|
|
" 'stop_training': False,\n",
|
|
|
|
" 'train_function': <tensorflow.python.eager.def_function.Function at 0x1e9d6a4aee0>,\n",
|
|
|
|
" 'history': <tensorflow.python.keras.callbacks.History at 0x1e9f2bbfb50>,\n",
|
|
|
|
" 'test_function': <tensorflow.python.eager.def_function.Function at 0x1e9f00cba90>}"
|
2021-03-19 17:21:00 +00:00
|
|
|
]
|
|
|
|
},
|
2021-03-21 09:56:27 +00:00
|
|
|
"execution_count": 8,
|
2021-03-19 17:21:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
2021-03-21 09:56:27 +00:00
|
|
|
"model.__dict__"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
2021-03-26 20:01:05 +00:00
|
|
|
"id": "third-accuracy",
|
2021-03-21 09:56:27 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"model.optimizer.get_config()"
|
2021-03-19 17:21:00 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-03-21 09:56:27 +00:00
|
|
|
"execution_count": 9,
|
2021-03-26 20:01:05 +00:00
|
|
|
"id": "synthetic-armstrong",
|
2021-03-19 17:21:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
2021-03-21 09:56:27 +00:00
|
|
|
"image/png": "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
|
2021-03-19 17:21:00 +00:00
|
|
|
"text/plain": [
|
2021-03-21 09:56:27 +00:00
|
|
|
"<Figure size 3000x1400 with 2 Axes>"
|
2021-03-19 17:21:00 +00:00
|
|
|
]
|
|
|
|
},
|
2021-03-21 09:56:27 +00:00
|
|
|
"metadata": {
|
|
|
|
"needs_background": "light"
|
|
|
|
},
|
|
|
|
"output_type": "display_data"
|
2021-03-19 17:21:00 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
2021-03-21 09:56:27 +00:00
|
|
|
"fig, axes = plt.subplots(1, 2, figsize=(15,7))\n",
|
|
|
|
"fig.set_dpi(fig_dpi)\n",
|
|
|
|
"\n",
|
|
|
|
"ax = axes[0]\n",
|
|
|
|
"ax.set_title(\"Training vs Validation Loss\")\n",
|
|
|
|
"ax.plot(history.history['loss'], label=\"train\", lw=2)\n",
|
|
|
|
"ax.plot(history.history['val_loss'], label=\"validation\", lw=2, c=(1,0,0))\n",
|
|
|
|
"ax.set_xlabel(\"Epochs\")\n",
|
|
|
|
"ax.legend()\n",
|
|
|
|
"\n",
|
|
|
|
"ax = axes[1]\n",
|
|
|
|
"ax.set_title(\"Training vs Validation Accuracy\")\n",
|
|
|
|
"ax.plot(history.history['accuracy'], label=\"train\", lw=2)\n",
|
|
|
|
"ax.plot(history.history['val_accuracy'], label=\"validation\", lw=2, c=(1,0,0))\n",
|
|
|
|
"ax.set_xlabel(\"Epochs\")\n",
|
|
|
|
"ax.set_ylim(0, 1)\n",
|
|
|
|
"ax.legend()\n",
|
|
|
|
"\n",
|
|
|
|
"plt.show()"
|
2021-03-19 17:21:00 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-03-21 09:56:27 +00:00
|
|
|
"execution_count": 7,
|
2021-03-26 20:01:05 +00:00
|
|
|
"id": "coordinated-salvation",
|
2021-03-19 17:21:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"tensor = model(data_test.to_numpy())"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-03-21 09:56:27 +00:00
|
|
|
"execution_count": 8,
|
2021-03-26 20:01:05 +00:00
|
|
|
"id": "roman-explorer",
|
2021-03-19 17:21:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/plain": [
|
|
|
|
"<tf.Tensor: shape=(350, 2), dtype=float32, numpy=\n",
|
2021-03-21 09:56:27 +00:00
|
|
|
"array([[0.9801853 , 0.01981472],\n",
|
|
|
|
" [0.9926891 , 0.00731087],\n",
|
|
|
|
" [0.9628417 , 0.03715829],\n",
|
|
|
|
" [0.03073526, 0.9692647 ],\n",
|
|
|
|
" [0.95234215, 0.04765787],\n",
|
|
|
|
" [0.98602563, 0.01397439],\n",
|
|
|
|
" [0.10280664, 0.8971934 ],\n",
|
|
|
|
" [0.07686787, 0.9231321 ],\n",
|
|
|
|
" [0.99190474, 0.00809523],\n",
|
|
|
|
" [0.99078685, 0.00921312],\n",
|
|
|
|
" [0.9831904 , 0.01680959],\n",
|
|
|
|
" [0.99190474, 0.00809523],\n",
|
|
|
|
" [0.98902273, 0.01097724],\n",
|
|
|
|
" [0.98902273, 0.01097724],\n",
|
|
|
|
" [0.98237324, 0.01762678],\n",
|
|
|
|
" [0.98882884, 0.01117116],\n",
|
|
|
|
" [0.01222708, 0.9877729 ],\n",
|
|
|
|
" [0.97519624, 0.02480372],\n",
|
|
|
|
" [0.99190474, 0.00809523],\n",
|
|
|
|
" [0.08153479, 0.9184652 ],\n",
|
|
|
|
" [0.9928901 , 0.00710991],\n",
|
|
|
|
" [0.05978837, 0.94021165],\n",
|
|
|
|
" [0.9801853 , 0.01981472],\n",
|
|
|
|
" [0.09358412, 0.9064159 ],\n",
|
|
|
|
" [0.9801853 , 0.01981472],\n",
|
|
|
|
" [0.99190474, 0.00809523],\n",
|
|
|
|
" [0.5003021 , 0.49969792],\n",
|
|
|
|
" [0.9815221 , 0.01847788],\n",
|
|
|
|
" [0.11047691, 0.889523 ],\n",
|
|
|
|
" [0.98602563, 0.01397439],\n",
|
|
|
|
" [0.00534083, 0.9946591 ],\n",
|
|
|
|
" [0.9825487 , 0.0174513 ],\n",
|
|
|
|
" [0.97305536, 0.02694468],\n",
|
|
|
|
" [0.9633045 , 0.03669543],\n",
|
|
|
|
" [0.9898519 , 0.01014804],\n",
|
|
|
|
" [0.95956725, 0.04043271],\n",
|
|
|
|
" [0.11385527, 0.88614476],\n",
|
|
|
|
" [0.0526755 , 0.9473245 ],\n",
|
|
|
|
" [0.08191174, 0.91808826],\n",
|
|
|
|
" [0.975471 , 0.02452892],\n",
|
|
|
|
" [0.96881 , 0.03119001],\n",
|
|
|
|
" [0.9862664 , 0.01373362],\n",
|
|
|
|
" [0.02994935, 0.97005063],\n",
|
|
|
|
" [0.9898519 , 0.01014804],\n",
|
|
|
|
" [0.16885298, 0.831147 ],\n",
|
|
|
|
" [0.97960424, 0.02039572],\n",
|
|
|
|
" [0.9884575 , 0.01154249],\n",
|
|
|
|
" [0.11157885, 0.8884212 ],\n",
|
|
|
|
" [0.9038618 , 0.09613817],\n",
|
|
|
|
" [0.9811632 , 0.01883673],\n",
|
|
|
|
" [0.71255827, 0.28744167],\n",
|
|
|
|
" [0.01894411, 0.9810559 ],\n",
|
|
|
|
" [0.9862664 , 0.01373362],\n",
|
|
|
|
" [0.02488227, 0.9751177 ],\n",
|
|
|
|
" [0.9899156 , 0.01008447],\n",
|
|
|
|
" [0.08436204, 0.91563797],\n",
|
|
|
|
" [0.97465366, 0.02534635],\n",
|
|
|
|
" [0.9788304 , 0.02116962],\n",
|
|
|
|
" [0.99078685, 0.00921312],\n",
|
|
|
|
" [0.9596988 , 0.04030127],\n",
|
|
|
|
" [0.06126701, 0.938733 ],\n",
|
|
|
|
" [0.9928901 , 0.00710991],\n",
|
|
|
|
" [0.06121646, 0.9387835 ],\n",
|
|
|
|
" [0.34550568, 0.65449435],\n",
|
|
|
|
" [0.99108255, 0.00891742],\n",
|
|
|
|
" [0.99190474, 0.00809523],\n",
|
|
|
|
" [0.00280253, 0.9971975 ],\n",
|
|
|
|
" [0.9928901 , 0.00710991],\n",
|
|
|
|
" [0.99204755, 0.00795248],\n",
|
|
|
|
" [0.29036736, 0.7096326 ],\n",
|
|
|
|
" [0.98586327, 0.01413671],\n",
|
|
|
|
" [0.97960806, 0.0203919 ],\n",
|
|
|
|
" [0.98411894, 0.01588103],\n",
|
|
|
|
" [0.04055419, 0.9594458 ],\n",
|
|
|
|
" [0.9881726 , 0.01182744],\n",
|
|
|
|
" [0.1958921 , 0.8041079 ],\n",
|
|
|
|
" [0.02864912, 0.9713509 ],\n",
|
|
|
|
" [0.00602777, 0.99397224],\n",
|
|
|
|
" [0.08019029, 0.91980964],\n",
|
|
|
|
" [0.11171903, 0.8882809 ],\n",
|
|
|
|
" [0.9881726 , 0.01182744],\n",
|
|
|
|
" [0.17073832, 0.82926166],\n",
|
|
|
|
" [0.22782806, 0.7721719 ],\n",
|
|
|
|
" [0.44395986, 0.5560401 ],\n",
|
|
|
|
" [0.6307267 , 0.36927328],\n",
|
|
|
|
" [0.98882884, 0.01117116],\n",
|
|
|
|
" [0.99078685, 0.00921312],\n",
|
|
|
|
" [0.98602563, 0.01397439],\n",
|
|
|
|
" [0.9818465 , 0.01815345],\n",
|
|
|
|
" [0.78953874, 0.21046132],\n",
|
|
|
|
" [0.00406485, 0.9959351 ],\n",
|
|
|
|
" [0.9814414 , 0.01855859],\n",
|
|
|
|
" [0.00271158, 0.99728847],\n",
|
|
|
|
" [0.96431845, 0.03568152],\n",
|
|
|
|
" [0.02134761, 0.9786524 ],\n",
|
|
|
|
" [0.96153224, 0.03846784],\n",
|
|
|
|
" [0.05516699, 0.944833 ],\n",
|
|
|
|
" [0.9775564 , 0.02244362],\n",
|
|
|
|
" [0.97136647, 0.02863356],\n",
|
|
|
|
" [0.98825955, 0.01174045],\n",
|
|
|
|
" [0.97474086, 0.02525917],\n",
|
|
|
|
" [0.9838537 , 0.01614636],\n",
|
|
|
|
" [0.98602563, 0.01397439],\n",
|
|
|
|
" [0.04362229, 0.95637774],\n",
|
|
|
|
" [0.00622424, 0.9937757 ],\n",
|
|
|
|
" [0.9775203 , 0.02247973],\n",
|
|
|
|
" [0.3481092 , 0.6518908 ],\n",
|
|
|
|
" [0.01587938, 0.98412067],\n",
|
|
|
|
" [0.9884575 , 0.01154249],\n",
|
|
|
|
" [0.9928901 , 0.00710991],\n",
|
|
|
|
" [0.99078685, 0.00921312],\n",
|
|
|
|
" [0.9825487 , 0.0174513 ],\n",
|
|
|
|
" [0.980631 , 0.01936896],\n",
|
|
|
|
" [0.9746114 , 0.02538859],\n",
|
|
|
|
" [0.9820693 , 0.01793065],\n",
|
|
|
|
" [0.88999826, 0.11000182],\n",
|
|
|
|
" [0.9928901 , 0.00710991],\n",
|
|
|
|
" [0.98602563, 0.01397439],\n",
|
|
|
|
" [0.9899156 , 0.01008447],\n",
|
|
|
|
" [0.18822296, 0.811777 ],\n",
|
|
|
|
" [0.98365664, 0.01634333],\n",
|
|
|
|
" [0.9775203 , 0.02247973],\n",
|
|
|
|
" [0.02279323, 0.9772068 ],\n",
|
|
|
|
" [0.9872952 , 0.01270485],\n",
|
|
|
|
" [0.9893377 , 0.0106623 ],\n",
|
|
|
|
" [0.9928901 , 0.00710991],\n",
|
|
|
|
" [0.9917625 , 0.00823749],\n",
|
|
|
|
" [0.9827151 , 0.01728498],\n",
|
|
|
|
" [0.04650781, 0.9534922 ],\n",
|
|
|
|
" [0.9721344 , 0.02786556],\n",
|
|
|
|
" [0.04326608, 0.95673394],\n",
|
|
|
|
" [0.9898519 , 0.01014804],\n",
|
|
|
|
" [0.9811445 , 0.0188555 ],\n",
|
|
|
|
" [0.9872952 , 0.01270485],\n",
|
|
|
|
" [0.9928901 , 0.00710991],\n",
|
|
|
|
" [0.9872952 , 0.01270485],\n",
|
|
|
|
" [0.9820363 , 0.01796375],\n",
|
|
|
|
" [0.5693888 , 0.4306112 ],\n",
|
|
|
|
" [0.9842153 , 0.01578473],\n",
|
|
|
|
" [0.00773495, 0.9922651 ],\n",
|
|
|
|
" [0.98602563, 0.01397439],\n",
|
|
|
|
" [0.9855597 , 0.01444028],\n",
|
|
|
|
" [0.9381649 , 0.06183509],\n",
|
|
|
|
" [0.9872952 , 0.01270485],\n",
|
|
|
|
" [0.02490397, 0.97509605],\n",
|
|
|
|
" [0.09574957, 0.9042504 ],\n",
|
|
|
|
" [0.13992904, 0.860071 ],\n",
|
|
|
|
" [0.03468701, 0.96531296],\n",
|
|
|
|
" [0.9717713 , 0.02822872],\n",
|
|
|
|
" [0.9858747 , 0.01412521],\n",
|
|
|
|
" [0.9581099 , 0.04189004],\n",
|
|
|
|
" [0.99190474, 0.00809523],\n",
|
|
|
|
" [0.00402759, 0.99597245],\n",
|
|
|
|
" [0.04732035, 0.95267963],\n",
|
|
|
|
" [0.05004258, 0.9499575 ],\n",
|
|
|
|
" [0.97465366, 0.02534635],\n",
|
|
|
|
" [0.9872952 , 0.01270485],\n",
|
|
|
|
" [0.9893835 , 0.01061649],\n",
|
|
|
|
" [0.3334639 , 0.66653615],\n",
|
|
|
|
" [0.90755075, 0.09244923],\n",
|
|
|
|
" [0.98882884, 0.01117116],\n",
|
|
|
|
" [0.98903185, 0.01096814],\n",
|
|
|
|
" [0.99078685, 0.00921312],\n",
|
|
|
|
" [0.96168005, 0.03831991],\n",
|
|
|
|
" [0.981965 , 0.01803497],\n",
|
|
|
|
" [0.98902273, 0.01097724],\n",
|
|
|
|
" [0.00236953, 0.9976305 ],\n",
|
|
|
|
" [0.08982091, 0.9101791 ],\n",
|
|
|
|
" [0.1135387 , 0.8864613 ],\n",
|
|
|
|
" [0.9938671 , 0.0061329 ],\n",
|
|
|
|
" [0.13269322, 0.8673067 ],\n",
|
|
|
|
" [0.61057794, 0.38942203],\n",
|
|
|
|
" [0.9872952 , 0.01270485],\n",
|
|
|
|
" [0.9801853 , 0.01981472],\n",
|
|
|
|
" [0.9903584 , 0.00964163],\n",
|
|
|
|
" [0.97204506, 0.02795494],\n",
|
|
|
|
" [0.9853139 , 0.01468608],\n",
|
|
|
|
" [0.98882884, 0.01117116],\n",
|
|
|
|
" [0.99190474, 0.00809523],\n",
|
|
|
|
" [0.99190474, 0.00809523],\n",
|
|
|
|
" [0.9853094 , 0.01469058],\n",
|
|
|
|
" [0.16317306, 0.836827 ],\n",
|
|
|
|
" [0.02048163, 0.97951835],\n",
|
|
|
|
" [0.99078685, 0.00921312],\n",
|
|
|
|
" [0.9872952 , 0.01270485],\n",
|
|
|
|
" [0.97727305, 0.02272695],\n",
|
|
|
|
" [0.00605206, 0.99394786],\n",
|
|
|
|
" [0.9928901 , 0.00710991],\n",
|
|
|
|
" [0.14910528, 0.85089475],\n",
|
|
|
|
" [0.01027166, 0.98972833],\n",
|
|
|
|
" [0.9404712 , 0.0595288 ],\n",
|
|
|
|
" [0.9872952 , 0.01270485],\n",
|
|
|
|
" [0.9151222 , 0.08487778],\n",
|
|
|
|
" [0.17249718, 0.82750285],\n",
|
|
|
|
" [0.7364639 , 0.2635361 ],\n",
|
|
|
|
" [0.9560006 , 0.04399942],\n",
|
|
|
|
" [0.9898519 , 0.01014804],\n",
|
|
|
|
" [0.14065848, 0.8593415 ],\n",
|
|
|
|
" [0.06515042, 0.93484956],\n",
|
|
|
|
" [0.00246285, 0.99753714],\n",
|
|
|
|
" [0.98882884, 0.01117116],\n",
|
|
|
|
" [0.9872952 , 0.01270485],\n",
|
|
|
|
" [0.99190474, 0.00809523],\n",
|
|
|
|
" [0.86330867, 0.13669129],\n",
|
|
|
|
" [0.9872952 , 0.01270485],\n",
|
|
|
|
" [0.9825487 , 0.0174513 ],\n",
|
|
|
|
" [0.16500047, 0.8349995 ],\n",
|
|
|
|
" [0.53791696, 0.4620831 ],\n",
|
|
|
|
" [0.9898519 , 0.01014804],\n",
|
|
|
|
" [0.99078685, 0.00921312],\n",
|
|
|
|
" [0.9708858 , 0.02911417],\n",
|
|
|
|
" [0.98892224, 0.01107774],\n",
|
|
|
|
" [0.5222743 , 0.47772565],\n",
|
|
|
|
" [0.9928901 , 0.00710991],\n",
|
|
|
|
" [0.00319345, 0.9968066 ],\n",
|
|
|
|
" [0.98514056, 0.01485936],\n",
|
|
|
|
" [0.9928901 , 0.00710991],\n",
|
|
|
|
" [0.9548213 , 0.04517876],\n",
|
|
|
|
" [0.98882884, 0.01117116],\n",
|
|
|
|
" [0.582204 , 0.41779602],\n",
|
|
|
|
" [0.95525944, 0.04474052],\n",
|
|
|
|
" [0.9811445 , 0.0188555 ],\n",
|
|
|
|
" [0.06356736, 0.93643266],\n",
|
|
|
|
" [0.99108255, 0.00891742],\n",
|
|
|
|
" [0.9872952 , 0.01270485],\n",
|
|
|
|
" [0.97405064, 0.02594929],\n",
|
|
|
|
" [0.9923038 , 0.0076962 ],\n",
|
|
|
|
" [0.99204755, 0.00795248],\n",
|
|
|
|
" [0.980293 , 0.01970703],\n",
|
|
|
|
" [0.99078685, 0.00921312],\n",
|
|
|
|
" [0.975471 , 0.02452892],\n",
|
|
|
|
" [0.97204506, 0.02795494],\n",
|
|
|
|
" [0.040151 , 0.959849 ],\n",
|
|
|
|
" [0.99301505, 0.00698495],\n",
|
|
|
|
" [0.52752644, 0.47247356],\n",
|
|
|
|
" [0.03305454, 0.96694547],\n",
|
|
|
|
" [0.9675697 , 0.03243022],\n",
|
|
|
|
" [0.02140073, 0.9785993 ],\n",
|
|
|
|
" [0.01063837, 0.9893616 ],\n",
|
|
|
|
" [0.99078685, 0.00921312],\n",
|
|
|
|
" [0.97960806, 0.0203919 ],\n",
|
|
|
|
" [0.10082608, 0.89917386],\n",
|
|
|
|
" [0.0673348 , 0.93266517],\n",
|
|
|
|
" [0.9447868 , 0.05521324],\n",
|
|
|
|
" [0.01348197, 0.98651797],\n",
|
|
|
|
" [0.99204755, 0.00795248],\n",
|
|
|
|
" [0.00669446, 0.9933055 ],\n",
|
|
|
|
" [0.00779293, 0.9922071 ],\n",
|
|
|
|
" [0.00551592, 0.994484 ],\n",
|
|
|
|
" [0.9771452 , 0.02285476],\n",
|
|
|
|
" [0.0136543 , 0.9863457 ],\n",
|
|
|
|
" [0.98627186, 0.01372816],\n",
|
|
|
|
" [0.9928901 , 0.00710991],\n",
|
|
|
|
" [0.46391317, 0.53608686],\n",
|
|
|
|
" [0.9801853 , 0.01981472],\n",
|
|
|
|
" [0.72362626, 0.27637374],\n",
|
|
|
|
" [0.09471217, 0.90528786],\n",
|
|
|
|
" [0.0470202 , 0.95297986],\n",
|
|
|
|
" [0.00357349, 0.9964265 ],\n",
|
|
|
|
" [0.04937639, 0.95062363],\n",
|
|
|
|
" [0.9928901 , 0.00710991],\n",
|
|
|
|
" [0.9836901 , 0.01630987],\n",
|
|
|
|
" [0.07471903, 0.9252809 ],\n",
|
|
|
|
" [0.98411894, 0.01588103],\n",
|
|
|
|
" [0.05152437, 0.94847566],\n",
|
|
|
|
" [0.9928901 , 0.00710991],\n",
|
|
|
|
" [0.9871589 , 0.01284102],\n",
|
|
|
|
" [0.95937496, 0.04062498],\n",
|
|
|
|
" [0.03402388, 0.9659761 ],\n",
|
|
|
|
" [0.10793284, 0.8920672 ],\n",
|
|
|
|
" [0.11131216, 0.88868785],\n",
|
|
|
|
" [0.9865871 , 0.01341282],\n",
|
|
|
|
" [0.9855597 , 0.01444028],\n",
|
|
|
|
" [0.01075125, 0.98924875],\n",
|
|
|
|
" [0.98955685, 0.01044314],\n",
|
|
|
|
" [0.99108255, 0.00891742],\n",
|
|
|
|
" [0.01742107, 0.9825789 ],\n",
|
|
|
|
" [0.9616439 , 0.03835611],\n",
|
|
|
|
" [0.9217987 , 0.07820132],\n",
|
|
|
|
" [0.9928901 , 0.00710991],\n",
|
|
|
|
" [0.01513559, 0.9848644 ],\n",
|
|
|
|
" [0.99078685, 0.00921312],\n",
|
|
|
|
" [0.981965 , 0.01803497],\n",
|
|
|
|
" [0.9776144 , 0.02238566],\n",
|
|
|
|
" [0.05140878, 0.9485912 ],\n",
|
|
|
|
" [0.84267443, 0.15732561],\n",
|
|
|
|
" [0.9522025 , 0.04779752],\n",
|
|
|
|
" [0.9712332 , 0.02876678],\n",
|
|
|
|
" [0.99301505, 0.00698495],\n",
|
|
|
|
" [0.10411921, 0.89588076],\n",
|
|
|
|
" [0.9889004 , 0.01109953],\n",
|
|
|
|
" [0.01602884, 0.9839712 ],\n",
|
|
|
|
" [0.99204755, 0.00795248],\n",
|
|
|
|
" [0.9881715 , 0.01182842],\n",
|
|
|
|
" [0.01760418, 0.9823958 ],\n",
|
|
|
|
" [0.9705625 , 0.0294375 ],\n",
|
|
|
|
" [0.00573339, 0.99426657],\n",
|
|
|
|
" [0.9855597 , 0.01444028],\n",
|
|
|
|
" [0.20140044, 0.79859954],\n",
|
|
|
|
" [0.96860284, 0.03139716],\n",
|
|
|
|
" [0.8577237 , 0.14227627],\n",
|
|
|
|
" [0.98384744, 0.01615255],\n",
|
|
|
|
" [0.04443884, 0.9555612 ],\n",
|
|
|
|
" [0.99078685, 0.00921312],\n",
|
|
|
|
" [0.36669564, 0.63330436],\n",
|
|
|
|
" [0.06703284, 0.9329671 ],\n",
|
|
|
|
" [0.17048047, 0.8295195 ],\n",
|
|
|
|
" [0.9775203 , 0.02247973],\n",
|
|
|
|
" [0.93597096, 0.06402898],\n",
|
|
|
|
" [0.9475726 , 0.05242743],\n",
|
|
|
|
" [0.9791864 , 0.02081357],\n",
|
|
|
|
" [0.9817647 , 0.01823526],\n",
|
|
|
|
" [0.99108255, 0.00891742],\n",
|
|
|
|
" [0.9872952 , 0.01270485],\n",
|
|
|
|
" [0.97686416, 0.02313586],\n",
|
|
|
|
" [0.9803022 , 0.01969773],\n",
|
|
|
|
" [0.9791864 , 0.02081357],\n",
|
|
|
|
" [0.9478458 , 0.05215417],\n",
|
|
|
|
" [0.00895109, 0.99104893],\n",
|
|
|
|
" [0.8635009 , 0.13649909],\n",
|
|
|
|
" [0.98365664, 0.01634333],\n",
|
|
|
|
" [0.03919939, 0.96080065],\n",
|
|
|
|
" [0.63790035, 0.36209962],\n",
|
|
|
|
" [0.0029722 , 0.9970278 ],\n",
|
|
|
|
" [0.98825574, 0.01174434],\n",
|
|
|
|
" [0.96775603, 0.03224399],\n",
|
|
|
|
" [0.99078685, 0.00921312],\n",
|
|
|
|
" [0.9372071 , 0.06279288],\n",
|
|
|
|
" [0.12397458, 0.8760254 ],\n",
|
|
|
|
" [0.93621886, 0.06378116],\n",
|
|
|
|
" [0.94735366, 0.05264638],\n",
|
|
|
|
" [0.99078685, 0.00921312],\n",
|
|
|
|
" [0.971693 , 0.02830696],\n",
|
|
|
|
" [0.19744301, 0.802557 ],\n",
|
|
|
|
" [0.99301505, 0.00698495],\n",
|
|
|
|
" [0.48893696, 0.51106304],\n",
|
|
|
|
" [0.00531539, 0.99468464],\n",
|
|
|
|
" [0.00586492, 0.9941351 ],\n",
|
|
|
|
" [0.97135025, 0.02864975],\n",
|
|
|
|
" [0.9771452 , 0.02285476],\n",
|
|
|
|
" [0.0034244 , 0.99657553],\n",
|
|
|
|
" [0.9855597 , 0.01444028],\n",
|
|
|
|
" [0.00339224, 0.9966078 ],\n",
|
|
|
|
" [0.9928901 , 0.00710991],\n",
|
|
|
|
" [0.0600323 , 0.9399677 ],\n",
|
|
|
|
" [0.01615115, 0.9838488 ],\n",
|
|
|
|
" [0.9857479 , 0.01425208],\n",
|
|
|
|
" [0.41190255, 0.58809745],\n",
|
|
|
|
" [0.9492881 , 0.0507119 ],\n",
|
|
|
|
" [0.01772507, 0.9822749 ]], dtype=float32)>"
|
2021-03-19 17:21:00 +00:00
|
|
|
]
|
|
|
|
},
|
2021-03-21 09:56:27 +00:00
|
|
|
"execution_count": 8,
|
2021-03-19 17:21:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"tensor"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-03-21 09:56:27 +00:00
|
|
|
"execution_count": 9,
|
2021-03-26 20:01:05 +00:00
|
|
|
"id": "caring-assets",
|
2021-03-19 17:21:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/plain": [
|
|
|
|
"<tf.Tensor: shape=(350, 2), dtype=float32, numpy=\n",
|
|
|
|
"array([[1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
2021-03-21 09:56:27 +00:00
|
|
|
" [1., 0.],\n",
|
2021-03-19 17:21:00 +00:00
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
2021-03-21 09:56:27 +00:00
|
|
|
" [1., 0.],\n",
|
2021-03-19 17:21:00 +00:00
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
2021-03-21 09:56:27 +00:00
|
|
|
" [1., 0.],\n",
|
2021-03-19 17:21:00 +00:00
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
2021-03-21 09:56:27 +00:00
|
|
|
" [1., 0.],\n",
|
2021-03-19 17:21:00 +00:00
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
2021-03-21 09:56:27 +00:00
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
2021-03-19 17:21:00 +00:00
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
2021-03-21 09:56:27 +00:00
|
|
|
" [1., 0.],\n",
|
2021-03-19 17:21:00 +00:00
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
2021-03-21 09:56:27 +00:00
|
|
|
" [1., 0.],\n",
|
2021-03-19 17:21:00 +00:00
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.],\n",
|
|
|
|
" [1., 0.],\n",
|
|
|
|
" [0., 1.]], dtype=float32)>"
|
|
|
|
]
|
|
|
|
},
|
2021-03-21 09:56:27 +00:00
|
|
|
"execution_count": 9,
|
2021-03-19 17:21:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"tf.math.round(tensor)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-03-21 09:56:27 +00:00
|
|
|
"execution_count": 10,
|
2021-03-26 20:01:05 +00:00
|
|
|
"id": "controversial-modern",
|
2021-03-19 17:21:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/plain": [
|
|
|
|
"<tf.Tensor: shape=(2,), dtype=int32, numpy=array([2, 0])>"
|
|
|
|
]
|
|
|
|
},
|
2021-03-21 09:56:27 +00:00
|
|
|
"execution_count": 10,
|
2021-03-19 17:21:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"tf.constant([1, 0]) + tf.constant([1, 0])"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-03-21 09:56:27 +00:00
|
|
|
"execution_count": 11,
|
2021-03-26 20:01:05 +00:00
|
|
|
"id": "correct-lodging",
|
2021-03-19 17:21:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/plain": [
|
|
|
|
"<tf.Tensor: shape=(2,), dtype=bool, numpy=array([False, False])>"
|
|
|
|
]
|
|
|
|
},
|
2021-03-21 09:56:27 +00:00
|
|
|
"execution_count": 11,
|
2021-03-19 17:21:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"tf.constant([1, 0]) == tf.constant([0, 1])"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-03-21 09:56:27 +00:00
|
|
|
"execution_count": 12,
|
2021-03-26 20:01:05 +00:00
|
|
|
"id": "suited-standard",
|
2021-03-19 17:21:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"name": "stdout",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
|
|
|
"tf.Tensor([1 0], shape=(2,), dtype=int64)\n",
|
|
|
|
"tf.Tensor([ True True], shape=(2,), dtype=bool)\n",
|
|
|
|
"tf.Tensor(0, shape=(), dtype=int64)\n",
|
|
|
|
"\n",
|
|
|
|
"tf.Tensor([1 0], shape=(2,), dtype=int64)\n",
|
|
|
|
"tf.Tensor([ True True], shape=(2,), dtype=bool)\n",
|
|
|
|
"tf.Tensor(0, shape=(), dtype=int64)\n",
|
|
|
|
"\n",
|
|
|
|
"tf.Tensor([1 0], shape=(2,), dtype=int64)\n",
|
|
|
|
"tf.Tensor([ True True], shape=(2,), dtype=bool)\n",
|
|
|
|
"tf.Tensor(0, shape=(), dtype=int64)\n",
|
|
|
|
"\n",
|
|
|
|
"tf.Tensor([0 1], shape=(2,), dtype=int64)\n",
|
|
|
|
"tf.Tensor([False False], shape=(2,), dtype=bool)\n",
|
|
|
|
"tf.Tensor(1, shape=(), dtype=int64)\n",
|
|
|
|
"\n",
|
|
|
|
"tf.Tensor([1 0], shape=(2,), dtype=int64)\n",
|
|
|
|
"tf.Tensor([ True True], shape=(2,), dtype=bool)\n",
|
|
|
|
"tf.Tensor(0, shape=(), dtype=int64)\n",
|
|
|
|
"\n"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"for c in tf.constant(labels_test)[:5]:\n",
|
|
|
|
" print(c)\n",
|
|
|
|
" print(c == tf.constant([1, 0], dtype='int64'))\n",
|
|
|
|
" print(tf.math.argmax(c))\n",
|
|
|
|
" print()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2021-03-21 09:56:27 +00:00
|
|
|
"execution_count": 13,
|
2021-03-26 20:01:05 +00:00
|
|
|
"id": "greater-publisher",
|
2021-03-19 17:21:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/plain": [
|
|
|
|
"<tf.Tensor: shape=(2,), dtype=int32, numpy=array([0, 2])>"
|
|
|
|
]
|
|
|
|
},
|
2021-03-21 09:56:27 +00:00
|
|
|
"execution_count": 13,
|
2021-03-19 17:21:00 +00:00
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"tf.math.reduce_sum(tf.constant([[0, 1], [0, 1]]), axis=0)"
|
|
|
|
]
|
|
|
|
},
|
2021-03-21 09:56:27 +00:00
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 9,
|
2021-03-26 20:01:05 +00:00
|
|
|
"id": "considerable-fluid",
|
2021-03-21 09:56:27 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/plain": [
|
|
|
|
"array([5.])"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"execution_count": 9,
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"np.linspace(5, 150, num=1)"
|
|
|
|
]
|
2021-03-19 17:21:00 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"kernelspec": {
|
|
|
|
"display_name": "Python 3",
|
|
|
|
"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.8.8"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"nbformat": 4,
|
|
|
|
"nbformat_minor": 5
|
|
|
|
}
|