Skip to content

Commit 671ee28

Browse files
committed
[DOC] Update the index page
1 parent 67435c1 commit 671ee28

2 files changed

Lines changed: 42 additions & 13 deletions

File tree

README.rst

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,24 @@ Minimal example on how to use
6565

6666
.. code:: python
6767
68-
from torchensemble import ensemble_method # import ensemble method (e.g., VotingClassifier)
68+
from torchensemble import ensemble_method # import ensemble (e.g., VotingClassifier)
6969
70-
# Define the ensemble
71-
model = ensemble_method(estimator=base_estimator, # class of your base estimator
72-
n_estimators=10, # the number of base estimators
73-
cuda=True) # whether to use GPU
74-
75-
# Load data
70+
# Load the data
7671
train_loader = DataLoader(...)
7772
test_loader = DataLoader(...)
7873
74+
# Define the ensemble
75+
model = ensemble_method(estimator=base_estimator, # your deep learning model
76+
n_estimators=10) # number of base estimators
77+
7978
# Set the optimizer
80-
model.set_optimizer("Adam", # type of the parameter optimizer
81-
lr=learning_rate, # learning rate of the parameter optimizer
82-
weight_decay=weight_decay) # weight decay of the parameter optimizer
79+
model.set_optimizer("Adam",
80+
lr=learning_rate,
81+
weight_decay=weight_decay)
8382
8483
# Train
85-
model.fit(train_loader, # training data
86-
epochs=epochs) # the number of training epochs
84+
model.fit(train_loader,
85+
epochs=epochs)
8786
8887
# Evaluate
8988
accuracy = model.predict(test_loader)

docs/index.rst

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,38 @@ To get started, please refer to `Quick Start <./quick_start.html>`__. To learn m
3232

3333
This package is under active development. Please feel free to open an `issue <https://github.com/AaronX121/Ensemble-Pytorch/issues>`__ if your have any problem. In addition, any feature request or `pull request <https://github.com/AaronX121/Ensemble-Pytorch/pulls>`__ would be highly welcomed.
3434

35+
Example on How to Use
36+
---------------------
37+
38+
.. code:: python
39+
40+
from torchensemble import ensemble_method # import ensemble (e.g., VotingClassifier)
41+
42+
# Load the data
43+
train_loader = DataLoader(...)
44+
test_loader = DataLoader(...)
45+
46+
# Define the ensemble
47+
model = ensemble_method(estimator=base_estimator, # your deep learning model
48+
n_estimators=10) # number of base estimators
49+
50+
# Set the optimizer
51+
model.set_optimizer("Adam",
52+
lr=learning_rate,
53+
weight_decay=weight_decay)
54+
55+
# Train
56+
model.fit(train_loader,
57+
epochs=epochs)
58+
59+
# Evaluate
60+
accuracy = model.predict(test_loader)
61+
62+
Contents
63+
--------
64+
3565
.. toctree::
36-
:maxdepth: 1
66+
:maxdepth: 2
3767

3868
Quick Start <quick_start>
3969
Introduction <introduction>

0 commit comments

Comments
 (0)