Skip to content

Commit

Permalink
Se agregaron parametros al modelo
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaCanM committed Oct 14, 2024
1 parent cb1acc4 commit adddd46
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions notebooks/BoneMarrow_EDA.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,84 @@
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "a78103c8",
"metadata": {},
"source": [
"## Fase 2"
]
},
{
"cell_type": "markdown",
"id": "7e303b3e",
"metadata": {},
"source": [
"## Seguimiento de Experimentos"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "24946793",
"metadata": {},
"outputs": [],
"source": [
"model = RandomForestClassifier(n_estimators=90, max_depth=7, max_features=3)\n",
"model.fit(X_train, y_train)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d40ab43c",
"metadata": {},
"outputs": [],
"source": [
"y_pred = model.predict(X_test)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b5ee6301",
"metadata": {},
"outputs": [],
"source": [
"# Confusion matrix\n",
"cm = confusion_matrix(y_test, y_pred)\n",
"plt.figure(figsize=(10,7))\n",
"sns.heatmap(cm, annot=True, fmt='d', cmap='Blues', xticklabels=np.unique(y), yticklabels=np.unique(y))\n",
"plt.xlabel('Predicted')\n",
"plt.ylabel('True')\n",
"plt.title('Confusion Matrix')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6fa64ab0",
"metadata": {},
"outputs": [],
"source": [
"# Report\n",
"report = classification_report(y_test, y_pred, output_dict=True)\n",
"report_df = pd.DataFrame(report).transpose()\n",
"print(report_df)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "007141ab",
"metadata": {},
"outputs": [],
"source": [
"scores = cross_val_score(model, X, y, cv=5)\n",
"print(\"Average accuracy with CV:\", np.mean(scores))"
]
}
],
"metadata": {
Expand Down

0 comments on commit adddd46

Please sign in to comment.