Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modify forest depth #304

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
19 changes: 19 additions & 0 deletions .github/workflows/cml.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CML
on: [push]
jobs:
train-and-report:
runs-on: ubuntu-latest
container: docker://ghcr.io/iterative/cml:0-dvc2-base1
steps:
- uses: actions/checkout@v3
- name: Train model
env:
REPO_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
pip install -r requirements.txt
python train.py # generate plot.png

# Create CML report
cat metrics.txt >> report.md
echo '![](./plot confusion matrix.png "Confusion Matrix")' >> report.md
cml comment create report.md
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# environment
cml-env/
334 changes: 167 additions & 167 deletions data/test_features.csv

Large diffs are not rendered by default.

996 changes: 498 additions & 498 deletions data/train_features.csv

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion get_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
np.savetxt("data/train_features.csv", X_train)
np.savetxt("data/test_features.csv", X_test)
np.savetxt("data/train_labels.csv", y_train)
np.savetxt("data/test_labels.csv", y_test)
np.savetxt("data/test_labels.csv", y_test)
1 change: 1 addition & 0 deletions metrics.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Accuracy: 0.864
Binary file added plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
y_test = np.genfromtxt("data/test_labels.csv")

# Fit a model
depth = 2
depth = 6
clf = RandomForestClassifier(max_depth=depth)
clf.fit(X_train, y_train)

Expand All @@ -25,4 +25,4 @@
disp = ConfusionMatrixDisplay.from_estimator(
clf, X_test, y_test, normalize="true", cmap=plt.cm.Blues
)
plt.savefig("plot.png")
plt.savefig("plot confusion matrix.png")