Skip to content

Commit 3a3695d

Browse files
authored
Update README.md
1 parent a2eaa1c commit 3a3695d

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

README.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,35 +51,46 @@ If you are using AWS SageMaker of Jupyter Notebook deployed on the cloud, visit
5151
## Example Usage
5252
After successfully installing explainX, open up your Python IDE of Jupyter Notebook and simply follow the code below to use it:
5353

54-
1. Import **explainx** module.
54+
1. Import required module.
5555

5656
```python
57-
from explainx import *
57+
from explainx import *
58+
from sklearn.ensemble import RandomForestClassifier
59+
from sklearn.model_selection import train_test_split
60+
5861
```
5962

6063
2. Load and split your dataset into x_data and y_data
6164

6265
```python
63-
#x_data = Pandas DataFrame
64-
#y_data = Numpy Array or List
66+
#Load Dataset: X_Data, Y_Data
67+
#X_Data = Pandas DataFrame
68+
#Y_Data = Numpy Array or List
69+
70+
X_data,Y_data = explainx.dataset_heloc()
71+
```
72+
73+
3. Split dataset into training & testing.
6574

66-
x_data, y_data = explainx.dataset_boston()
75+
``` python
76+
X_train, X_test, Y_train, Y_test = train_test_split(X_data,Y_data, test_size=0.3, random_state=0)
6777
```
6878

69-
3. Train your model.
79+
4. Train your model.
7080

7181
```python
72-
#Train Model
73-
model = xgboost.train({"learning_rate": 0.01}, xgboost.DMatrix(x_data, label=y_data), 100)
82+
# Train a RandomForest Model
83+
model = RandomForestClassifier()
84+
model.fit(X_train, Y_train)
7485
```
7586

76-
4. Pass your model and dataset into the explainX function:
87+
5. Pass your model and dataset into the explainX function:
7788

7889
```python
79-
explainx.ai(x_data, y_data, model, model_name="xgboost")
90+
explainx.ai(X_test, Y_test, model, model_name="randomforest")
8091
```
8192

82-
5. Click on the dashboard link to start exploring model behavior:
93+
6. Click on the dashboard link to start exploring model behavior:
8394

8495
```python
8596
App running on https://0.0.0.0:8080

0 commit comments

Comments
 (0)