Next changeset 1:247d404ffbcf (2018-06-03) |
Commit message:
planemo upload commit a1f4dd8eb560c649391ada1a6bb9505893a35272 |
added:
modelBuilding.py model_building.xml templateLibrary.py tool_dependencies.xml |
b |
diff -r 000000000000 -r 2cb81da69c73 modelBuilding.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modelBuilding.py Thu May 31 11:58:59 2018 -0400 |
b |
b'@@ -0,0 +1,182 @@\n+def __inputArguments():\n+\n+\timport argparse\n+\tparser = argparse.ArgumentParser()\n+\n+\tparser.add_argument("--method", nargs=\'?\',default =\'pls\',help="Name of the method on which model will build; \\\n+\tAvailable Methods are:- pls, glm , glmboost ")\n+\tparser.add_argument("rdata",help="Descriptor file for model building")\n+\tparser.add_argument("--getdatainfoeval",nargs=\'?\',default=\'TRUE\',help="Validation of the data ")\n+\tparser.add_argument("--getdatainfoecho",nargs=\'?\',default=\'FALSE\',help="print on consol about Validity of the data ")\n+\tparser.add_argument("--getdatainforesult",nargs=\'?\',default=\'hide\',help="print in output file about Validity of the data ")\n+\tparser.add_argument("--missingfiltereval",nargs=\'?\',default=\'FALSE\',help="Processing step :: removal of missing value ")\n+\tparser.add_argument("--missingfilterecho",nargs=\'?\',default=\'FALSE\',help="print Processing step :: removal of missing value ")\n+\tparser.add_argument("--missingfilterresult",nargs=\'?\',default=\'hide\',help="print in output file about Processing step :: removal of missing value ")\n+\tparser.add_argument("--missingfilterthreshc",nargs=\'?\',default=0.20,type=float,help="info about highly missing column data")\n+\tparser.add_argument("--missingfilterthreshr",nargs=\'?\',default=0.20,type=float,help="info about highly missing row number")\n+\tparser.add_argument("--pcaeval",nargs=\'?\',default=\'FALSE\',help="PCA of data ")\n+\tparser.add_argument("--pcaecho",nargs=\'?\',default=\'FALSE\',help="PCA of data ")\n+\tparser.add_argument("--pcaresult",nargs=\'?\',default=\'hide\',help="print in file about PCA of data ")\n+\tparser.add_argument("--pcacomp",nargs=\'?\',default=3,type=int,help="Number of PCA componant will be plotted ")\n+\tparser.add_argument("--pcaploteval",nargs=\'?\',default=\'FALSE\',help="PCA plot of data ")\n+\tparser.add_argument("--pcaplotecho",nargs=\'?\',default=\'FALSE\',help="print PCA plot of data ")\n+\tparser.add_argument("--pcaplotresult",nargs=\'?\',default=\'hide\',help="write in output file about PCA plot of data")\n+\tparser.add_argument("--pcaplotfig",nargs=\'?\',default=\'TRUE\',help="make figure file for integration in output file")\n+\tparser.add_argument("--initialdataspliteval",nargs=\'?\',default=\'TRUE\',help="data splitting in test and train set ")\n+\tparser.add_argument("--initialdatasplitecho",nargs=\'?\',default=\'FALSE\',help="print about data splitting in test and train set")\n+\tparser.add_argument("--initialdatasplitresult",nargs=\'?\',default=\'hide\',help="write in outputfile about data splitting in test and train set")\n+ parser.add_argument("--saampling",nargs=\'?\',default="garBage",help="Perform sampling from data")\n+\tparser.add_argument("--percent",nargs=\'?\',default=0.8,type=float,help="percent value at which data splitting is done")\n+\tparser.add_argument("--nzveval",nargs=\'?\',default=\'FALSE\',help="remove near zero values")\n+\tparser.add_argument("--nzvresult",nargs=\'?\',default=\'hide\',help="write in outputfile about removing near zero values")\n+\tparser.add_argument("--nzvecho",nargs=\'?\',default=\'FALSE\',help="print about removing near zero values")\n+\tparser.add_argument("--corrfiltereval",nargs=\'?\',default=\'FALSE\',help="remove higly correlated values")\n+\tparser.add_argument("--corrfilterresult",nargs=\'?\',default=\'hide\',help="write in outputfile about removing highly correlated values")\n+\tparser.add_argument("--corrfilterecho",nargs=\'?\',default=\'FALSE\',help="print about removing correlated values")\n+\tparser.add_argument("--threshholdcor",nargs=\'?\',default=0.75,type=float,help="percent value at which correlated values ommitted ")\n+\tparser.add_argument("--preproceval",nargs=\'?\',default=\'FALSE\',help="pre proccesing")\n+\tparser.add_argument("--preprocecho",nargs=\'?\',default=\'FALSE\',help="print about pre proccesing")\n+\tparser.add_argument("--preprocresult",nargs=\'?\',default=\'hide\',help="write in output file about pre proccesing")\n+\tparser.add_argument("--setupworkersecho",nargs=\'?\',default=\'FALSE\',help="print about number of processors")\n+\tparser.add_argument("--'..b'atasets", help="name of the generated datasets")\t\t\n+\tparser.add_argument("--outputmodel", help="give name for the generated model")\t\t\n+\tparser.add_argument("--outputresultpdf", help="give name for the output pdf file")\t\t\n+\t\n+\targs = parser.parse_args()\n+\treturn args\n+\n+def generateRnwScript():\n+\n+ import templateLibrary\n+\tt = templateLibrary.__template4Rnw()\n+\t\n+\tfrom string import Template\n+\ts = Template(t)\n+ \n+\targs = __inputArguments()\n+\n+\ttemplt = s.safe_substitute(METHOD=args.method,\n+\t\t\tRDATA=args.rdata, \n+\t\t\tGETDATAINFOEVAL=args.getdatainfoeval, \n+\t\t\tGETDATAINFOECHO=args.getdatainfoecho, \n+\t\t\tGETDATAINFORESULT=args.getdatainforesult, \n+\t\t\tMISSINGFILTEREVAL=args.missingfiltereval,\n+\t\t\tMISSINGFILTERECHO=args.missingfilterecho,\n+\t\t\tMISSINGFILTERRESULT=args.missingfilterresult,\n+\t\t\tMISSINGFILTERTHRESHC=args.missingfilterthreshc,\n+\t\t\tMISSINGFILTERTHRESHR=args.missingfilterthreshr,\n+\t\t\tPCAEVAL=args.pcaeval,\n+\t\t\tPCAECHO=args.pcaecho,\n+\t\t\tPCARESULT=args.pcaresult,\n+ PCACOMP=args.pcacomp, \n+\t\t\tPCAPLOTEVAL=args.pcaploteval,\n+\t\t\tPCAPLOTECHO=args.pcaplotecho,\n+\t\t\tPCAPLOTRESULT=args.pcaplotresult,\n+\t\t\tPCAPLOTFIG=args.pcaplotfig,\n+\t\t\tINITIALDATASPLITEVAL=args.initialdataspliteval,\n+\t\t\tINITIALDATASPLITECHO=args.initialdatasplitecho,\n+\t\t\tINITIALDATASPLITRESULT=args.initialdatasplitresult,\n+ SAAMPLING=args.saampling,\n+\t\t\tPERCENT=args.percent,\n+\t\t\tNZVEVAL=args.nzveval,\n+\t\t\tNZVRESULT=args.nzvresult,\n+\t\t\tNZVECHO=args.nzvecho,\n+\t\t\tCORRFILTEREVAL=args.corrfiltereval,\n+\t\t\tCORRFILTERRESULT=args.corrfilterresult,\n+\t\t\tCORRFILTERECHO=args.corrfilterecho,\n+\t\t\tTHRESHHOLDCOR=args.threshholdcor,\n+\t\t\tPREPROCEVAL=args.preproceval,\n+\t\t\tPREPROCECHO=args.preprocecho,\n+\t\t\tPREPROCRESULT=args.preprocresult,\n+\t\t\tSETUPWORKERSECHO=args.setupworkersecho,\n+\t\t\tSETUPWORKERSRESULT=args.setupworkersresult,\n+\t\t\tNUMWORKERS=args.numworkers,\n+\t\t\tSETUPRESAMPLINGECHO=args.setupresamplingecho,\n+\t\t\tSETUPRESAMPLINGRESULT=args.setupresamplingresult,\n+\t\t\tRESAMPNAME=args.resampname,\n+\t\t\tRESAMPLENUMBER=args.resamplenumber,\n+ NUMREPEAT=args.numrepeat,\n+\t\t\tRESAMPLENUMBERPERCENT=args.resamplenumberpercent,\n+\t\t\tSETUPGRIDRESULT=args.setupgridresult,\n+\t\t\tSETUPGRIDECHO=args.setupgridecho,\n+\t\t\tSETUPGRIDSIZE=args.setupgridsize,\n+\t\t\tFITMODELRESULT=args.fitmodelresult,\n+\t\t\tFITMODELECHO=args.fitmodelecho,\n+\t\t\tFITMODELEVAL=args.fitmodeleval,\n+\t\t\tMODELDESCRECHO=args.modeldescrecho,\n+\t\t\tMODELDESCRRESULT=args.modeldescrresult,\n+\t\t\tRESAMPTABLEECHO=args.resamptableecho,\n+\t\t\tRESAMPTABLERESULT=args.resamptableresult,\n+\t\t\tPROFILEPLOTECHO=args.profileplotecho,\n+\t\t\tPROFILEPLOTFIG=args.profileplotfig,\n+\t\t\tSTOPWORKERSECHO=args.stopworkersecho,\n+\t\t\tSTOPWORKERSRESULT=args.stopworkersresult,\n+\t\t\tTESTPREDRESULT=args.testpredresult,\n+\t\t\tTESTPREDECHO=args.testpredecho,\n+\t\t\tCLASSPROBSTEXRESULT=args.classprobstexresult,\n+\t\t\tCLASSPROBSTEXECHO=args.classprobstexecho,\n+\t\t\tCLASSPROBSTEXRESULT1=args.classprobstexresult1,\n+\t\t\tCLASSPROBSTEXECHO1=args.classprobstexecho1,\n+\t\t\tSAVEDATAECHO=args.savedataecho,\n+\t\t\tSAVEDATARESULT=args.savedataresult )\n+\n+\t\n+\tf = open(\'result-doc.Rnw\',\'w\')\n+\tf.write(templt)\n+\tf.close()\n+\t\n+def modelBuilding():\n+\n+\timport os\n+\tos.system(\'R CMD Sweave result-doc.Rnw > cmd.log.1 2>&1\')\n+\tos.system(\'R CMD pdflatex result-doc.tex > cmd.log.2 2>&1\')\n+\tos.system(\'R CMD pdflatex result-doc.tex > cmd.log.2 2>&1\')\n+\targs = __inputArguments()\n+\n+ from string import Template\n+ s1 = Template(\'cp $METHOD-Fit.RData $OUTPUTMODEL\')\n+ s2 = Template(\'cp result-doc.pdf $OUTPUTRESULTPDF\')\n+ s3 = Template(\'cp datasets.RData $DATASETS\')\n+\n+ cmd1 = s1.safe_substitute(METHOD=args.method, OUTPUTMODEL=args.outputmodel)\n+ cmd2 = s2.safe_substitute(OUTPUTRESULTPDF=args.outputresultpdf)\n+ cmd3 = s3.safe_substitute(DATASETS=args.datasets)\n+\n+ os.system(cmd1)\n+ os.system(cmd2)\n+ os.system(cmd3)\t\n+\n+if __name__ == "__main__" :\n+\t\n+\tgenerateRnwScript()\n+\tmodelBuilding()\n' |
b |
diff -r 000000000000 -r 2cb81da69c73 model_building.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/model_building.xml Thu May 31 11:58:59 2018 -0400 |
b |
b'@@ -0,0 +1,511 @@\n+<tool id="rcaret_classification_model" name="R-Caret Classifcation Model-Builder" version="1.0">\n+\t<description>Build r-caret package based classification models</description>\n+\t<requirements>\n+ \t\t<requirement type="package" version="3.2.1">R</requirement>\n+ \t\t<requirement type="package" version="1.0">carettools</requirement>\n+\t</requirements>\n+ <stdio>\n+\t <exit_code range="1:" />\n+\t</stdio>\n+\n+<command interpreter="python">\n+#if $OPTION11.PARAMETERS == "Advance"\n+modelBuilding.py --method $METHOD $RDATA --getdatainfoeval $OPTION11.GETDATAINFOEVAL --getdatainfoecho $OPTION11.GETDATAINFOECHO --getdatainforesult $OPTION11.GETDATAINFORESULT --missingfiltereval $OPTION11.CON1.MISSINGFILTEREVAL --missingfilterecho $OPTION11.CON1.MISSINGFILTERECHO --missingfilterresult $OPTION11.CON1.MISSINGFILTERRESULT --missingfilterthreshc $OPTION11.CON1.MISSINGFILTERTHRESHC --missingfilterthreshr $OPTION11.CON1.MISSINGFILTERTHRESHR --pcaeval $OPTION11.PCAEVAL --pcaecho $OPTION11.PCAECHO --pcaresult $OPTION11.PCARESULT --pcacomp $OPTION11.PCACOMP --pcaploteval $OPTION11.PCAPLOTEVAL --pcaplotecho $OPTION11.PCAPLOTECHO --pcaplotresult $OPTION11.PCAPLOTRESULT --pcaplotfig $OPTION11.PCAPLOTFIG --initialdataspliteval $OPTION11.CON2.INITIALDATASPLITEVAL --initialdatasplitecho $OPTION11.CON2.INITIALDATASPLITECHO --initialdatasplitresult $OPTION11.CON2.INITIALDATASPLITRESULT --saampling $OPTION11.CON2.SAAMPLING --percent $OPTION11.CON2.PERCENT --nzveval $OPTION11.CON3.NZVEVAL --nzvresult $OPTION11.CON3.NZVRESULT --nzvecho $OPTION11.CON3.NZVECHO --corrfiltereval $OPTION11.CON4.CORRFILTEREVAL --corrfilterresult $OPTION11.CON4.CORRFILTERRESULT --corrfilterecho $OPTION11.CON4.CORRFILTERECHO --threshholdcor $OPTION11.CON4.THRESHHOLDCOR --preproceval $OPTION11.CON5.PREPROCEVAL --preprocecho $OPTION11.CON5.PREPROCECHO --preprocresult $OPTION11.CON5.PREPROCRESULT --setupworkersecho $OPTION11.SETUPWORKERSECHO --setupworkersresult $OPTION11.SETUPWORKERSRESULT --numworkers $OPTION11.NUMWORKERS --setupresamplingecho $OPTION11.CON6.SETUPRESAMPLINGECHO --setupresamplingresult $OPTION11.CON6.SETUPRESAMPLINGRESULT --resampname $OPTION11.CON6.RESAMPNAME --resamplenumber $OPTION11.CON6.RESAMPLENUMBER --numrepeat $OPTION11.CON6.NUMREPEAT --resamplenumberpercent $OPTION11.CON6.RESAMPLENUMBERPERCENT --setupgridresult $OPTION11.SETUPGRIDRESULT --setupgridecho $OPTION11.SETUPGRIDECHO --setupgridsize $OPTION11.SETUPGRIDSIZE --fitmodelresult $OPTION11.FITMODELRESULT --fitmodelecho $OPTION11.FITMODELECHO --fitmodeleval $OPTION11.FITMODELEVAL --modeldescrecho $OPTION11.MODELDESCRECHO --modeldescrresult $OPTION11.MODELDESCRRESULT --resamptableecho $OPTION11.RESAMPTABLEECHO --resamptableresult $OPTION11.RESAMPTABLERESULT --profileplotecho $OPTION11.PROFILEPLOTECHO --profileplotfig $OPTION11.PROFILEPLOTFIG --stopworkersecho $OPTION11.STOPWORKERSECHO --stopworkersresult $OPTION11.STOPWORKERSRESULT --testpredresult $OPTION11.TESTPREDRESULT --testpredecho $OPTION11.TESTPREDECHO --classprobstexresult $OPTION11.CLASSPROBSTEXRESULT --classprobstexecho $OPTION11.CLASSPROBSTEXECHO --classprobstexresult1 $OPTION11.CLASSPROBSTEXRESULT1 --classprobstexecho1 $OPTION11.CLASSPROBSTEXECHO1 --savedataecho $OPTION11.SAVEDATAECHO --savedataresult $OPTION11.SAVEDATARESULT --datasets $datasets --outputmodel $model --outputresultpdf $document;\n+#end if\n+#if $OPTION11.PARAMETERS == "basic"\n+modelBuilding.py --method $METHOD $RDATA --getdatainfoeval $OPTION11.GETDATAINFOEVAL --getdatainfoecho $OPTION11.GETDATAINFOECHO --getdatainforesult $OPTION11.GETDATAINFORESULT --missingfiltereval $OPTION11.MISSINGFILTEREVAL --missingfilterecho $OPTION11.MISSINGFILTERECHO --missingfilterresult $OPTION11.MISSINGFILTERRESULT --missingfilterthreshc $OPTION11.MISSINGFILTERTHRESHC --missingfilterthreshr $OPTION11.MISSINGFILTERTHRESHR --pcaeval $OPTION11.PCAEVAL --pcaecho $OPTION11.PCAECHO --pcaresult $OPTION11.PCARESULT --pcacomp $OPTION11.PCACOMP --pcaploteval $OPTION11.PCAPLOTEVAL '..b'me="TESTPREDRESULT" type="hidden" value= "tex" help="Set tex if wish to write in output pdf file. default is tex"/>\n+ \t\t<param name="TESTPREDECHO" type="hidden" value="FALSE" help="set True if wish to print. default is False"/>\n+ \t\t<param name="CLASSPROBSTEXRESULT" type="hidden" value="tex" help="Set tex if wish to write in output pdf file. default is tex"/>\n+ \t\t<param name="CLASSPROBSTEXECHO" type="hidden" value="FALSE" help="set True if wish to print .default is False" />\n+ \t\t<param name="CLASSPROBSTEXRESULT1" type="hidden" value="hide" help="Set tex if wish to write in output pdf file. default is hide"/>\n+ \t\t<param name="CLASSPROBSTEXECHO1" type="hidden" value="FALSE" help="set True if wish to print .default is False" />\n+ \t\t<param name="SAVEDATAECHO" type="hidden" value="FALSE" help="set True if wish to print .default is False"/>\n+ \t \t\t<param name="SAVEDATARESULT" type="hidden" value="tex" help="Set tex if wish to write in output pdf file. default is tex"/>\n+\t\n+\t\t</when>\n+\t</conditional>\n+</inputs>\n+\n+<outputs>\n+\t<data format="rdata" label="$METHOD Model" name="model" />\n+\t<data format="pdf" label="Document for $METHOD" name="document" />\n+\t<data format="rdata" label="Datasets used for model building " name="datasets" />\n+</outputs>\t\t\n+\n+<help>\n+\n+.. class:: infomark\n+\n+\n+\n+**Instruction**\n+\n+----------\n+\n+Users may change any parameter as their requirement. For normal practice \n+\n+user required to provide only input csv file and method for model building.\n+\n+More details are given in user manual.Please click here\n+\n+\n+</help>\n+<tests>\n+ <test>\n+ <param name="METHOD" value="pls" />\n+ <param name="RDATA" value="desc.rdata"/>\n+ <param name="PARAMETERS" value="basic" />\n+ <output name="model" file="MODEL.rdata" compare="sim_size" delta="20000" />\n+ <output name="datasets" file="datasets.rdata" compare="sim_size" delta="20000" />\n+ <output name="document" file="MODEL.pdf" compare="sim_size" delta="2000000" >\n+ \t<!--extra_files type="file" name="cmd.log.1" value="test2/cmd.log.1" compare="sim_size" delta="20000"/>\n+ \t<extra_files type="file" name="cmd.log.2" value="test2/cmd.log.2" compare="sim_size" delta="20000"/>\n+ \t<extra_files type="file" name="dataset_2.dat" value="test2/dataset_2.dat" compare="sim_size" delta="80000"/>\n+ \t<extra_files type="file" name="dtaset_3.dat" value="test2/dtaset_3.dat" compare="sim_size" delta="80000"/-->\n+ \t<extra_files type="file" name="obsPred.pdf" value="test2/obsPred.pdf" compare="sim_size" delta="80000" />\n+ \t<extra_files type="file" name="result-doc.aux" value="test2/result-doc.aux" compare="sim_size" delta="80000"/>\n+ \t<extra_files type="file" name="result-doc-densityplot.pdf" value="test2/result-doc-densityplot.pdf" compare="sim_size" delta="80000"/>\n+ \t<extra_files type="file" name="result-doc.log" value="test2/result-doc.log" compare="sim_size" delta="80000"/>\n+ \t<extra_files type="file" name="result-doc.out" value="test2/result-doc.out" compare="sim_size" delta="80000"/>\n+ \t<extra_files type="file" name="result-doc-pcaPlot.pdf" value="test2/result-doc-pcaPlot.pdf" compare="sim_size" delta="80000"/>\n+ \t<extra_files type="file" name="result-doc.pdf" value="test2/result-doc.pdf" compare="sim_size" delta="80000"/>\n+ \t<extra_files type="file" name="result-doc-profilePlot.pdf" value="test2/result-doc-profilePlot.pdf" compare="sim_size" delta="80000"/>\n+ \t<extra_files type="file" name="result-doc.Rnw" value="test2/result-doc.Rnw" compare="sim_size" delta="80000"/>\n+ \t<extra_files type="file" name="result-doc.tex" value="test2/result-doc.tex" compare="sim_size" delta="80000"/>\n+ \t<!--extra_files type="file" name="pls-Fit.RData" value="test2/pls-Fit.RData" compare="sim_size" delta="9000000"/-->\n+ </output>\n+ </test>\n+</tests>\n+\n+</tool>\n' |
b |
diff -r 000000000000 -r 2cb81da69c73 templateLibrary.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templateLibrary.py Thu May 31 11:58:59 2018 -0400 |
[ |
b'@@ -0,0 +1,1266 @@\n+def __template4Rnw():\n+\n+\ttemplate4Rnw = r\'\'\'%% Classification Modeling Script \n+%% Max Kuhn (max.kuhn@pfizer.com, mxkuhn@gmail.com)\n+%% Version: 1.00\n+%% Created on: 2010/10/02\n+%% \n+%% The originla file hs been improved by \n+%% Deepak Bharti, Andrew M. Lynn , Anmol J. Hemrom \n+%% Version : 1.01\n+%% created on : 2014/08/12\n+%% This is an Sweave template for building and describing\n+%% classification models. It mixes R and LaTeX code. The document can\n+%% be processing using R\'s Sweave function to produce a tex file. \n+%%\n+%% The inputs are:\n+%% - the initial data set in a data frame called \'rawData\' \n+%% - a factor column in the data set called \'class\'. this should be the\n+%% outcome variable \n+%% - all other columns in rawData should be predictor variables\n+%% - the type of model should be in a variable called \'modName\'.\n+%% \n+%% The script attempts to make some intelligent choices based on the\n+%% model being used. For example, if modName is "pls", the script will\n+%% automatically center and scale the predictor data. There are\n+%% situations where these choices can (and should be) changed. \n+%%\n+%% There are other options that may make sense to change. For example,\n+%% the user may want to adjust the type of resampling. To find these\n+%% parts of the script, search on the string \'OPTION\'. These parts of\n+%% the code will document the options. \n+\n+\\documentclass[14pt]{report}\n+\\usepackage{amsmath}\n+\\usepackage[pdftex]{graphicx}\n+\\usepackage{color}\n+\\usepackage{ctable}\n+\\usepackage{xspace}\n+\\usepackage{fancyvrb}\n+\\usepackage{fancyhdr}\n+\\usepackage{lastpage}\n+\\usepackage{longtable} \n+\\usepackage{algorithm2e}\n+\\usepackage[\n+ colorlinks=true,\n+ linkcolor=blue,\n+ citecolor=blue,\n+ urlcolor=blue]\n+ {hyperref}\n+\\usepackage{lscape}\n+\\usepackage{Sweave}\n+\\SweaveOpts{keep.source = TRUE}\n+\n+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n+\n+% define new colors for use\n+\\definecolor{darkgreen}{rgb}{0,0.6,0}\n+\\definecolor{darkred}{rgb}{0.6,0.0,0}\n+\\definecolor{lightbrown}{rgb}{1,0.9,0.8}\n+\\definecolor{brown}{rgb}{0.6,0.3,0.3}\n+\\definecolor{darkblue}{rgb}{0,0,0.8}\n+\\definecolor{darkmagenta}{rgb}{0.5,0,0.5}\n+\n+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n+\n+\\newcommand{\\bld}[1]{\\mbox{\\boldmath $$#1$$}}\n+\\newcommand{\\shell}[1]{\\mbox{$$#1$$}}\n+\\renewcommand{\\vec}[1]{\\mbox{\\bf {#1}}}\n+\n+\\newcommand{\\ReallySmallSpacing}{\\renewcommand{\\baselinestretch}{.6}\\Large\\normalsize}\n+\\newcommand{\\SmallSpacing}{\\renewcommand{\\baselinestretch}{1.1}\\Large\\normalsize}\n+\n+\\newcommand{\\halfs}{\\frac{1}{2}}\n+\n+\\setlength{\\oddsidemargin}{-.25 truein}\n+\\setlength{\\evensidemargin}{0truein}\n+\\setlength{\\topmargin}{-0.2truein}\n+\\setlength{\\textwidth}{7 truein}\n+\\setlength{\\textheight}{8.5 truein}\n+\\setlength{\\parindent}{0.20truein}\n+\\setlength{\\parskip}{0.10truein}\n+\n+\\setcounter{LTchunksize}{50}\n+\n+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n+\\pagestyle{fancy}\n+\\lhead{}\n+%% OPTION Report header name\n+\\chead{Classification Model Script}\n+\\rhead{}\n+\\lfoot{}\n+\\cfoot{}\n+\\rfoot{\\thepage\\ of \\pageref{LastPage}}\n+\\renewcommand{\\headrulewidth}{1pt}\n+\\renewcommand{\\footrulewidth}{1pt}\n+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n+\n+%% OPTION Report title and modeler name\n+\\title{Classification Model Script using $METHOD}\n+\\author{"Lynn Group with M. Kuhn, SCIS, JNU, New Delhi"} \n+\n+\\begin{document}\n+\n+\\maketitle\n+\n+\\thispagestyle{empty}\n+<<dummy, eval=TRUE, echo=FALSE, results=hide>>=\n+# sets values for variables used later in the program to prevent the \\Sexpr error on parsing with Sweave\n+numSamples=\'\'\n+classDistString=\'\'\n+missingText=\'\'\n+numPredictors=\'\'\n+numPCAcomp=\'\'\n+pcaText=\'\'\n+nzvText=\'\'\n+corrText=\'\'\n+ppText=\'\'\n+varText=\'\'\n+splitText="Dummy Text"\n+nirText="Dummy Text"\n+# pctTrain is a variable that is initialised in Data splitting, and reused later in testPred\n+pctTrain=0.8\n+Smpling=\'\'\n+nzvText1=\'\'\n+classDistStri'..b' class probabilities",\n+ "for the test set samples are shown in",\n+ "Figure \\\\\\\\ref{F:probs}",\n+ ifelse(numClasses == 2,\n+ " and the test set ROC curve is in Figure \\\\\\\\ref{F:roc}.",\n+ "."))\n+ \n+ \n+ \n+ latex(cm$$table,\n+ title = "",\n+ file = "",\n+ where = "h",\n+ cgroup = "Observed Values",\n+ n.cgroup = numClasses,\n+ caption = "The confusion matrix for the test set",\n+ label = "T:cm")\n+ \n+ } else testString <- ""\n+@ \n+\\Sexpr{testString}\n+\n+\n+<<classProbsTex, results = $CLASSPROBSTEXRESULT, echo = $CLASSPROBSTEXECHO>>=\n+ if(any(modelInfo$probModel) && pctTrain < 1 ) {\n+ cat(\n+ paste("\\\\begin{figure}[p]\\n",\n+ "\\\\begin{center}\\n",\n+ "\\\\includegraphics{classProbs}",\n+ "\\\\caption[PCA Plot]{Class probabilities",\n+ "for the test set. Each panel contains ",\n+ "separate classes}\\n",\n+ "\\\\label{F:probs}\\n",\n+ "\\\\end{center}\\n",\n+ "\\\\end{figure}"))\n+ }\n+ if(any(modelInfo$$probModel) & numClasses == 2 & pctTrain < 1 )\n+ {\n+ cat(\n+ paste("\\\\begin{figure}[p]\\n",\n+ "\\\\begin{center}\\n",\n+ "\\\\includegraphics[clip, width = .8\\\\textwidth]{roc}",\n+ "\\\\caption[ROC Plot]{ROC Curve",\n+ "for the test set.}\\n",\n+ "\\\\label{F:roc}\\n",\n+ "\\\\end{center}\\n",\n+ "\\\\end{figure}"))\n+ } else {\n+cat (paste(""))\n+}\n+\n+@ \n+<<classProbsTex, results = $CLASSPROBSTEXRESULT1, echo = $CLASSPROBSTEXECHO1 >>=\n+ if(any(modelInfo$probModel) && pctTrain < 1) {\n+ pdf("classProbs.pdf", height = 7, width = 7)\n+ trellis.par.set(caretTheme(), warn = FALSE)\n+ print(probPlot)\n+ dev.off()\n+ }\n+ if(any(modelInfo$probModel) & numClasses == 2 & pctTrain < 1) { \n+ resPonse<-testY\n+ preDictor<-classProbs[, levels(trainY)[1]]\n+ pdf("roc.pdf", height = 8, width = 8)\n+# from pROC example at http://web.expasy.org/pROC/screenshots.htm \n+ plot.roc(resPonse, preDictor, # data\n+ percent=TRUE, # show all values in percent\n+ partial.auc=c(100, 90), partial.auc.correct=TRUE, # define a partial AUC (pAUC)\n+ print.auc=TRUE, #display pAUC value on the plot with following options:\n+ print.auc.pattern="Corrected pAUC (100-90%% SP):\\n%.1f%%", print.auc.col="#1c61b6",\n+ auc.polygon=TRUE, auc.polygon.col="#1c61b6", # show pAUC as a polygon\n+ max.auc.polygon=TRUE, max.auc.polygon.col="#1c61b622", # also show the 100% polygon\n+ main="Partial AUC (pAUC)")\n+ plot.roc(resPonse, preDictor,\n+ percent=TRUE, add=TRUE, type="n", # add to plot, but don\'t re-add the ROC itself (useless)\n+ partial.auc=c(100, 90), partial.auc.correct=TRUE,\n+ partial.auc.focus="se", # focus pAUC on the sensitivity\n+ print.auc=TRUE, print.auc.pattern="Corrected pAUC (100-90%% SE):\\n%.1f%%", print.auc.col="#008600",\n+ print.auc.y=40, # do not print auc over the previous one\n+ auc.polygon=TRUE, auc.polygon.col="#008600",\n+ max.auc.polygon=TRUE, max.auc.polygon.col="#00860022")\n+ dev.off()\n+ } else {\n+cat("")\n+ }\n+\n+@ \n+\n+\\section*{Versions}\n+\n+<<versions, echo = FALSE, results = tex>>=\n+toLatex(sessionInfo())\n+\n+@ \n+\n+<<save-data, echo = $SAVEDATAECHO, results = $SAVEDATARESULT>>=\n+## change this to the name of modName....\n+Fit <- modelFit\n+if(exists(\'ppInfo\') && !is.null(ppInfo)){\n+save(Fit,ppInfo,cm,file="$METHOD-Fit.RData")\n+} else {save(Fit,cm,file="$METHOD-Fit.RData")}\n+\n+@\n+The model was built using $METHOD and is saved as $METHOD Model for reuse. This contains the variable Fit.\n+\n+\\end{document}\'\'\'\n+\n+\treturn template4Rnw\n' |
b |
diff -r 000000000000 -r 2cb81da69c73 tool_dependencies.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_dependencies.xml Thu May 31 11:58:59 2018 -0400 |
b |
@@ -0,0 +1,9 @@ +<?xml version="1.0"?> +<tool_dependency> + <package name="R" version="3.2.1"> + <repository changeset_revision="d9f7d84125b7" name="package_r_3_2_1" owner="iuc" prior_installation_required="True" toolshed="https://toolshed.g2.bx.psu.edu/" /> + </package> + <package name="carettools" version="1.0"> + <repository changeset_revision="d8ebc06d55ca" name="package_carettools_1_0" owner="anmoljh" prior_installation_required="True" toolshed="https://toolshed.g2.bx.psu.edu/" /> + </package> +</tool_dependency> |