sample removal + seek connect first

This commit is contained in:
2023-06-10 18:59:38 +08:00
parent 813a3cf2ff
commit 0e40f90559
12 changed files with 142 additions and 58 deletions

View File

@@ -168,6 +168,55 @@
"list_dct = result.loc[result['count']>=9, 'dct_lst_init_remove_firm_prod'].to_list()\n",
"print(len(list_dct))"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"ename": "ValueError",
"evalue": "probabilities do not sum to 1",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[2], line 3\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39mnumpy\u001b[39;00m \u001b[39mas\u001b[39;00m \u001b[39mnp\u001b[39;00m\n\u001b[1;32m----> 3\u001b[0m np\u001b[39m.\u001b[39;49mrandom\u001b[39m.\u001b[39;49mchoice([\u001b[39m1\u001b[39;49m], p\u001b[39m=\u001b[39;49m[\u001b[39m0.9\u001b[39;49m])\n",
"File \u001b[1;32mmtrand.pyx:933\u001b[0m, in \u001b[0;36mnumpy.random.mtrand.RandomState.choice\u001b[1;34m()\u001b[0m\n",
"\u001b[1;31mValueError\u001b[0m: probabilities do not sum to 1"
]
}
],
"source": [
"import numpy as np\n",
"\n",
"np.random.choice([1], p=[0.9])"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.004495606232695251"
]
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"prob_remove = 0\n",
"prob_remove = np.random.uniform(\n",
" prob_remove - 0.1, prob_remove + 0.1)\n",
"prob_remove = 1 if prob_remove > 1 else prob_remove\n",
"prob_remove = 0 if prob_remove < 0 else prob_remove\n",
"prob_remove"
]
}
],
"metadata": {