Update README.md
Browse files
README.md
CHANGED
|
@@ -233,6 +233,86 @@ The benchmark supports research into:
|
|
| 233 |
|
| 234 |
---
|
| 235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
# License
|
| 237 |
|
| 238 |
MIT
|
|
|
|
| 233 |
|
| 234 |
---
|
| 235 |
|
| 236 |
+
Quick Start
|
| 237 |
+
# Quick Start
|
| 238 |
+
|
| 239 |
+
This example demonstrates how to evaluate a simple model on one Clarus dataset.
|
| 240 |
+
|
| 241 |
+
---
|
| 242 |
+
|
| 243 |
+
## 1 Install dependencies
|
| 244 |
+
|
| 245 |
+
Example environment:
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
pip install pandas scikit-learn
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
---
|
| 252 |
+
|
| 253 |
+
## 2 Load the dataset
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
train = data/train.csv
|
| 257 |
+
test = data/test.csv
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
---
|
| 261 |
+
|
| 262 |
+
## 3 Train a simple baseline model
|
| 263 |
+
|
| 264 |
+
Example using logistic regression:
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
import pandas as pd
|
| 268 |
+
from sklearn.linear_model import LogisticRegression
|
| 269 |
+
|
| 270 |
+
train = pd.read_csv("data/train.csv")
|
| 271 |
+
|
| 272 |
+
X = train.drop(columns=["scenario_id","label"])
|
| 273 |
+
y = train["label"]
|
| 274 |
+
|
| 275 |
+
model = LogisticRegression()
|
| 276 |
+
model.fit(X, y)
|
| 277 |
+
|
| 278 |
+
|
| 279 |
+
---
|
| 280 |
+
|
| 281 |
+
## 4 Generate predictions
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
test = pd.read_csv("data/test.csv")
|
| 285 |
+
|
| 286 |
+
X_test = test.drop(columns=["scenario_id","label"])
|
| 287 |
+
|
| 288 |
+
pred = model.predict(X_test)
|
| 289 |
+
|
| 290 |
+
out = pd.DataFrame({
|
| 291 |
+
"scenario_id": test["scenario_id"],
|
| 292 |
+
"prediction": pred
|
| 293 |
+
})
|
| 294 |
+
|
| 295 |
+
out.to_csv("predictions.csv", index=False)
|
| 296 |
+
|
| 297 |
+
|
| 298 |
+
---
|
| 299 |
+
|
| 300 |
+
## 5 Evaluate predictions
|
| 301 |
+
|
| 302 |
+
Run the official scorer:
|
| 303 |
+
|
| 304 |
+
|
| 305 |
+
python scorer.py --predictions predictions.csv --truth data/test.csv
|
| 306 |
+
|
| 307 |
+
|
| 308 |
+
The scorer returns:
|
| 309 |
+
|
| 310 |
+
- accuracy
|
| 311 |
+
- precision
|
| 312 |
+
- recall
|
| 313 |
+
- f1
|
| 314 |
+
- confusion matrix
|
| 315 |
+
|
| 316 |
# License
|
| 317 |
|
| 318 |
MIT
|