forked from LittleLittleCloud/MLNet-Benchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTrain.proj
55 lines (47 loc) · 3.93 KB
/
Train.proj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Shared.props" />
<Import Project="Dataset.props" />
<ItemGroup>
<_Dataset Include="@(Dataset)">
<LogPath>$([System.IO.Path]::Combine("$(OutputFolder)", "$(AutoMLType)", "%(Identity)", "log.txt"))</LogPath>
<OutputProjectPath>$([System.IO.Path]::Combine("$(OutputFolder)", "$(AutoMLType)", "%(Identity)"))</OutputProjectPath>
<OutputFolder>$([System.IO.Path]::Combine("$(OutputFolder)", "$(AutoMLType)"))</OutputFolder>
<Path>$([System.IO.Path]::Combine("$(DatasetFolder)","$([System.IO.Path]::GetFileName("%(Url)"))"))</Path>
<MBConfigPath>$([System.IO.Path]::Combine("$(OutputFolder)", "$(AutoMLType)", "%(Identity)", "%(Identity).mbconfig"))</MBConfigPath>
</_Dataset>
</ItemGroup>
<Target Name="Train" Inputs="%(_Dataset.Path)" DependsOnTargets="DownloadDatasetIfNotExist" Outputs="%(_Dataset.MBConfigPath)">
<ItemGroup>
<_Dataset>
<MlNetCommandArgs Condition="%(_Dataset.Task)==classification">%(_Dataset.Task) --dataset %(_Dataset.Path) --label-col %(_Dataset.MLLabel) --train-time $(TrainingTimeInSeconds) --output %(_Dataset.OutputFolder) --name %(_Dataset.Identity) --verbosity q --log-file-path %(_Dataset.LogPath)</MlNetCommandArgs>
<MlNetCommandArgs Condition="%(_Dataset.Task)==regression">%(_Dataset.Task) --dataset %(_Dataset.Path) --label-col %(_Dataset.MLLabel) --train-time $(TrainingTimeInSeconds) --output %(_Dataset.OutputFolder) --name %(_Dataset.Identity) --verbosity q --log-file-path %(_Dataset.LogPath)</MlNetCommandArgs>
<MlNetCommandArgs Condition="%(_Dataset.Task)==recommendation">%(_Dataset.Task) --dataset %(_Dataset.Path) --rating-col %(_Dataset.MLLabel) --user-col %(_Dataset.MLUserId) --item-col %(_Dataset.MLItemId) --train-time $(TrainingTimeInSeconds) --output %(_Dataset.OutputFolder) --name %(_Dataset.Identity) --verbosity q --log-file-path %(_Dataset.LogPath)</MlNetCommandArgs>
<MlNetCommandArgs Condition="%(_Dataset.Task)==forecasting">%(_Dataset.Task) --dataset %(_Dataset.Path) --label-col %(_Dataset.MLLabel) --time-col %(_Dataset.MLTimeCol) --horizon %(_Dataset.MLHorizon) --train-time $(TrainingTimeInSeconds) --output %(_Dataset.OutputFolder) --name %(_Dataset.Identity) --verbosity q --log-file-path %(_Dataset.LogPath)</MlNetCommandArgs>
</_Dataset>
</ItemGroup>
<PropertyGroup>
<MlNetPsScript>Tools\RunMLNet.ps1</MlNetPsScript>
</PropertyGroup>
<Message Importance="high" Text = "task: %(_Dataset.Task) name %(_Dataset.Identity)" />
<MakeDir Directories="%(_Dataset.OutputFolder)" Condition="!Exists(%(_Dataset.OutputFolder))"/>
<!-- Train model, move model to train result folder and remove model folder -->
<Message Importance="high" Text="$(MlNetCommand) %(_Dataset.MlNetCommandArgs)" />
<Exec Command="$(MlNetCommand) %(_Dataset.MlNetCommandArgs)">
<Output TaskParameter="exitcode" PropertyName="exitcode"/>
</Exec>
</Target>
<Target Name="_GetMLNetVersion" Outputs="$(_MLNetVersion)">
<Exec Command="$(MlNetCommand) --version" ConsoleToMsBuild="true" >
<Output TaskParameter="ConsoleOutput" PropertyName="_MLNetVersion" />
</Exec>
</Target>
<Target Name="_DownloadDatasetIfNotExist" Inputs="Dataset.Props" Outputs="@(_Dataset->'%(Path)')">
<DownloadFile SourceUrl="%(_Dataset.Url)" DestinationFolder="$(DatasetFolder)" />
</Target>
<Target Name="GenerateReportFile">
<PropertyGroup>
<_Command>Tools\GenerateReport.ps1 "$(OutputFolder)" "result.csv" "$(AutoMLType)" "$(TrainingTimeInSeconds)" "$(MlNetVersion)"</_Command>
</PropertyGroup>
<Exec Command="powershell -NonInteractive -executionPolicy Unrestricted -command "& { $(_Command) } "" />
</Target>
</Project>