Random Forest - Car - Jupyter Notebook
Random Forest - Car - Jupyter Notebook
In [7]: df = pd.read_csv("C:\\Users\\Welcome\\Downloads\\car_evaluation.csv")
In [8]: df.shape
Out[8]: (1727, 7)
In [9]: df.head()
Out[9]:
vhigh vhigh.1 2 2.1 small low unacc
In [11]: df.head()
Out[11]:
buying maint doors persons lug_boot safety class
## Package Plan ##
package | build
---------------------------|-----------------
category_encoders-2.2.2 | pyhd3eb1b0_0 58 KB
conda-4.14.0 | py37h03978a9_0 1018 KB conda-forge
python_abi-3.7 | 2_cp37m 4 KB conda-forge
------------------------------------------------------------
Total: 1.1 MB
category_encoders pkgs/main/noarch::category_encoders-2.2.2-pyhd3eb1b0_0
python_abi conda-forge/win-64::python_abi-3.7-2_cp37m
python_abi-3.7 | 4 KB | | 0%
python_abi-3.7 | 4 KB | ########## | 100%
conda-4.14.0 | 1018 KB | | 0%
conda-4.14.0 | 1018 KB | 1 | 2%
conda-4.14.0 | 1018 KB | ##9 | 30%
conda-4.14.0 | 1018 KB | ######2 | 63%
conda-4.14.0 | 1018 KB | #########7 | 97%
conda-4.14.0 | 1018 KB | ########## | 100%
category_encoders-2. | 58 KB | | 0%
category_encoders-2. | 58 KB | ##7 | 27%
category_encoders-2. | 58 KB | ########## | 100%
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Note: you may need to restart the kernel to use updated packages.
In [22]: X_train.head()
Out[22]:
buying maint doors persons lug_boot safety
83 1 1 1 1 1 1
48 1 1 2 2 1 2
468 2 1 2 3 2 2
155 1 2 2 2 1 1
1043 3 2 3 2 2 1
In [23]: X_test.head()
Out[23]:
buying maint doors persons lug_boot safety
599 2 2 3 1 3 1
932 3 1 3 3 3 1
628 2 2 1 1 3 3
1497 4 2 1 3 1 2
1262 3 4 3 2 1 1
Out[26]: RandomForestClassifier(random_state=0)
In [ ]: