-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from jpmml_evaluator.cli import main | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import sys | ||
|
||
from argparse import ArgumentParser | ||
|
||
import pandas | ||
|
||
from jpmml_evaluator import make_evaluator | ||
|
||
def main(): | ||
parser = ArgumentParser(description = "JPMML-Evaluator command-line application") | ||
parser.add_argument("model", type = str, help = "Model PMML file") | ||
parser.add_argument("-i", "--input", type = str, help = "Input CSV file") | ||
parser.add_argument("-o", "--output", type = str, help = "Output CSV file") | ||
parser.add_argument("--sep", type = str, default = ",", help = "CSV separator character") | ||
|
||
args = parser.parse_args() | ||
|
||
evaluator = make_evaluator(args.model) | ||
evaluator.verify() | ||
|
||
if args.input: | ||
input = args.input | ||
else: | ||
input = sys.stdin | ||
|
||
if args.output: | ||
output = args.output | ||
else: | ||
output = sys.stdout | ||
|
||
arguments = pandas.read_csv(input, sep = args.sep) | ||
results = evaluator.evaluateAll(arguments) | ||
results.to_csv(output, sep = args.sep, header = True, index = False) |