public void TestI_Q_KMeansInnerAPIWithDataFrame() { var methodName = System.Reflection.MethodBase.GetCurrentMethod().Name; var outModelFilePath = FileHelper.GetOutputFile("outModelFilePath.zip", methodName); var iris = FileHelper.GetTestFile("iris.txt"); using (var env = new ConsoleEnvironment(conc: 1)) { ComponentHelper.AddStandardComponents(env); var df = Scikit.ML.DataManipulation.DataFrameIO.ReadCsv(iris, sep: '\t', dtypes: new ColumnType[] { NumberType.R4 }); var conc = env.CreateTransform("Concat{col=Feature:Sepal_length,Sepal_width}", df); var roleMap = env.CreateExamples(conc, "Feature", label: "Label"); var trainer = CreateTrainer(env, "km"); IPredictor model; using (var ch = env.Start("test")) model = TrainUtils.Train(env, ch, roleMap, trainer, null, 0); using (var ch = env.Start("Save")) using (var fs = File.Create(outModelFilePath)) TrainUtils.SaveModel(env, ch, fs, model, roleMap); Predictor pred; using (var fs = File.OpenRead(outModelFilePath)) pred = env.LoadPredictorOrNull(fs); #pragma warning disable CS0618 var scorer = ScoreUtils.GetScorer(pred.GetPredictorObject() as IPredictor, roleMap, env, null); #pragma warning restore CS0618 var dfout = Scikit.ML.DataManipulation.DataFrameIO.ReadView(scorer); Assert.AreEqual(dfout.Shape, new Tuple <int, int>(150, 13)); } }