Date: Mon, 24 Jul 2000 17:23:25 -0400
Reply-To: Mark.K.Moran@CCMAIL.CENSUS.GOV
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mark Moran <Mark.K.Moran@CCMAIL.CENSUS.GOV>
Subject: What's the Output Dataset?
Content-type: text/plain; charset=us-ascii
In Enterprise Miner 3.0, I have been using the Neural Net. For now, I am
relying on the GUI to generate the SAS code, at least
until I figure out better what the correct syntax for Proc Neural etc. are and
how to use them. Q: Does anyone know how to identify
the name of the output data set that the neural net produces, giving the
predicted values for each of the validation and/or test
observations?
Remember, I didn't type any of the following code in; the Enterprise Miner wrote
it based
on my mouse clicks through the GUI.
This is what it calls SAS Code for "TRAINING":
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
*;
* SAS NEURAL NETWORK - TRAINING FUNCTION;
*;
proc neural data=EMDATA.DMDBL5GT dmdbcat=EMPROJ.DMDBL5GT
network=EMPROJ.NNS_LS7E.NETWORK
validdata=EMDATA.VAL3XAXV
;
*;
netoptions plot
;
decision decisiondata= EMPROJ.CFNLI1_ decvars=
_DEC1
;
*;
train
outest= EMPROJ.NNES8VCA estiter=1
outfit= EMPROJ.NNFC5OG2
;
*;
code metabase=EMPROJ.NNS_LS7E.DATASTEP;
*;
RUN;
And this is what it calls SAS Code for "Datastep":
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DROP _FATAL_ _EPS _NOCL_ _MAX_ _MAXP_ _SUM_ _NTRIALS;
_FATAL_ = 0;
_NOCL_ = .;
_MAX_ = .;
_MAXP_ = .;
_SUM_ = .;
_NTRIALS = .;
_EPS = 1E-10;
DROP F_DIDCTA;
DROP DIDCTACN DIDCTACY ;
DROP F_EQUMSK;
DROP EQUMSKEN ;
DROP F_EQUMSR;
DROP EQUMSRPN EQUMSRPY ;
DROP CFNLI1 CFNLI0
;
LENGTH _WARN_ $4
F_DIDCTA $ 8
F_EQUMSK $ 8
F_EQUMSR $ 8
F_CFNLI $ 12
I_CFNLI $ 12
;
LABEL
S_EQUCEN = "Standard: EQUCENTS"
S_EQUNEW = "Standard: EQUNEW"
S_EQUOLD = "Standard: EQUOLD"
S_INDCAT = "Standard: INDCAT"
DIDCTACN = "DIDCTACN"
EQUMSRPN = "EQUMSRPN"
H11 = "Hidden: H11"
I_CFNLI = "Into: CFNLI"
F_CFNLI = "From: CFNLI"
P_CFNLI1 = "Predicted: CFNLI=1"
R_CFNLI1 = "Residual: CFNLI=1"
P_CFNLI0 = "Predicted: CFNLI=0"
R_CFNLI0 = "Residual: CFNLI=0"
_WARN_ = "Warnings";
*** *************************;
*** Setting the class variable DIDCTACT;
*** *************************;
F_DIDCTA = PUT( DIDCTACT, $8. );
*** *************************;
*** Normalizing F_DIDCTA;
*** *************************;
%DMNORMIP( F_DIDCTA );
IF F_DIDCTA = '. ' THEN DO;
SUBSTR(_WARN_, 1, 1) = 'M';
_FATAL_ = 1;
DIDCTACN = .;
DIDCTACY = .;
END;
ELSE IF F_DIDCTA = 'N ' THEN DO;
DIDCTACN = 1;
DIDCTACY = 0;
END;
ELSE IF F_DIDCTA = 'Y ' THEN DO;
DIDCTACN = -1;
DIDCTACY = -1;
END;
ELSE DO;
SUBSTR(_WARN_, 2, 1) = 'U';
_FATAL_ = 1;
DIDCTACN = .;
DIDCTACY = .;
END;
*** *************************;
*** Setting the class variable EQUMSKE;
*** *************************;
F_EQUMSK = PUT( EQUMSKE, $8. );
*** *************************;
*** Normalizing F_EQUMSK;
*** *************************;
%DMNORMIP( F_EQUMSK );
IF F_EQUMSK = '. ' THEN DO;
SUBSTR(_WARN_, 1, 1) = 'M';
_FATAL_ = 1;
EQUMSKEN = .;
END;
ELSE IF F_EQUMSK = 'N ' THEN DO;
EQUMSKEN = -1;
END;
ELSE DO;
SUBSTR(_WARN_, 2, 1) = 'U';
_FATAL_ = 1;
EQUMSKEN = .;
END;
*** *************************;
*** Setting the class variable EQUMSRPT;
*** *************************;
F_EQUMSR = PUT( EQUMSRPT, $8. );
*** *************************;
*** Normalizing F_EQUMSR;
*** *************************;
%DMNORMIP( F_EQUMSR );
IF F_EQUMSR = '. ' THEN DO;
SUBSTR(_WARN_, 1, 1) = 'M';
_FATAL_ = 1;
EQUMSRPN = .;
EQUMSRPY = .;
END;
ELSE IF F_EQUMSR = 'N ' THEN DO;
EQUMSRPN = 1;
EQUMSRPY = 0;
END;
ELSE IF F_EQUMSR = 'Y ' THEN DO;
EQUMSRPN = -1;
EQUMSRPY = -1;
END;
ELSE DO;
SUBSTR(_WARN_, 2, 1) = 'U';
_FATAL_ = 1;
EQUMSRPN = .;
EQUMSRPY = .;
END;
*** *************************;
*** Checking missing input Interval
*** *************************;
IF NMISS(
EQUCENTS,
EQUNEW,
EQUOLD,
INDCAT ) THEN DO;
SUBSTR(_WARN_, 1, 1) = 'M';
_FATAL_ = 1;
END;
*** *************************;
*** Writing the Node INTERVAL;
*** *************************;
IF _FATAL_ EQ 0 THEN DO;
S_EQUCEN = -0.756885647 + 0.3062587898 * EQUCENTS;
S_EQUNEW = -0.433642919 + 0.000137637 * EQUNEW;
S_EQUOLD = -0.470546392 + 0.000135566 * EQUOLD;
S_INDCAT = -2.467623796 + 0.0046087363 * INDCAT;
END;
ELSE DO;
S_EQUCEN = .;
S_EQUNEW = .;
S_EQUOLD = .;
S_INDCAT = .;
END;
*** *************************;
*** Writing the Node NOMINAL;
*** *************************;
*** *************************;
*** Writing the Node H1;
*** *************************;
IF _FATAL_ EQ 0 THEN DO;
H11 = -0.886078004 * S_EQUCEN + -0.074665214 * S_EQUNEW + -0.100268438
* S_EQUOLD + -0.476099682 * S_INDCAT;
H11 = H11 + 0.3366874213 * DIDCTACN + 0.2015709227 *
EQUMSRPN;
H11 = -1.339966555 + H11;
H11 = TANH(H11);
END;
ELSE DO;
H11 = .;
END;
*** *************************;
*** Writing the Node CFNLI;
*** *************************;
*** *************************;
*** Setting the class variable CFNLI;
*** *************************;
F_CFNLI = PUT( CFNLI, BEST12. );
*** *************************;
*** Normalizing F_CFNLI;
*** *************************;
%DMNORMIP( F_CFNLI );
IF F_CFNLI = '1 ' THEN DO;
CFNLI1 = 1;
CFNLI0 = 0;
END;
ELSE IF F_CFNLI = '0 ' THEN DO;
CFNLI1 = 0;
CFNLI0 = 1;
END;
ELSE IF F_CFNLI = '. ' THEN DO;
SUBSTR(_WARN_, 1, 1) = 'M';
CFNLI1 = .;
CFNLI0 = .;
END;
ELSE DO;
SUBSTR(_WARN_, 2, 1) = 'U';
CFNLI1 = .;
CFNLI0 = .;
END;
IF _FATAL_ EQ 0 THEN DO;
P_CFNLI1 = -3.077260653 * H11;
P_CFNLI1 = -4.574258039 + P_CFNLI1;
_MAX_ = 0.;
_SUM_ = exp( - _MAX_ );
P_CFNLI1 = EXP(P_CFNLI1 - _MAX_);
_SUM_ = _SUM_ + P_CFNLI1;
P_CFNLI1 = P_CFNLI1 / _SUM_;
P_CFNLI0 = 1. - ( P_CFNLI1 );
END;
ELSE DO;
P_CFNLI1 = .;
P_CFNLI0 = .;
END;
IF _FATAL_ EQ 1 THEN DO;
P_CFNLI1 = 0.1481481481;
P_CFNLI0 = 0.8518518519;
END;
*** *****************************;
*** Writing the Error;
*** And Residuals of the Node CFNLI;
*** ******************************;
IF CFNLI1 NE . AND P_CFNLI1 NE . THEN DO;
IF CFNLI1 NE 0 AND CFNLI1 NE 1 THEN DO;
R_CFNLI1 = .;
END;
ELSE DO;
R_CFNLI1 = CFNLI1 - P_CFNLI1;
END;
END;
ELSE DO;
R_CFNLI1 = .;
END;
IF CFNLI0 NE . AND P_CFNLI0 NE . THEN DO;
IF CFNLI0 NE 0 AND CFNLI0 NE 1 THEN DO;
R_CFNLI0 = .;
END;
ELSE DO;
R_CFNLI0 = CFNLI0 - P_CFNLI0;
END;
END;
ELSE DO;
R_CFNLI0 = .;
END;
*** Decision Processing;
label
D_CFNLI1 = 'Decision: CFNLI'
EP_CFNLI = 'Expected Profit: CFNLI'
BP_CFNLI = 'Best Profit: CFNLI'
CP_CFNLI = 'Computed Profit: CFNLI'
;
length D_CFNLI1 $ 5;
BP_CFNLI = .; CP_CFNLI = .;
*** Compute Expected Consequences and Choose Decision;
_decnum = 1; drop _decnum;
D_CFNLI1 = '1';
EP_CFNLI = P_CFNLI1 * 1 + P_CFNLI0 * 0;
*** Decision Matrix;
array _NNAdema[2,1] _temporary_ (
/* row 1 */ 1
/* row 2 */ 0);
*** Find Index of Target Category;
drop _tarnum; select(F_CFNLI );
when('1') _tarnum = 1;
when('0') _tarnum = 2;
otherwise _tarnum = 0;
end;
if _tarnum <= 0 then goto _NNAdeex;
*** Computed Consequence of Chosen Decision;
CP_CFNLI = _NNAdema[_tarnum,_decnum];
*** Best Possible Consequence of Any Decision without Cost;
array _NNAdebe[2] _temporary_ ( 1 0);
BP_CFNLI = _NNAdebe[_tarnum];
_NNAdeex:;
*** End Decision Processing;
*** *************************;
*** Writing the I_CFNLI;
*** *************************;
_MAXP_ = P_CFNLI1;
I_CFNLI = '1 ';
IF( _MAXP_ LT P_CFNLI0 ) THEN DO;
_MAXP_ = P_CFNLI0;
I_CFNLI = '0 ';
END;