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 2484a3fc..d53ec6c3 100644 Binary files a/transaction-network-explorer/__pycache__/TransactionNetwork.cpython-310.pyc and b/transaction-network-explorer/__pycache__/TransactionNetwork.cpython-310.pyc differ 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": [