Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Visual Data Mining and Machine Learning or just with programming

Calculate sensitivity and specificity and K Fold Cross validation - Enterprise Miner

Reply
Occasional Contributor
Posts: 15

Calculate sensitivity and specificity and K Fold Cross validation - Enterprise Miner

Hello,

 

I am trying to work how to do sensitivity and specificity in SAS Miner.

Is there a specific setting i should use?

I want to know how to get the information for ANN, DT and Logistic regression.

Also trying to work how I can do K-fold cross validation for the above models.

Please can you help?

 

Thanks

Dee

Super User
Posts: 10,020

Re: Calculate sensitivity and specificity and K Fold Cross validation - Enterprise Miner

The following code I wrote before is for K Fold CV of logistic regression.






/****** K-Fold CV ****/
%macro k_fold_cv(k=10);
ods select none;

proc surveyselect data=sashelp.heart group=&k out=have;
run;

%do i=1 %to &k ;
data training;
 set have(where=(groupid ne &i)) ;
run;
data test;
 set have(where=(groupid eq &i));
run;

ods output 
Association=native(keep=label2 nvalue2 rename=(nvalue2=native) where=(label2='c'))
ScoreFitStat=true(keep=dataset freq auc rename=(auc=true));
proc logistic data=training
 outest=est(keep=_status_ _name_) ;
 class sex;
 model status(event='Alive')=sex height weight;
 score data=test fitstat; 
run;

data score&i;
 merge true native est;
 retain id &i ;
 optimism=native-true;
run;
%end;
data k_fold_cv;
 set score1-score&k;
run;

ods select all;
%mend;

%k_fold_cv(k=10)








/*************************************/


%macro k_fold_cv_rep(r=1,k=10);
ods select none;
%do r=1 %to &r;
proc surveyselect data=sashelp.heart group=&k out=have;
run;

%do i=1 %to &k ;
data training;
 set have(where=(groupid ne &i)) ;
run;
data test;
 set have(where=(groupid eq &i));
run;

ods output 
Association=native(keep=label2 nvalue2 rename=(nvalue2=native) where=(label2='c'))
ScoreFitStat=true(keep=dataset freq auc rename=(auc=true));
proc logistic data=training
 outest=est(keep=_status_ _name_) ;
 class sex;
 model status(event='Alive')=sex height weight;
 score data=test fitstat; 
run;

data score_r&r._&i;
 merge true native est;
 retain rep &r id &i;
 optimism=native-true;
run;
%end;
%end;
data k_fold_cv_rep;
 set score_r:;
run;

ods select all;
%mend;

%k_fold_cv_rep(r=20,k=10);


/********************/
data all;
 set k_fold_cv k_fold_cv_rep indsname=indsn;
 length indsname $ 32;
 indsname=indsn;
run;
proc summary data=all nway;
 class indsname;
 var optimism;
 output out=want mean=mean lclm=lclm uclm=uclm;
run;



Occasional Contributor
Posts: 15

Re: Calculate sensitivity and specificity and K Fold Cross validation - Enterprise Miner

Thanks very much for the reply.

 

But is there anything that can be done by setting the properties in sas miner i.e. using the GUI rather than coding?

 

Not very confident with sas coding at the moment.

Super User
Posts: 10,020

Re: Calculate sensitivity and specificity and K Fold Cross validation - Enterprise Miner

Sorry. I don't have much experience with EM .
Occasional Contributor
Posts: 15

Re: Calculate sensitivity and specificity and K Fold Cross validation - Enterprise Miner

okay thanks anyway

Ask a Question
Discussion stats
  • 4 replies
  • 162 views
  • 0 likes
  • 2 in conversation