|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": 1, |
| 6 | + "metadata": {}, |
| 7 | + "outputs": [], |
| 8 | + "source": [ |
| 9 | + "# Make sure to update submodule zurcher_data. Otherwise this notebook doesn't work\n", |
| 10 | + "import yaml\n", |
| 11 | + "import os\n", |
| 12 | + "import pandas as pd\n", |
| 13 | + "from zurcher_data.data.data_reading import data_reading\n", |
| 14 | + "from zurcher_data.data.data_processing import data_processing\n", |
| 15 | + "\n", |
| 16 | + "from ruspy.estimation.estimation import estimate\n", |
| 17 | + "\n" |
| 18 | + ] |
| 19 | + }, |
| 20 | + { |
| 21 | + "cell_type": "code", |
| 22 | + "execution_count": 2, |
| 23 | + "metadata": {}, |
| 24 | + "outputs": [], |
| 25 | + "source": [ |
| 26 | + "with open(\"init_replication.yml\") as y:\n", |
| 27 | + " init_dict = yaml.safe_load(y)\n", |
| 28 | + "\n", |
| 29 | + "data_reading()\n", |
| 30 | + "data = data_processing(init_dict[\"replication\"])" |
| 31 | + ] |
| 32 | + }, |
| 33 | + { |
| 34 | + "cell_type": "code", |
| 35 | + "execution_count": 3, |
| 36 | + "metadata": {}, |
| 37 | + "outputs": [ |
| 38 | + { |
| 39 | + "name": "stdout", |
| 40 | + "output_type": "stream", |
| 41 | + "text": [ |
| 42 | + "{'state_count': array([[68, 94, 9, ..., 0, 0, 0],\n", |
| 43 | + " [ 0, 44, 59, ..., 0, 0, 0],\n", |
| 44 | + " [ 0, 0, 47, ..., 0, 0, 0],\n", |
| 45 | + " ...,\n", |
| 46 | + " [ 0, 0, 0, ..., 1, 1, 0],\n", |
| 47 | + " [ 0, 0, 0, ..., 0, 1, 1],\n", |
| 48 | + " [ 0, 0, 0, ..., 0, 0, 1]]), 'x': array([0.39189189, 0.59529357, 0.01281454]), 'fun': 3140.5705570938244, 'trans_count': array([1682, 2555, 55])} fun: 163.58583992399042\n", |
| 49 | + " hess_inv: <2x2 LbfgsInvHessProduct with dtype=float64>\n", |
| 50 | + " jac: array([-2.84217094e-05, 1.16529009e-04])\n", |
| 51 | + " message: b'CONVERGENCE: REL_REDUCTION_OF_F_<=_FACTR*EPSMCH'\n", |
| 52 | + " nfev: 42\n", |
| 53 | + " nit: 12\n", |
| 54 | + " status: 0\n", |
| 55 | + " success: True\n", |
| 56 | + " x: array([10.07780762, 2.29417622])\n" |
| 57 | + ] |
| 58 | + } |
| 59 | + ], |
| 60 | + "source": [ |
| 61 | + "result_transitions, result_fixp = estimate(init_dict[\"replication\"], data, repl_4=True)\n", |
| 62 | + "print(result_transitions, result_fixp)" |
| 63 | + ] |
| 64 | + }, |
| 65 | + { |
| 66 | + "cell_type": "code", |
| 67 | + "execution_count": null, |
| 68 | + "metadata": {}, |
| 69 | + "outputs": [], |
| 70 | + "source": [] |
| 71 | + } |
| 72 | + ], |
| 73 | + "metadata": { |
| 74 | + "kernelspec": { |
| 75 | + "display_name": "Python 3", |
| 76 | + "language": "python", |
| 77 | + "name": "python3" |
| 78 | + }, |
| 79 | + "language_info": { |
| 80 | + "codemirror_mode": { |
| 81 | + "name": "ipython", |
| 82 | + "version": 3 |
| 83 | + }, |
| 84 | + "file_extension": ".py", |
| 85 | + "mimetype": "text/x-python", |
| 86 | + "name": "python", |
| 87 | + "nbconvert_exporter": "python", |
| 88 | + "pygments_lexer": "ipython3", |
| 89 | + "version": "3.7.0" |
| 90 | + } |
| 91 | + }, |
| 92 | + "nbformat": 4, |
| 93 | + "nbformat_minor": 2 |
| 94 | +} |
0 commit comments