Add CLI option
This commit is contained in:
10
cli/main.py
10
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)
|
||||
|
||||
Reference in New Issue
Block a user