"# Reshape the prediction values to 0 for valid, 1 for fraud. \n",
"y_pred[y_pred == 1] = 0\n",
"y_pred[y_pred == -1] = 1\n",
"\n",
"n_errors = (y_pred != Y_test).sum()"
]
},
{
"cell_type": "markdown",
"id": "e8dd7a8f",
"metadata": {},
"source": [
"### Model eveuation"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "60c5a8a9",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"the Model used is Isolation Forest\n",
"The accuracy is 0.65\n",
"The precision is 0.65\n",
"The recall is 1.0\n",
"The F1-Score is 0.787878787878788\n",
"The Matthews correlation coefficient is0.0\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\Mishane\\anaconda3\\lib\\site-packages\\sklearn\\metrics\\_classification.py:873: RuntimeWarning: invalid value encountered in scalar divide\n",
"C:\\Users\\Mishane\\anaconda3\\lib\\site-packages\\sklearn\\metrics\\_classification.py:1248: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",
"C:\\Users\\Mishane\\anaconda3\\lib\\site-packages\\sklearn\\metrics\\_classification.py:1248: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",
"C:\\Users\\Mishane\\anaconda3\\lib\\site-packages\\sklearn\\metrics\\_classification.py:1248: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",