DTREG Command Line Operation

DTREG Command Line Operation

In production environments it may be useful to operate DTREG in command-line mode to build models. Model building parameters are stored in a command file and in a “template project”. DTREG can then be run from the command line or using a batch (.bat) file to build new models. Command line operation is available only in the Enterprise Version of DTREG.

In order to use DTREG in command line mode, three things are required:

  1. A template project describing the analysis
  2. A command file providing information about files and operations
  3. A command line to invoke DTREG

The Template Project

Because DTREG has many types of models and many options and parameters for each type of model, it is impractical to have a command language to describe all of these features. Instead, a Template Project is used to describe the type of model to be created and to specify options and parameters for the operation. To create a template project, run DTREG in interactive mode, specify a data file with the variables to be analyzed, select the type of model to build, and select options and parameters. Then save the project in a standard DTREG project file (.dtr file).

The Command File

The command file is a text file that contains commands that control the model building process. You can use Notepad, Wordpad or any other text editor to create the command file. The suggested file type is .cmd, but you can use any extension you wish.

The following commands may be placed in a command file. Some commands are required, and some are optional.

FOLDER (optional) – Specifies a default folder where all of the files are specified. If the FOLDER command is not specified, you must specify the folder as part of the file specification on each command.

Syntax: FOLDER device_and_folder

Example: FOLDER C:\Work\Campaign1

PROJECT (required) – Specifies the name of the file with the template project.

Syntax: PROJECT file_name

Example: PROJECT C:\Campaign1\AdModel.dtr

OUTPUT (optional) – Specifies the name of the file where the generated model is to be written. If no OUTPUT command is specified, then the model is not saved. If you simply want to use the template project to score data, it is not necessary to specify an OUTPUT command.

Syntax: OUTPUT file_name

Example: OUTPUT C:\Campaign1\AdTreeBoost.dtr

DATA (optional) – Specifies the name of the data file that will be used to train the model. If you are just performing scoring and not building a model, then you can omit the DATA command.

Syntax: DATA file_name

Example: DATA C:\Campaign1\Tennessee.csv

REPORT (optional) – Specifies the name of the file where the analysis report is to be written. If you do not use a REPORT command, then the analysis report is not saved.

Syntax: REPORT file_name

Example: REPORT C:\Campaign1\TennesseeLog.txt

SCOREINPUT (optional) – Specifies the name of a data file is to be used as input for scoring by the generated model. If you want scoring done, you must specify both a SCOREINPUT and a SCOREOUTPUT command. Omit the SCOREINPUT and SCOREOUTPUT commands if you are building a model and do not want scoring done.

Syntax: SCOREINPUT file_name

Example: SCOREINPUT C:\Campaign1\Nashville.csv

SCOREOUTPUT (optional) – Specifies the name of the data file where output from the scoring function (with predicted target values) is to be written.

Syntax: SCOREOUTPUT file_name

Example: SCOREOUTPUT C:\Campaign1\NashvillePredict.csv

BUILDMODEL (optional) – Specify this command if you want DTREG to build a new predictive. If you only want to use the template project to do scoring, you should omit the BUILDMODEL command.

Syntax: BUILDMODEL

REM (optional) – Comment line.

Example: REM Analysis of Tennessee data

Example Command Files

This is an example command file to build a model:

REM Build a new model whose name is NewProject.dtr
FOLDER  C:\Campaign1
PROJECT  OriginalProject.dtr
OUTPUT  NewProject.dtr
DATA  TrainingData.csv
BUILDMODEL

This is an example file that does scoring using an existing project but which does not build a new project:

REM  Score the Tennessee.csv file
FOLDER  C:\Campaign1
PROJECT  ResponseModel.dtr
SCOREINPUT  Tennessee.csv
SCOREOUTPUT  TennesseeScore.csv

The Command Line

The command file to start DTREG in command line mode is:

DTREG /cmd=”command_file” [/options]

The /cmd=”command_file” switch specifies the name of the command file that is to be executed. You should provide a full file specification including device and folder. For example:

DTREG /cmd=”C:\Campaign1\BuildModel.cmd”

Options:

The following optional switches may be specified:

/MINIMIZE – Start DTREG in minimized mode so that it does not display its screen.

/HIDE – Do not display the execution screen at all.