{ "cells": [ { "cell_type": "code", "execution_count": 33, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[0 1]\n", "[1 0]\n" ] } ], "source": [ "import numpy as np\n", "\n", "y_out = [[[-0.52742714, -0.8918941 , -0.53989583, -0.874211 ]]]\n", "\n", "outputs = y_out[0][0]\n", "\n", "prob_action1 = outputs[:2]\n", "prob_action2 = outputs[2:]\n", "\n", "norm_action1 = [float(i)/sum(prob_action1) for i in prob_action1]\n", "norm_action2 = [float(i)/sum(prob_action2) for i in prob_action2]\n", "\n", "action1 = np.random.multinomial(1,norm_action1)\n", "action2 = np.random.multinomial(1,norm_action2)\n", "print(action1)\n", "print(action2)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "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.6.7" } }, "nbformat": 4, "nbformat_minor": 2 }