Trashmaster/Untitled.ipynb

127 lines
2.4 KiB
Plaintext
Raw Normal View History

{
"cells": [
{
"cell_type": "code",
"execution_count": 24,
"id": "fac14368",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1]\n"
]
}
],
"source": [
"from sklearn.tree import DecisionTreeClassifier, export_text, plot_tree\n",
"dataset = pandas.read_csv('/Users/mac/Desktop/tree_dataset.csv', sep=\";\")\n",
"decisions = [\"decision\"]\n",
"attributes = [\"season\", \"trash_type\", \"mass\", \"space\", \"trash_mass\"]\n",
"\n",
"x = dataset[attributes]\n",
"y = dataset[decisions]\n",
"decision_tree = DecisionTreeClassifier()\n",
"decision_tree.fit(x.values, y.values)\n",
"decision = decision_tree.predict(\n",
" [[5, 3 , 3, 1, 2]])\n",
"print(decision)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "04bbec40",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "9c1d0193",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "8e40a924",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "b430f8b8",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "58ce5faa",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "a4b72d3d",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "b4e0aae9",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "74fb263f",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "5dbe234e",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "env",
"language": "python",
"name": "env"
},
"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.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}