From 3b16498740bda0b86abe2bf018ce0d2373687132 Mon Sep 17 00:00:00 2001 From: TheColdIce Date: Thu, 9 Nov 2023 16:08:37 +0000 Subject: [PATCH] fixed so txs are (more) uniformly distributed over steps --- AMLsim/src/main/java/amlsim/AccountGroup.java | 29 +- .../TransactionNetwork.py | 1 + .../TransactionNetwork.cpython-310.pyc | Bin 12768 -> 12805 bytes transaction-network-explorer/test.ipynb | 110 +++++++ transaction-network-explorer/tne-cpu.ipynb | 286 +++++++++++++++++- 5 files changed, 415 insertions(+), 11 deletions(-) create mode 100644 transaction-network-explorer/test.ipynb diff --git a/AMLsim/src/main/java/amlsim/AccountGroup.java b/AMLsim/src/main/java/amlsim/AccountGroup.java index 40cd564b..09fabff2 100644 --- a/AMLsim/src/main/java/amlsim/AccountGroup.java +++ b/AMLsim/src/main/java/amlsim/AccountGroup.java @@ -22,17 +22,28 @@ public class AccountGroup { assert startStep < endStep : "startStep must be smaller than endStep"; assert interval > 0 : "interval must be positive"; - if (startStep >= 0 && startStep < AMLSim.getNumOfSteps()) { - int range = (int) (endStep - startStep + 1); - this.startStep = AMLSim.getRandom().nextInt(range) + startStep; - } else { - this.startStep = AMLSim.getRandom().nextInt((int) AMLSim.getNumOfSteps() - 1); + //if (startStep >= 0 && startStep < AMLSim.getNumOfSteps()) { + // int range = (int) (endStep - startStep + 1); + // this.startStep = AMLSim.getRandom().nextInt(range) + startStep; + //} else { + // this.startStep = AMLSim.getRandom().nextInt((int) AMLSim.getNumOfSteps() - 1); + //} + // + //if (endStep >= 0 && endStep < AMLSim.getNumOfSteps()) { + // this.endStep = endStep; + //} else { + // this.endStep = AMLSim.getNumOfSteps(); + //} + + long s1 = startStep + AMLSim.getRandom().nextInt((int) (endStep - startStep + 1)); + long s2 = startStep + AMLSim.getRandom().nextInt((int) (endStep - startStep + 1)); + this.startStep = Math.min(s1, s2); + this.endStep = Math.max(s1, s2); + if (this.startStep < startStep) { + this.startStep = startStep; } - - if (endStep >= 0 && endStep < AMLSim.getNumOfSteps()) { + if (this.endStep > endStep) { this.endStep = endStep; - } else { - this.endStep = AMLSim.getNumOfSteps(); } this.scheduleID = scheduleID; diff --git a/transaction-network-explorer/TransactionNetwork.py b/transaction-network-explorer/TransactionNetwork.py index 208353f7..754dd01f 100644 --- a/transaction-network-explorer/TransactionNetwork.py +++ b/transaction-network-explorer/TransactionNetwork.py @@ -31,6 +31,7 @@ def __init__(self, path:str) -> None: def load_data(self, path:str) -> pd.DataFrame: df = pd.read_csv(path) + df = df.loc[df['type']!='CASH'] return df def format_data(self, df:pd.DataFrame) -> pd.DataFrame: diff --git a/transaction-network-explorer/__pycache__/TransactionNetwork.cpython-310.pyc b/transaction-network-explorer/__pycache__/TransactionNetwork.cpython-310.pyc index 2484a3fccfa8aa008084a19bfbd8f4fb6ab96ca9..d53ec6c34593f1f57e3183ca40759f8c594cade9 100644 GIT binary patch delta 2523 zcmbW3du&rx9LIawwXEIhx(D03GWP7oo!i(bfdGn*;Y4v$Hb``c&#AM59KHBnXbG{G$S5qT(Bkn5z;JiSaKrUevfm0 zzu$T7bZ}e99do-~7W%8$y<9sn=HBU8R!Kd>@*>;BUSgZAo2-NM3o)-HWLY_6%HzM!5oZIM_|9C0*EbI@QeR**XDD6={iQitCx z@|?b!8_;Yg>}C8W`Y734YNh;UsT7^gd&({qLel}PIQxd;~p zI)^V>kw+8S4*;7lO8L02G~5EY8^{J2Fb&A${cBOcdoT4(yBdjyRnx|`kmAhbDdtW; zS}I4zpk}VFMYN#NHxvtLx{-1h|64dAGO}mMG-ZJ*I_{bYz52gO{7BFYJPGljr7L_%Pr_M*Xu8)=UpeHCuGxO=FN_{7-E@L+k73YCN1u{WJ486K5*(>u-Tq8-PndvB^(5R;dE$mTqZNZ%*)+LA%KyZz1V zW0}?8{sMMJc=g6IM4mtcbOymdT z$(W)>nc4E1@>zANs;TE1ucL*G=D;P2>u8$zxjFEEucJlM6CqA@9jze+t@_0M^9d|J z1HJ&h15N_p6U?k&ETSv&Sj@2S$02_Ncno+H$UGfmv)4_2sxr4wctAJwd17`;2c6nv z%c4;{)~0i*YN#DtjndL$h-v`;D46zjk(g@mMhNis@+Sd22mE>91z_2jXMrl>*k7HGV4t?%8s(_mQl-wEQNI|7SoalnR#4O zLxG^4ri<1FdycTQvmCaqf)2WhjHWpjOV=Ylz$W7hEfZrVF@-{;(+(W_BbVH1oNpYstWHETnBUtz3(# zQH?LB2KzJ2V;r+LS=f3yUyx!w)Z}%Iy`CtTK)`p0F(RVZM6>!s1W^Yrxn7e z8SQPr=(KdkTpDgCR#7%*Iygs32YZaxl$5bP>MuDnUyj23W`V9nv|ut2i-$B_H~f@mHW%~pkvGU?}j!rj3&w#FrvT8JJ?QR z(E``3&?{$R;v*Pwqln&za(h-5C5kKQ=)#WXtGVD$-E7=3IZkAv+9kK_u;@>_xR)lX zDxK2NLokymAEiJ=DSOvQS9IKtpC8Nhq@Sf!Sk-x}ex924v#e%n#~|1NSOrAM%pAL2 zG+tHY+6|oyCqI*M8BV(lXFqi9z^uT~&1`ro5mJ*{Ak5Xo&`HBneU`02?J3!ry3B*+ zIsi2w%U7s6(VkI3FG_;E?gV?4UUAp&=z)P3kUq$CUt1hPYv${5o(!bbNJ`Ur91?3V z71dKwK8(SwkmRmQ@w8^zxtnS9bh2SsbMxHmL!2jQ|He1?0tvM9Bp4&(K0<#+RMdvyz#me3(RT<~W^dTHGbqE4c1@a;aUguLHcmbrK_1 zb~k&N+we7SxSeZhB@^>zuFq21*H%D|)|OknnmXlJJSKhoap9lX)0w;I8#w$O@ICM= zFbVu7VCIN_2XtlXxIYi^Uf?<4Szzjcm~7oN`$3wzpO9O98TGdLM2Q}5yEBSc*0go0 zN!7>k>@UI;H9#*kxtk(!HOZSG*a92?a7FSXz-zz quALi8MH3@DB!-)|p?D;o9@e(#@(>T$#ht3^LuyFl{AD`VzVct#{xI7B diff --git a/transaction-network-explorer/test.ipynb b/transaction-network-explorer/test.ipynb new file mode 100644 index 00000000..0a823bb9 --- /dev/null +++ b/transaction-network-explorer/test.ipynb @@ -0,0 +1,110 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
stepacctamtbal
00a1010
51a-100
15a1010
\n", + "
" + ], + "text/plain": [ + " step acct amt bal\n", + "0 0 a 10 10\n", + "5 1 a -10 0\n", + "1 5 a 10 10" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import pandas as pd\n", + "\n", + "steps = [0, 5, 2, 3, 4, 1]\n", + "accts = ['a', 'a', 'b', 'b', 'b', 'a']\n", + "amts = [10, 10, 10, -10, 10, -10]\n", + "df = pd.DataFrame({'step': steps, 'acct': accts, 'amt': amts})\n", + "\n", + "df = df.sort_values(by=['step'])\n", + "df['bal'] = df.groupby('acct')['amt'].cumsum()\n", + "\n", + "df[df['acct']=='a']\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "tne-cpu", + "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.10.13" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/transaction-network-explorer/tne-cpu.ipynb b/transaction-network-explorer/tne-cpu.ipynb index f5799c16..96971f65 100644 --- a/transaction-network-explorer/tne-cpu.ipynb +++ b/transaction-network-explorer/tne-cpu.ipynb @@ -206,17 +206,299 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "395fdd50943a4023b3cb4504166e51bc", + "model_id": "c8dbebab5e10466e9259651d83b25c69", "version_major": 2, "version_minor": 0 }, "text/plain": [ - "BokehModel(combine_events=True, render_bundle={'docs_json': {'f1c9b433-d9fa-487b-88fb-bc3ac4fa12cd': {'version…" + "BokehModel(combine_events=True, render_bundle={'docs_json': {'ffa1a2c9-a0f7-43ba-a202-27417612dc8c': {'version…" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "WARNING:param.TransactionNetwork.update_hists: Callable raised \"ValueError('Cannot cut empty array')\".\n", + "Invoked as TransactionNetwork.update_hists(legitimate_models=[], steps=(1, 367), banks=['nordea', 'svea', 'sparbanken', 'ålandsbanken', 'länsförsäkringar', 'handelsbanken', 'ica', 'skandia', 'marginalen', 'seb', 'swedbank', 'danske'], laundering_models=[], x_range=(-9.991169155797417, 10.872495895579538), y_range=(-9.624081053184012, 11.923416311860004))\n", + "WARNING:param.dynamic_operation: Callable raised \"ValueError('Cannot cut empty array')\".\n", + "Invoked as dynamic_operation(legitimate_models=[], steps=(1, 367), banks=['nordea', 'svea', 'sparbanken', 'ålandsbanken', 'länsförsäkringar', 'handelsbanken', 'ica', 'skandia', 'marginalen', 'seb', 'swedbank', 'danske'], laundering_models=[], x_range=(-9.991169155797417, 10.872495895579538), y_range=(-9.624081053184012, 11.923416311860004))\n", + "WARNING:param.TransactionNetwork.update_hists: Callable raised \"ValueError('Cannot cut empty array')\".\n", + "Invoked as TransactionNetwork.update_hists(legitimate_models=[], steps=(1, 367), banks=['nordea', 'svea', 'sparbanken', 'ålandsbanken', 'länsförsäkringar', 'handelsbanken', 'ica', 'skandia', 'marginalen', 'seb', 'swedbank', 'danske'], laundering_models=[], x_range=(-9.991169155797417, 10.872495895579538), y_range=(-9.624081053184012, 11.923416311860004))\n", + "WARNING:param.dynamic_operation: Callable raised \"ValueError('Cannot cut empty array')\".\n", + "Invoked as dynamic_operation(legitimate_models=[], steps=(1, 367), banks=['nordea', 'svea', 'sparbanken', 'ålandsbanken', 'länsförsäkringar', 'handelsbanken', 'ica', 'skandia', 'marginalen', 'seb', 'swedbank', 'danske'], laundering_models=[], x_range=(-9.991169155797417, 10.872495895579538), y_range=(-9.624081053184012, 11.923416311860004))\n", + "WARNING:param.TransactionNetwork.update_hists: Callable raised \"ValueError('Cannot cut empty array')\".\n", + "Invoked as TransactionNetwork.update_hists(legitimate_models=[], steps=(1, 367), banks=['nordea', 'svea', 'sparbanken', 'ålandsbanken', 'länsförsäkringar', 'handelsbanken', 'ica', 'skandia', 'marginalen', 'seb', 'swedbank', 'danske'], laundering_models=[], x_range=(-9.991169155797417, 10.872495895579538), y_range=(-9.624081053184012, 11.923416311860004))\n", + "WARNING:param.dynamic_operation: Callable raised \"ValueError('Cannot cut empty array')\".\n", + "Invoked as dynamic_operation(legitimate_models=[], steps=(1, 367), banks=['nordea', 'svea', 'sparbanken', 'ålandsbanken', 'länsförsäkringar', 'handelsbanken', 'ica', 'skandia', 'marginalen', 'seb', 'swedbank', 'danske'], laundering_models=[], x_range=(-9.991169155797417, 10.872495895579538), y_range=(-9.624081053184012, 11.923416311860004))\n", + "WARNING:param.TransactionNetwork.update_hists: Callable raised \"ValueError('Cannot cut empty array')\".\n", + "Invoked as TransactionNetwork.update_hists(legitimate_models=[], steps=(1, 367), banks=['nordea', 'svea', 'sparbanken', 'ålandsbanken', 'länsförsäkringar', 'handelsbanken', 'ica', 'skandia', 'marginalen', 'seb', 'swedbank', 'danske'], laundering_models=[], x_range=(-9.991169155797417, 10.872495895579538), y_range=(-9.624081053184012, 11.923416311860004))\n", + "WARNING:param.dynamic_operation: Callable raised \"ValueError('Cannot cut empty array')\".\n", + "Invoked as dynamic_operation(legitimate_models=[], steps=(1, 367), banks=['nordea', 'svea', 'sparbanken', 'ålandsbanken', 'länsförsäkringar', 'handelsbanken', 'ica', 'skandia', 'marginalen', 'seb', 'swedbank', 'danske'], laundering_models=[], x_range=(-9.991169155797417, 10.872495895579538), y_range=(-9.624081053184012, 11.923416311860004))\n", + "WARNING:param.TransactionNetwork.update_hists: Callable raised \"ValueError('Cannot cut empty array')\".\n", + "Invoked as TransactionNetwork.update_hists(legitimate_models=[], steps=(1, 367), banks=['nordea', 'svea', 'sparbanken', 'ålandsbanken', 'länsförsäkringar', 'handelsbanken', 'ica', 'skandia', 'marginalen', 'seb', 'swedbank', 'danske'], laundering_models=[], x_range=(-9.991169155797417, 10.872495895579538), y_range=(-9.624081053184012, 11.923416311860004))\n", + "WARNING:param.dynamic_operation: Callable raised \"ValueError('Cannot cut empty array')\".\n", + "Invoked as dynamic_operation(legitimate_models=[], steps=(1, 367), banks=['nordea', 'svea', 'sparbanken', 'ålandsbanken', 'länsförsäkringar', 'handelsbanken', 'ica', 'skandia', 'marginalen', 'seb', 'swedbank', 'danske'], laundering_models=[], x_range=(-9.991169155797417, 10.872495895579538), y_range=(-9.624081053184012, 11.923416311860004))\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Traceback (most recent call last):\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/plotting/util.py\", line 293, in get_plot_frame\n", + " return map_obj[key]\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1216, in __getitem__\n", + " val = self._execute_callback(*tuple_key)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 983, in _execute_callback\n", + " retval = self.callback(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 551, in __call__\n", + " if not args and not kwargs and not any(kwarg_hash): return self.callable()\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1454, in collation_cb\n", + " layout = self[args]\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1216, in __getitem__\n", + " val = self._execute_callback(*tuple_key)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 983, in _execute_callback\n", + " retval = self.callback(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 581, in __call__\n", + " ret = self.callable(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/util/__init__.py\", line 1033, in dynamic_operation\n", + " key, obj = resolve(key, kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/util/__init__.py\", line 1022, in resolve\n", + " return key, map_obj[key]\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1216, in __getitem__\n", + " val = self._execute_callback(*tuple_key)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 983, in _execute_callback\n", + " retval = self.callback(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 581, in __call__\n", + " ret = self.callable(*args, **kwargs)\n", + " File \"/home/edvin/Desktop/flib/transaction-network-explorer/TransactionNetwork.py\", line 318, in update_hists\n", + " amount_hist = self.get_amount_hist(df)\n", + " File \"/home/edvin/Desktop/flib/transaction-network-explorer/TransactionNetwork.py\", line 216, in get_amount_hist\n", + " vc = df['amount'].value_counts(bins=bins)\n", + " File \"/home/edvin/.local/lib/python3.10/site-packages/pandas/core/base.py\", line 1010, in value_counts\n", + " return algorithms.value_counts_internal(\n", + " File \"/home/edvin/.local/lib/python3.10/site-packages/pandas/core/algorithms.py\", line 885, in value_counts_internal\n", + " ii = cut(values, bins, include_lowest=True)\n", + " File \"/home/edvin/.local/lib/python3.10/site-packages/pandas/core/reshape/tile.py\", line 256, in cut\n", + " raise ValueError(\"Cannot cut empty array\")\n", + "ValueError: Cannot cut empty array\n", + "\n", + "Traceback (most recent call last):\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/plotting/util.py\", line 293, in get_plot_frame\n", + " return map_obj[key]\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1216, in __getitem__\n", + " val = self._execute_callback(*tuple_key)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 983, in _execute_callback\n", + " retval = self.callback(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 551, in __call__\n", + " if not args and not kwargs and not any(kwarg_hash): return self.callable()\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1454, in collation_cb\n", + " layout = self[args]\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1216, in __getitem__\n", + " val = self._execute_callback(*tuple_key)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 983, in _execute_callback\n", + " retval = self.callback(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 581, in __call__\n", + " ret = self.callable(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/util/__init__.py\", line 1033, in dynamic_operation\n", + " key, obj = resolve(key, kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/util/__init__.py\", line 1022, in resolve\n", + " return key, map_obj[key]\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1216, in __getitem__\n", + " val = self._execute_callback(*tuple_key)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 983, in _execute_callback\n", + " retval = self.callback(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 581, in __call__\n", + " ret = self.callable(*args, **kwargs)\n", + " File \"/home/edvin/Desktop/flib/transaction-network-explorer/TransactionNetwork.py\", line 318, in update_hists\n", + " amount_hist = self.get_amount_hist(df)\n", + " File \"/home/edvin/Desktop/flib/transaction-network-explorer/TransactionNetwork.py\", line 216, in get_amount_hist\n", + " vc = df['amount'].value_counts(bins=bins)\n", + " File \"/home/edvin/.local/lib/python3.10/site-packages/pandas/core/base.py\", line 1010, in value_counts\n", + " return algorithms.value_counts_internal(\n", + " File \"/home/edvin/.local/lib/python3.10/site-packages/pandas/core/algorithms.py\", line 885, in value_counts_internal\n", + " ii = cut(values, bins, include_lowest=True)\n", + " File \"/home/edvin/.local/lib/python3.10/site-packages/pandas/core/reshape/tile.py\", line 256, in cut\n", + " raise ValueError(\"Cannot cut empty array\")\n", + "ValueError: Cannot cut empty array\n", + "\n", + "Traceback (most recent call last):\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/plotting/util.py\", line 293, in get_plot_frame\n", + " return map_obj[key]\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1216, in __getitem__\n", + " val = self._execute_callback(*tuple_key)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 983, in _execute_callback\n", + " retval = self.callback(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 551, in __call__\n", + " if not args and not kwargs and not any(kwarg_hash): return self.callable()\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1454, in collation_cb\n", + " layout = self[args]\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1216, in __getitem__\n", + " val = self._execute_callback(*tuple_key)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 983, in _execute_callback\n", + " retval = self.callback(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 581, in __call__\n", + " ret = self.callable(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/util/__init__.py\", line 1033, in dynamic_operation\n", + " key, obj = resolve(key, kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/util/__init__.py\", line 1022, in resolve\n", + " return key, map_obj[key]\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1216, in __getitem__\n", + " val = self._execute_callback(*tuple_key)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 983, in _execute_callback\n", + " retval = self.callback(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 581, in __call__\n", + " ret = self.callable(*args, **kwargs)\n", + " File \"/home/edvin/Desktop/flib/transaction-network-explorer/TransactionNetwork.py\", line 318, in update_hists\n", + " amount_hist = self.get_amount_hist(df)\n", + " File \"/home/edvin/Desktop/flib/transaction-network-explorer/TransactionNetwork.py\", line 216, in get_amount_hist\n", + " vc = df['amount'].value_counts(bins=bins)\n", + " File \"/home/edvin/.local/lib/python3.10/site-packages/pandas/core/base.py\", line 1010, in value_counts\n", + " return algorithms.value_counts_internal(\n", + " File \"/home/edvin/.local/lib/python3.10/site-packages/pandas/core/algorithms.py\", line 885, in value_counts_internal\n", + " ii = cut(values, bins, include_lowest=True)\n", + " File \"/home/edvin/.local/lib/python3.10/site-packages/pandas/core/reshape/tile.py\", line 256, in cut\n", + " raise ValueError(\"Cannot cut empty array\")\n", + "ValueError: Cannot cut empty array\n", + "\n", + "Traceback (most recent call last):\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/plotting/util.py\", line 293, in get_plot_frame\n", + " return map_obj[key]\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1216, in __getitem__\n", + " val = self._execute_callback(*tuple_key)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 983, in _execute_callback\n", + " retval = self.callback(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 551, in __call__\n", + " if not args and not kwargs and not any(kwarg_hash): return self.callable()\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1454, in collation_cb\n", + " layout = self[args]\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1216, in __getitem__\n", + " val = self._execute_callback(*tuple_key)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 983, in _execute_callback\n", + " retval = self.callback(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 581, in __call__\n", + " ret = self.callable(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/util/__init__.py\", line 1033, in dynamic_operation\n", + " key, obj = resolve(key, kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/util/__init__.py\", line 1022, in resolve\n", + " return key, map_obj[key]\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1216, in __getitem__\n", + " val = self._execute_callback(*tuple_key)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 983, in _execute_callback\n", + " retval = self.callback(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 581, in __call__\n", + " ret = self.callable(*args, **kwargs)\n", + " File \"/home/edvin/Desktop/flib/transaction-network-explorer/TransactionNetwork.py\", line 318, in update_hists\n", + " amount_hist = self.get_amount_hist(df)\n", + " File \"/home/edvin/Desktop/flib/transaction-network-explorer/TransactionNetwork.py\", line 216, in get_amount_hist\n", + " vc = df['amount'].value_counts(bins=bins)\n", + " File \"/home/edvin/.local/lib/python3.10/site-packages/pandas/core/base.py\", line 1010, in value_counts\n", + " return algorithms.value_counts_internal(\n", + " File \"/home/edvin/.local/lib/python3.10/site-packages/pandas/core/algorithms.py\", line 885, in value_counts_internal\n", + " ii = cut(values, bins, include_lowest=True)\n", + " File \"/home/edvin/.local/lib/python3.10/site-packages/pandas/core/reshape/tile.py\", line 256, in cut\n", + " raise ValueError(\"Cannot cut empty array\")\n", + "ValueError: Cannot cut empty array\n", + "\n", + "Traceback (most recent call last):\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/plotting/util.py\", line 293, in get_plot_frame\n", + " return map_obj[key]\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1216, in __getitem__\n", + " val = self._execute_callback(*tuple_key)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 983, in _execute_callback\n", + " retval = self.callback(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 551, in __call__\n", + " if not args and not kwargs and not any(kwarg_hash): return self.callable()\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1454, in collation_cb\n", + " layout = self[args]\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1216, in __getitem__\n", + " val = self._execute_callback(*tuple_key)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 983, in _execute_callback\n", + " retval = self.callback(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 581, in __call__\n", + " ret = self.callable(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/util/__init__.py\", line 1033, in dynamic_operation\n", + " key, obj = resolve(key, kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/util/__init__.py\", line 1022, in resolve\n", + " return key, map_obj[key]\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1216, in __getitem__\n", + " val = self._execute_callback(*tuple_key)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 983, in _execute_callback\n", + " retval = self.callback(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 581, in __call__\n", + " ret = self.callable(*args, **kwargs)\n", + " File \"/home/edvin/Desktop/flib/transaction-network-explorer/TransactionNetwork.py\", line 318, in update_hists\n", + " amount_hist = self.get_amount_hist(df)\n", + " File \"/home/edvin/Desktop/flib/transaction-network-explorer/TransactionNetwork.py\", line 216, in get_amount_hist\n", + " vc = df['amount'].value_counts(bins=bins)\n", + " File \"/home/edvin/.local/lib/python3.10/site-packages/pandas/core/base.py\", line 1010, in value_counts\n", + " return algorithms.value_counts_internal(\n", + " File \"/home/edvin/.local/lib/python3.10/site-packages/pandas/core/algorithms.py\", line 885, in value_counts_internal\n", + " ii = cut(values, bins, include_lowest=True)\n", + " File \"/home/edvin/.local/lib/python3.10/site-packages/pandas/core/reshape/tile.py\", line 256, in cut\n", + " raise ValueError(\"Cannot cut empty array\")\n", + "ValueError: Cannot cut empty array\n", + "\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "WARNING:param.TransactionNetwork.update_hists: Callable raised \"ValueError('Cannot cut empty array')\".\n", + "Invoked as TransactionNetwork.update_hists(legitimate_models=[], steps=(1, 367), banks=['nordea', 'svea', 'sparbanken', 'ålandsbanken', 'länsförsäkringar', 'handelsbanken', 'ica', 'skandia', 'marginalen', 'seb', 'swedbank', 'danske'], laundering_models=[], x_range=(-9.991169155797417, 10.872495895579538), y_range=(-9.624081053184012, 11.923416311860004))\n", + "WARNING:param.dynamic_operation: Callable raised \"ValueError('Cannot cut empty array')\".\n", + "Invoked as dynamic_operation(legitimate_models=[], steps=(1, 367), banks=['nordea', 'svea', 'sparbanken', 'ålandsbanken', 'länsförsäkringar', 'handelsbanken', 'ica', 'skandia', 'marginalen', 'seb', 'swedbank', 'danske'], laundering_models=[], x_range=(-9.991169155797417, 10.872495895579538), y_range=(-9.624081053184012, 11.923416311860004))\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Traceback (most recent call last):\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/plotting/util.py\", line 293, in get_plot_frame\n", + " return map_obj[key]\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1216, in __getitem__\n", + " val = self._execute_callback(*tuple_key)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 983, in _execute_callback\n", + " retval = self.callback(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 551, in __call__\n", + " if not args and not kwargs and not any(kwarg_hash): return self.callable()\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1454, in collation_cb\n", + " layout = self[args]\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1216, in __getitem__\n", + " val = self._execute_callback(*tuple_key)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 983, in _execute_callback\n", + " retval = self.callback(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 581, in __call__\n", + " ret = self.callable(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/util/__init__.py\", line 1033, in dynamic_operation\n", + " key, obj = resolve(key, kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/util/__init__.py\", line 1022, in resolve\n", + " return key, map_obj[key]\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 1216, in __getitem__\n", + " val = self._execute_callback(*tuple_key)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 983, in _execute_callback\n", + " retval = self.callback(*args, **kwargs)\n", + " File \"/home/edvin/anaconda3/envs/tne-cpu/lib/python3.10/site-packages/holoviews/core/spaces.py\", line 581, in __call__\n", + " ret = self.callable(*args, **kwargs)\n", + " File \"/home/edvin/Desktop/flib/transaction-network-explorer/TransactionNetwork.py\", line 318, in update_hists\n", + " amount_hist = self.get_amount_hist(df)\n", + " File \"/home/edvin/Desktop/flib/transaction-network-explorer/TransactionNetwork.py\", line 216, in get_amount_hist\n", + " vc = df['amount'].value_counts(bins=bins)\n", + " File \"/home/edvin/.local/lib/python3.10/site-packages/pandas/core/base.py\", line 1010, in value_counts\n", + " return algorithms.value_counts_internal(\n", + " File \"/home/edvin/.local/lib/python3.10/site-packages/pandas/core/algorithms.py\", line 885, in value_counts_internal\n", + " ii = cut(values, bins, include_lowest=True)\n", + " File \"/home/edvin/.local/lib/python3.10/site-packages/pandas/core/reshape/tile.py\", line 256, in cut\n", + " raise ValueError(\"Cannot cut empty array\")\n", + "ValueError: Cannot cut empty array\n", + "\n" + ] } ], "source": [