From 4a3e35a9894f5f53180a711f2917303376761a4e Mon Sep 17 00:00:00 2001 From: Chris Proctor Date: Mon, 8 Jun 2026 10:22:10 -0400 Subject: [PATCH] Add CLI option --- cli/main.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cli/main.py b/cli/main.py index 907b4d9..c16648b 100644 --- a/cli/main.py +++ b/cli/main.py @@ -7,6 +7,7 @@ Usage: spam classifiers.manual.ManualClassifier -t 0.2 spam classifiers.manual.ManualClassifier -a spam classifiers.manual.ManualClassifier -a 5 + spam classifiers.manual.ManualClassifier -f 20 """ import argparse @@ -53,6 +54,13 @@ def main(): metavar="N", help="Show up to N misclassified examples (default: 10)", ) + parser.add_argument( + "-f", "--top-features", + type=int, + default=10, + metavar="N", + help="Show the top N features by weight (default: 10)", + ) args = parser.parse_args() if not args.classifier and not args.explore: @@ -79,7 +87,7 @@ def main(): y_pred = clf.predict(X_test) out.evaluation(y_test, y_pred, type(clf).__name__) - out.feature_weights(clf) + out.feature_weights(clf, top_n=args.top_features) if args.error_analysis is not None: out.error_analysis(X_test, y_test, y_pred, args.error_analysis)