- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am running PROC HPBNET on regular SAS for Naive Bayes classification. Not Viya, not Enterprise Miner. If necessary, I can switch to Enterprise Miner, but I would strongly prefer not to. PROC HPBNET has run completely fine on regular SAS insofar.
I have a data set split between train and test. According to documentation, "if you use a CODE statement, score code is generated and stored in a file that can be used for scoring purposes." I assume I can grab this CODE output and use it on my test data set. I can't seem to find an example thereof, but it is alluded to in Paper SAS474-2017.
How would I go about computing my test results?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The CODE statement converts the final BNET into SAS DATA step code that can be used for scoring. The code is written to the file that is specified by filename.
It's the body of the data step that is written to the file (no data statement, no set statement and no run statement).
Here's an example :
filename abc '/srv/nfs/kubedata/compute-landingzone/SBXKOK/files/hpbnet_my_scorecode.sas';
proc hpbnet data=sashelp.Iris numbin=3 structure=Naive maxparents=1
prescreening=0 varselect=0;
target Species;
input PetalWidth PetalLength SepalLength SepalWidth/level=INT;
output network=network;
code file=abc;
run;
data work.new_data_scored;
set sashelp.iris;
%INCLUDE abc / source2;
run;
/* end of program */
Ciao,
Koen
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The CODE statement converts the final BNET into SAS DATA step code that can be used for scoring. The code is written to the file that is specified by filename.
It's the body of the data step that is written to the file (no data statement, no set statement and no run statement).
Here's an example :
filename abc '/srv/nfs/kubedata/compute-landingzone/SBXKOK/files/hpbnet_my_scorecode.sas';
proc hpbnet data=sashelp.Iris numbin=3 structure=Naive maxparents=1
prescreening=0 varselect=0;
target Species;
input PetalWidth PetalLength SepalLength SepalWidth/level=INT;
output network=network;
code file=abc;
run;
data work.new_data_scored;
set sashelp.iris;
%INCLUDE abc / source2;
run;
/* end of program */
Ciao,
Koen
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks.
Forgot to say I had actually figured this a few days after posting when I realized the code file looks like, well, code. Unfortunately, it's not quite so clear if this is mathematically the same naive Bayes algorithm as GaussianNB in Python (scikit-learn) or naiveBayes in R (e1071), which are what I'm using for class. Doesn't look like I'll be able to use this, but it was a good learning experience at least.