咨询:ML.NET Model Builder拆分出的测试数据集位置
Where to Locate the Test Dataset Split by ML.NET Model Builder
Let’s start with a quick recap of how Model Builder handles data splitting (per ML.NET docs):
Model Builder splits training data into an 80% training set and 20% test set. The training set is used for model training, while the test set is reserved for evaluating model performance via metrics.
Now, to your question about finding the test dataset:
- By default, Model Builder doesn’t save the test dataset as a separate, visible file in your project—it handles the split in-memory during the training and evaluation process. That’s why you’re not seeing it in your folder structure.
- If you need to access or save the test data, here are two reliable ways:
- Export directly from Model Builder: After training finishes, switch to the Evaluate tab. Look for an option labeled something like Export Test Data (the exact wording might vary slightly based on your Visual Studio version). This will save the test split as a CSV/Excel file to a location you specify.
- Modify the generated code: When you generate the training code from Model Builder, you’ll find a
TrainTestSplitmethod call in the pipeline. You can add a few lines of code to save the test subset to a file. For example, using ML.NET’sSaveAsTextmethod:// After splitting the data var testData = splitTestSet; testData.SaveAsText("test-dataset.csv", separator: ',');
- One quick note: If you used a local CSV/Excel file as your input, Model Builder never modifies or duplicates the original file. The split is done programmatically at runtime, so no separate test file is created automatically.
内容的提问来源于stack exchange,提问作者Patrick
相关产品推荐
相关产品推荐

