using System;
using Microsoft.ML;
using Microsoft.ML.Data;

namespace SampleLoadMultipleFilesMLNET
{
    class Program
    {
        static void Main(string[] args)
        {
            MLContext ctx = new MLContext();

            TextLoader textLoader = ctx.Data.CreateTextLoader<HousingData>(separatorChar: ',', hasHeader: true);

            IDataView dvSingleFolder = textLoader.Load("Data/*");
            IDataView dvMultipleFoldersNotWorking = textLoader.Load("DataFolder/*/*");
            IDataView dvMultipleFoldersNotWorking2 = textLoader.Load("DataFolder/SubFolder1/*", "DataFolder/SubFolder2/*");
            IDataView dvMultileFoldersWorking = textLoader.Load("DataFolder/SubFolder1/1.csv", "DataFolder/SubFolder2/2.csv");

            var singleFolderPreview = dvSingleFolder.Preview();
            var multipleFolderPreview = dvMultipleFoldersNotWorking.Preview();
            var multipleFolderPreview2 = dvMultipleFoldersNotWorking2.Preview();
            var multipleFoldersWorkingPreview = dvMultileFoldersWorking.Preview();
        }
    }

    public class HousingData
    {
        [LoadColumn(0)]
        public float Size { get; set; }

        [LoadColumn(1, 3)]
        [VectorType(3)]
        public float[] HistoricalPrices { get; set; }

        [LoadColumn(4)]
        [ColumnName("Label")]
        public float CurrentPrice { get; set; }
    }
}
