1 write to Model
Microsoft.ML.Data (1)
MLContext.cs (1)
151Model = new ModelOperationsCatalog(_env);
319 references to Model
DnnAnalyzer (1)
DnnAnalyzer.cs (1)
32var tensorFlowModel = mlContext.Model.LoadTensorFlowModel(modelPath);
Microsoft.Extensions.ML (3)
ModelLoaders\FileModelLoader.cs (1)
140_model = _context.Model.Load(fs, out _);
ModelLoaders\UriModelLoader.cs (1)
146_model = _context.Model.Load(stream, out _);
PredictionEnginePoolPolicy.cs (1)
37_mlContext.Model.CreatePredictionEngine<TData, TPrediction>(_model);
Microsoft.Extensions.ML.Tests (1)
FileLoaderTests.cs (1)
52var engine = context.Model.CreatePredictionEngine<SentimentData, SentimentPrediction>(model);
Microsoft.ML.AutoML (6)
AutoMLExperiment\AutoMLExperiment.cs (1)
47_settings.Seed = ((IHostEnvironmentInternal)_context.Model.GetEnvironment()).Seed;
AutoMLExperiment\IMLContextManager.cs (1)
36var seed = ((IHostEnvironmentInternal)_mainContext.Model.GetEnvironment()).Seed;
Experiment\Experiment.cs (2)
82if ((_context.Model.GetEnvironment() as ICancelable).IsCanceled) 143int? mainContextSeed = ((IHostEnvironmentInternal)_context.Model.GetEnvironment()).Seed;
Experiment\ModelContainer.cs (2)
29_mlContext.Model.Save(model, modelInputSchema, fs); 45model = _mlContext.Model.Load(stream, out var modelInputSchema);
Microsoft.ML.AutoML.Samples (10)
AutoFit\BinaryClassificationExperiment.cs (2)
45mlContext.Model.Save(bestRun.Model, trainDataView.Schema, fs); 48var predictionEngine = mlContext.Model.CreatePredictionEngine<SentimentIssue, SentimentPrediction>(bestRun.Model);
AutoFit\MulticlassClassificationExperiment.cs (2)
46mlContext.Model.Save(bestRun.Model, trainDataView.Schema, fs); 49var predictionEngine = mlContext.Model.CreatePredictionEngine<PixelData, PixelPrediction>(bestRun.Model);
AutoFit\RankingExperiment.cs (2)
53mlContext.Model.Save(bestRun.Model, trainDataView.Schema, ModelPath); 56var predictionEngine = mlContext.Model.CreatePredictionEngine<SearchData, SearchDataPrediction>(bestRun.Model);
AutoFit\RecommendationExperiment.cs (2)
57mlContext.Model.Save(bestRun.Model, trainDataView.Schema, ModelPath); 60var predictionEngine = mlContext.Model.CreatePredictionEngine<Movie, MovieRatingPrediction>(bestRun.Model);
AutoFit\RegressionExperiment.cs (2)
46mlContext.Model.Save(bestRun.Model, trainDataView.Schema, fs); 49var predictionEngine = mlContext.Model.CreatePredictionEngine<TaxiTrip, TaxiTripFarePrediction>(bestRun.Model);
Microsoft.ML.AutoML.Tests (1)
MLContextManagerTests.cs (1)
40((IHostEnvironmentInternal)childContext.Model.GetEnvironment()).Seed.Should().Be(10);
Microsoft.ML.Core.Tests (9)
UnitTests\TestCustomTypeRegister.cs (5)
193ML.Model.Save(model, tribeDataView.Schema, "customTransform.zip"); 194modelForPrediction = ML.Model.Load("customTransform.zip", out var tribeDataViewSchema); 205var engine = ML.Model.CreatePredictionEngine<AlienHero, SuperAlienHero>(modelForPrediction); 226var trainedModel = ML.Model.Load(modelPath, out var dataViewSchema); 228var engine = ML.Model.CreatePredictionEngine<AlienHero, SuperAlienHero>(trainedModel);
UnitTests\TestEntryPoints.cs (4)
1379mlContext.Model.Save(model, data.Schema, modelPath); 4726ML.Model.Save(transformer, data.Schema, countsModel); 4768ML.Model.Save(transformer, data.Schema, countsModel); 6589loadedModel = ml.Model.Load(stream, out var inputSchema);
Microsoft.ML.IntegrationTests (46)
Explainability.cs (2)
53mlContext.Model.Save(model, data.Schema, modelAndSchemaPath); 54loadedModel = mlContext.Model.Load(modelAndSchemaPath, out var schema);
ModelFiles.cs (27)
57mlContext.Model.Save(model, data.Schema, modelPath); 104mlContext.Model.Save(model, data.Schema, modelPath); 110serializedModel = mlContext.Model.Load(file, out var serializedSchema); 115var originalPredictionEngine = mlContext.Model.CreatePredictionEngine<HousingRegression, ScoreColumn>(model); 116var serializedPredictionEngine = mlContext.Model.CreatePredictionEngine<HousingRegression, ScoreColumn>(serializedModel); 151mlContext.Model.Save(transformerModel, data.Schema, modelAndSchemaPath); 156mlContext.Model.Save(null, compositeLoaderModel, compositeLoaderModelPath); 160mlContext.Model.Save(transformerModel, loader, loaderAndTransformerModelPath); 166loadedTransformerModel = mlContext.Model.Load(fs, out var loadedSchema); 171var t = mlContext.Model.LoadWithDataLoader(fs, out loadedCompositeLoader); 176var t1 = mlContext.Model.Load(fs, out var s); 187var t = mlContext.Model.Load(fs, out var s); 190loadedTransformerModel1 = mlContext.Model.LoadWithDataLoader(fs, out var l); 241trainedModel = mlContext.Model.Load(TestCommon.GetDataPath(DataDir, "backcompat", "modelwithoptionalcolumntransform.zip"), out dataViewSchema); 251var model = mlContext.Model.CreatePredictionEngine<ModelInput, ModelOutput>(trainedModel, inputSchemaDefinition: inputSchemaDefinition); 255var model2 = mlContext.Model.CreatePredictionEngine<ModelInput, ModelOutput>(trainedModel, inputSchema: dataViewSchema); 279mlContext.Model.Save(model, loader, modelPath); 287loadedModelWithLoader = mlContext.Model.LoadWithDataLoader(fs, out loadedLoader); 289loadedModelWithoutLoader = mlContext.Model.Load(fs, out loadedSchema); 336mlContext.Model.Save(model, loader, modelPath); 341loadedModel = mlContext.Model.Load(fs, out loadedSchema); 361mlContext.Model.Save(null, loader, modelPath); 392mlContext.Model.Save(null, loaderWithEmbeddedModel, modelPath); 438mlContext.Model.Save(model, loader, modelPath); 463mlContext.Model.Save(model, loader.GetOutputSchema(), modelPath); 481loadedWithSchema = mlContext.Model.Load(fs, out loadedSchema); 484loadedWithLoader = mlContext.Model.LoadWithDataLoader(fs, out loadedLoaderWithTransformer);
ONNX.cs (9)
53mlContext.Model.ConvertToOnnx(model, data, file); 64var originalPredictionEngine = mlContext.Model.CreatePredictionEngine<HousingRegression, ScoreColumn>(model); 65var onnxPredictionEngine = mlContext.Model.CreatePredictionEngine<HousingRegression, VectorScoreColumn>(onnxModel); 103mlContext.Model.ConvertToOnnx(model, data, file); 115var originalPredictionEngine = mlContext.Model.CreatePredictionEngine<HousingRegression, VectorScoreColumn>(model); 117var onnxPredictionEngine = mlContext.Model.CreatePredictionEngine<HousingRegression, VectorScoreColumn>(onnxWorkaroundPipeline); 155mlContext.Model.ConvertToOnnx(model, data, file); 162var originalPredictionEngine = mlContext.Model.CreatePredictionEngine<HousingRegression, ScoreColumn>(model); 164var onnxPredictionEngine = mlContext.Model.CreatePredictionEngine<HousingRegression, VectorScoreColumn>(onnxModel);
Prediction.cs (6)
57var engine = mlContext.Model.CreatePredictionEngine<TweetSentiment, Prediction>(model); 70var newEngine = mlContext.Model.CreatePredictionEngine<TweetSentiment, Prediction>(newModel); 89var engine = mlContext.Model.CreatePredictionEngine<TypeTestData, Prediction>(model); 94var newEngine = mlContext.Model.CreatePredictionEngine<TypeTestData, Prediction>(newModel); 110var engine = mlContext.Model.CreatePredictionEngine<TypeTestData, Prediction>(model, new PredictionEngineOptions()); 130engine = mlContext.Model.CreatePredictionEngine<TypeTestData, Prediction>(model, options);
SchemaDefinitionTests.cs (2)
46var engine1 = _ml.Model.CreatePredictionEngine<InputData, OutputData>(model1, outputSchemaDefinition: outputSchemaDefinition); 50var engine2 = _ml.Model.CreatePredictionEngine<InputData, OutputData>(model2, outputSchemaDefinition: outputSchemaDefinition);
Microsoft.ML.OnnxTransformerTest (9)
DnnImageFeaturizerTest.cs (3)
237ML.Model.Save(model, data.Schema, modelPath); 238var loadedModel = ML.Model.Load(modelPath, out var inputSchema); 240var predEngine = ML.Model.CreatePredictionEngine<ModelInput, ModelOutput>(loadedModel);
OnnxTransformTests.cs (6)
266ML.Model.Save(model, data.Schema, tempPath); 267var loadedModel = ML.Model.Load(tempPath, out DataViewSchema modelSchema); 317ML.Model.Save(model, data.Schema, tempPath); 318var loadedModel = ML.Model.Load(tempPath, out DataViewSchema modelSchema); 1084ML.Model.Save(model, null, fs); 1088loadedModel = ML.Model.Load(fs, out var schema);
Microsoft.ML.PerformanceTests (10)
HashBench.cs (1)
104var estimator = _env.Model.Load(modelPath, out var schema);
PredictionEngineBench.cs (3)
64_irisModel = env.Model.CreatePredictionEngine<IrisData, IrisPrediction>(model); 99_sentimentModel = mlContext.Model.CreatePredictionEngine<SentimentData, SentimentPrediction>(model); 133_breastCancerModel = env.Model.CreatePredictionEngine<BreastCancerData, BreastCancerPrediction>(model);
StochasticDualCoordinateAscentClassifierBench.cs (1)
127_predictionEngine = _mlContext.Model.CreatePredictionEngine<IrisData, IrisPrediction>(_trainedModel);
TextPredictionEngineCreation.cs (5)
38_context.Model.Save(model, data.Schema, modelPath); 41_trainedModel = _context.Model.Load(modelPath, out var inputSchema); 43_trainedModelOldFormat = _context.Model.Load(Path.Combine("TestModels", "SentimentModel.zip"), out inputSchema); 49return _context.Model.CreatePredictionEngine<SentimentData, SentimentPrediction>(_trainedModel); 55return _context.Model.CreatePredictionEngine<SentimentData, SentimentPrediction>(_trainedModelOldFormat);
Microsoft.ML.Samples (60)
Dynamic\ModelOperations\OnnxConversion.cs (2)
72mlContext.Model.ConvertToOnnx(transformer, originalData, stream); 80mlContext.Model.ConvertToOnnx(transformer, originalData, customOpSetVersion, stream);
Dynamic\ModelOperations\SaveLoadModel.cs (3)
32mlContext.Model.Save(model, dataView.Schema, "model.zip"); 36model = mlContext.Model.Load(file, out DataViewSchema schema); 39var engine = mlContext.Model
Dynamic\ModelOperations\SaveLoadModelFile.cs (3)
32mlContext.Model.Save(model, dataView.Schema, "model.zip"); 35model = mlContext.Model.Load("model.zip", out DataViewSchema schema); 38var engine = mlContext.Model
Dynamic\TensorFlow\ImageClassification.cs (1)
42using var model = mlContext.Model.LoadTensorFlowModel(modelLocation);
Dynamic\TensorFlow\TextClassification.cs (2)
63using var tensorFlowModel = mlContext.Model.LoadTensorFlowModel( 119var engine = mlContext.Model.CreatePredictionEngine<IMDBSentiment,
Dynamic\Trainers\BinaryClassification\FieldAwareFactorizationMachine.cs (1)
80var engine = mlContext.Model
Dynamic\Trainers\BinaryClassification\FieldAwareFactorizationMachineWithOptions.cs (1)
91var engine = mlContext.Model
Dynamic\Trainers\BinaryClassification\PermutationFeatureImportanceLoadFromDisk.cs (2)
33mlContext.Model.Save(model0, data.Schema, modelPath); 36var model = mlContext.Model.Load(modelPath, out var schema);
Dynamic\Trainers\MulticlassClassification\ImageClassification\ImageClassificationDefault.cs (3)
91mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema, 98loadedModel = mlContext.Model.Load(file, out schema); 130var predictionEngine = mlContext.Model
Dynamic\Trainers\MulticlassClassification\ImageClassification\LearningRateSchedulingCifarResnetTransferLearning.cs (3)
126mlContext.Model.Save(trainedModel, testDataset.Schema, 133loadedModel = mlContext.Model.Load(file, out schema); 156var predictionEngine = mlContext.Model
Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningEarlyStopping.cs (3)
116mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema, 123loadedModel = mlContext.Model.Load(file, out schema); 152var predictionEngine = mlContext.Model
Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningTrainTestSplit.cs (3)
108mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema, 115loadedModel = mlContext.Model.Load(file, out schema); 139var predictionEngine = mlContext.Model
Dynamic\Trainers\MulticlassClassification\PermutationFeatureImportanceLoadFromDisk.cs (2)
41mlContext.Model.Save(model0, data.Schema, modelPath); 44var model = mlContext.Model.Load(modelPath, out var schema);
Dynamic\Trainers\Ranking\PermutationFeatureImportanceLoadFromDisk.cs (2)
40mlContext.Model.Save(model0, data.Schema, modelPath); 43var model = mlContext.Model.Load(modelPath, out var schema);
Dynamic\Trainers\Regression\PermutationFeatureImportanceLoadFromDisk.cs (2)
39mlContext.Model.Save(model0, data.Schema, modelPath); 42var model = mlContext.Model.Load(modelPath, out var schema);
Dynamic\Transforms\CalculateFeatureContribution.cs (1)
62var predictionEngine = mlContext.Model.CreatePredictionEngine<Data,
Dynamic\Transforms\CalculateFeatureContributionCalibrated.cs (1)
64var predictionEngine = mlContext.Model.CreatePredictionEngine<Data,
Dynamic\Transforms\CustomMappingSaveAndLoad.cs (2)
54mlContext.Model.Save(transformer, data.Schema, "customTransform.zip"); 55var loadedTransform = mlContext.Model.Load("customTransform.zip", out
Dynamic\Transforms\CustomMappingWithInMemoryCustomType.cs (1)
49var engine = mlContext.Model.CreatePredictionEngine<AlienHero,
Dynamic\Transforms\Text\ApplyCustomWordEmbedding.cs (1)
58var predictionEngine = mlContext.Model.CreatePredictionEngine<TextData,
Dynamic\Transforms\Text\ApplyWordEmbedding.cs (1)
48var predictionEngine = mlContext.Model.CreatePredictionEngine<TextData,
Dynamic\Transforms\Text\FeaturizeText.cs (1)
61var predictionEngine = mlContext.Model.CreatePredictionEngine<TextData,
Dynamic\Transforms\Text\FeaturizeTextWithOptions.cs (1)
79var predictionEngine = mlContext.Model.CreatePredictionEngine<TextData,
Dynamic\Transforms\Text\LatentDirichletAllocation.cs (1)
55var predictionEngine = mlContext.Model.CreatePredictionEngine<TextData,
Dynamic\Transforms\Text\NormalizeText.cs (1)
37var predictionEngine = mlContext.Model.CreatePredictionEngine<TextData,
Dynamic\Transforms\Text\ProduceHashedNgrams.cs (1)
61var predictionEngine = mlContext.Model.CreatePredictionEngine<TextData,
Dynamic\Transforms\Text\ProduceHashedWordBags.cs (1)
60var predictionEngine = mlContext.Model.CreatePredictionEngine<TextData,
Dynamic\Transforms\Text\ProduceNgrams.cs (1)
69var predictionEngine = mlContext.Model.CreatePredictionEngine<TextData,
Dynamic\Transforms\Text\ProduceWordBags.cs (1)
66var predictionEngine = mlContext.Model.CreatePredictionEngine<TextData,
Dynamic\Transforms\Text\RemoveDefaultStopWords.cs (1)
41var predictionEngine = mlContext.Model.CreatePredictionEngine<TextData,
Dynamic\Transforms\Text\RemoveStopWords.cs (1)
40var predictionEngine = mlContext.Model.CreatePredictionEngine<TextData,
Dynamic\Transforms\Text\TokenizeIntoCharactersAsKeys.cs (1)
39var predictionEngine = mlContext.Model.CreatePredictionEngine<TextData,
Dynamic\Transforms\Text\TokenizeIntoWords.cs (1)
37var predictionEngine = mlContext.Model.CreatePredictionEngine<TextData,
Dynamic\Transforms\TimeSeries\DetectAnomalyBySrCnn.cs (1)
96model = ml.Model.Load(file, out DataViewSchema schema);
Dynamic\Transforms\TimeSeries\DetectChangePointBySsa.cs (1)
105model = ml.Model.Load(file, out DataViewSchema schema);
Dynamic\Transforms\TimeSeries\DetectChangePointBySsaStream.cs (1)
109model = ml.Model.Load(stream, out DataViewSchema schema);
Dynamic\Transforms\TimeSeries\DetectIidChangePoint.cs (1)
103model = ml.Model.Load(file, out DataViewSchema schema);
Dynamic\Transforms\TimeSeries\DetectIidSpike.cs (1)
88model = ml.Model.Load(file, out DataViewSchema schema);
Dynamic\Transforms\TimeSeries\DetectSpikeBySsa.cs (1)
99model = ml.Model.Load(file, out DataViewSchema schema);
Dynamic\Transforms\TimeSeries\Forecasting.cs (1)
79modelCopy = ml.Model.Load(file, out DataViewSchema schema);
Dynamic\Transforms\TimeSeries\ForecastingWithConfidenceInterval.cs (1)
84modelCopy = ml.Model.Load(file, out DataViewSchema schema);
Microsoft.ML.Samples.GPU (15)
docs\samples\Microsoft.ML.Samples\Dynamic\TensorFlow\ImageClassification.cs (1)
42using var model = mlContext.Model.LoadTensorFlowModel(modelLocation);
docs\samples\Microsoft.ML.Samples\Dynamic\TensorFlow\TextClassification.cs (2)
63using var tensorFlowModel = mlContext.Model.LoadTensorFlowModel( 119var engine = mlContext.Model.CreatePredictionEngine<IMDBSentiment,
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ImageClassificationDefault.cs (3)
91mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema, 98loadedModel = mlContext.Model.Load(file, out schema); 130var predictionEngine = mlContext.Model
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\LearningRateSchedulingCifarResnetTransferLearning.cs (3)
126mlContext.Model.Save(trainedModel, testDataset.Schema, 133loadedModel = mlContext.Model.Load(file, out schema); 156var predictionEngine = mlContext.Model
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningEarlyStopping.cs (3)
116mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema, 123loadedModel = mlContext.Model.Load(file, out schema); 152var predictionEngine = mlContext.Model
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningTrainTestSplit.cs (3)
108mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema, 115loadedModel = mlContext.Model.Load(file, out schema); 139var predictionEngine = mlContext.Model
Microsoft.ML.TensorFlow.Tests (51)
TensorFlowEstimatorTests.cs (7)
81using var model = ML.Model.LoadTensorFlowModel(modelFile); 123using var model = ML.Model.LoadTensorFlowModel(modelFile); 165.Append(ML.Model.LoadTensorFlowModel(modelLocation).ScoreTensorFlowModel("Output", "Input")); 208.Append(ML.Model.LoadTensorFlowModel(modelLocation, false).ScoreTensorFlowModel("Output", "Input")); 222.Append(ML.Model.LoadTensorFlowModel(modelLocation).ScoreTensorFlowModel("Output", "Input")); 288TensorFlowModel model1 = context.Model.LoadTensorFlowModel(modelFile1); 289TensorFlowModel model2 = context.Model.LoadTensorFlowModel(modelFile2);
TensorflowTests.cs (44)
151.Append(_mlContext.Model.LoadTensorFlowModel(modelLocation).ScoreTensorFlowModel("Output", "Input")) 164var predictFunction = _mlContext.Model.CreatePredictionEngine<CifarData, CifarPrediction>(transformer); 199using var tfModel = _mlContext.Model.LoadTensorFlowModel(modelLocation); 291using var tfModel = _mlContext.Model.LoadTensorFlowModel(modelLocation); 413using var tfModel = _mlContext.Model.LoadTensorFlowModel(modelLocation); 510using var tfModel = _mlContext.Model.LoadTensorFlowModel(modelLocation); 556using var tfModel = _mlContext.Model.LoadTensorFlowModel(modelLocation); 669.Append(_mlContext.Model.LoadTensorFlowModel("mnist_model/frozen_saved_model.pb").ScoreTensorFlowModel(new[] { "Softmax", "dense/Relu" }, new[] { "Placeholder", "reshape_input" })) 682var predictFunction = _mlContext.Model.CreatePredictionEngine<MNISTData, MNISTPrediction>(trainedModel); 711.Append(_mlContext.Model.RetrainDnnModel( 732var predictionFunction = _mlContext.Model.CreatePredictionEngine<MNISTData, MNISTPrediction>(trainedModel); 824.Append(_mlContext.Model.RetrainDnnModel( 856var predictFunction = _mlContext.Model.CreatePredictionEngine<MNISTData, MNISTPrediction>(trainedModel); 893.Append(_mlContext.Model.LoadTensorFlowModel("mnist_model").ScoreTensorFlowModel(new[] { "Softmax", "dense/Relu" }, new[] { "Placeholder", "reshape_input" })) 908var predictFunction = _mlContext.Model.CreatePredictionEngine<MNISTData, MNISTPrediction>(trainedModel); 1002using var tensorFlowModel = _mlContext.Model.LoadTensorFlowModel(modelLocation); 1061using var tensorFlowModel = _mlContext.Model.LoadTensorFlowModel(modelLocation); 1105using var tensorFlowModel = _mlContext.Model.LoadTensorFlowModel(modelLocation); 1161.Append(_mlContext.Model.LoadTensorFlowModel(modelLocation).ScoreTensorFlowModel("Output", "Input")) 1175var predictFunction = _mlContext.Model.CreatePredictionEngine<CifarData, CifarPrediction>(transformer); 1185_mlContext.Model.Save(transformer, data.Schema, mlModelLocation); 1191var testTransformer = _mlContext.Model.Load(mlModelLocation, out loadedInputschema); 1196var testPredictFunction = _mlContext.Model.CreatePredictionEngine<CifarData, CifarPrediction>(testTransformer); 1234using TensorFlowModel model = _mlContext.Model.LoadTensorFlowModel(modelLocation); 1284var dataPipe = _mlContext.Model.CreatePredictionEngine<TensorFlowSentiment, TensorFlowSentiment>(model); 1289using var pipelineModel = _mlContext.Model.LoadTensorFlowModel(modelLocation).ScoreTensorFlowModel(new[] { "Prediction/Softmax" }, new[] { "Features" }) 1292using var tfEnginePipe = _mlContext.Model.CreatePredictionEngine<TensorFlowSentiment, TensorFlowSentiment>(pipelineModel); 1343using var tensorFlowModel = _mlContext.Model.LoadTensorFlowModel(@"model_string_test"); 1352var transformer = _mlContext.Model.CreatePredictionEngine<TextInput, TextOutput>(pipeline.Fit(dataview)); 1370using var tensorFlowModel = _mlContext.Model.LoadTensorFlowModel(@"model_primitive_input_test"); 1382var transformer = _mlContext.Model.CreatePredictionEngine<PrimitiveInput, PrimitiveOutput>(pipeline.Fit(dataview)); 1424_mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema, 1430loadedModel = _mlContext.Model.Load(file, out schema); 1527_mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema, 1533loadedModel = _mlContext.Model.Load(file, out schema); 1545using var predictionEngine = _mlContext.Model 1686_mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema, 1692loadedModel = _mlContext.Model.Load(file, out schema); 1704using var predictionEngine = _mlContext.Model 1817_mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema, 1823loadedModel = _mlContext.Model.Load(file, out schema); 1888_mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema, 1894loadedModel = _mlContext.Model.Load(file, out schema); 2060using (var tfModel = _mlContext.Model.LoadTensorFlowModel(modelLocation))
Microsoft.ML.TestFramework (2)
DataPipe\TestDataPipeBase.cs (2)
83ML.Model.Save(transformer, validFitInput.Schema, modelPath); 88loadedTransformer = ML.Model.Load(fs, out loadedInputSchema);
Microsoft.ML.Tests (91)
CalibratedModelParametersTests.cs (6)
31ML.Model.Save(model, data.Schema, modelAndSchemaPath); 33var loadedModel = ML.Model.Load(modelAndSchemaPath, out var schema); 53ML.Model.Save(model, data.Schema, modelAndSchemaPath); 55var loadedModel = ML.Model.Load(modelAndSchemaPath, out var schema); 76ML.Model.Save(model, data.Schema, modelAndSchemaPath); 78var loadedModel = ML.Model.Load(modelAndSchemaPath, out var schema);
DatabaseLoaderTests.cs (5)
75var engine = mlContext.Model.CreatePredictionEngine<IrisData, IrisPrediction>(model); 111var engine = mlContext.Model.CreatePredictionEngine<IrisData, IrisPrediction>(model); 147var engine = mlContext.Model.CreatePredictionEngine<IrisVectorData, IrisPrediction>(model); 179var engine = mlContext.Model.CreatePredictionEngine<IrisVectorData, IrisPrediction>(model); 211var engine = mlContext.Model.CreatePredictionEngine<IrisData, IrisPrediction>(model);
ImagesTests.cs (4)
86ML.Model.Save(model, null, fs); 89model2 = ML.Model.Load(fs, out var schema); 276var engine = ML.Model.CreatePredictionEngine<ImageDataPoint, ImageDataPoint>(model); 1195var predEngine = mlContext.Model.CreatePredictionEngine<InMemoryImage, InMemoryImageOutput>(model);
OnnxConversionTest.cs (11)
978var onnxModel = mlContext.Model.ConvertToOnnxProtobuf(model, dataView, customOpSetVersion); 1506var onnxModel = mlContext.Model.ConvertToOnnxProtobuf(model, dataView); 1731mlContext.Model.ConvertToOnnx(mlmodel, dataView, stream, "Target1"); 1796mlContext.Model.ConvertToOnnx(model, reloadedData, stream); 1799var onnxProtoBufModel = mlContext.Model.ConvertToOnnxProtobuf(model, reloadedData); 1818mlContext.Model.ConvertToOnnx(model, mappedData, stream); 2036mlContext.Model.ConvertToOnnx(model, dataView, 9, stream); 2049mlContext.Model.ConvertToOnnx(model, dataView, 13, stream); 2060var onnxModel = mlContext.Model.ConvertToOnnxProtobuf(model, dataView, 9); 2071var onnxModel = mlContext.Model.ConvertToOnnxProtobuf(model, dataView, 13); 2243var onnxModel = ML.Model.ConvertToOnnxProtobuf(model, dataView);
OnnxSequenceTypeWithAttributesTest.cs (2)
53return ctx.Model.CreatePredictionEngine<FloatInput, OutputObj>(model); 92return ctx.Model.CreatePredictionEngine<FloatInput, WrongOutputObj>(model);
PermutationFeatureImportanceTests.cs (20)
46ML.Model.Save(model, data.Schema, modelAndSchemaPath); 48var loadedModel = ML.Model.Load(modelAndSchemaPath, out var schema); 114ML.Model.Save(model, data.Schema, modelAndSchemaPath); 116var loadedModel = ML.Model.Load(modelAndSchemaPath, out var schema); 188ML.Model.Save(model, data.Schema, modelAndSchemaPath); 190var loadedModel = ML.Model.Load(modelAndSchemaPath, out var schema); 276ML.Model.Save(model, data.Schema, modelAndSchemaPath); 278var loadedModel = ML.Model.Load(modelAndSchemaPath, out var schema); 351ML.Model.Save(model, data.Schema, modelAndSchemaPath); 353var loadedModel = ML.Model.Load(modelAndSchemaPath, out var schema); 425ML.Model.Save(model, data.Schema, modelAndSchemaPath); 427var loadedModel = ML.Model.Load(modelAndSchemaPath, out var schema); 533ML.Model.Save(model, data.Schema, modelAndSchemaPath); 535var loadedModel = ML.Model.Load(modelAndSchemaPath, out var schema); 606ML.Model.Save(model, data.Schema, modelAndSchemaPath); 608var loadedModel = ML.Model.Load(modelAndSchemaPath, out var schema); 684ML.Model.Save(model, data.Schema, modelAndSchemaPath); 686var loadedModel = ML.Model.Load(modelAndSchemaPath, out var schema); 753ML.Model.Save(model, data.Schema, modelAndSchemaPath); 755var loadedModel = ML.Model.Load(modelAndSchemaPath, out var schema);
Scenarios\Api\CookbookSamples\CookbookSamplesDynamicApi.cs (5)
198mlContext.Model.Save(model, trainData.Schema, modelPath); 203ITransformer loadedModel = mlContext.Model.Load(modelPath, out var schema); 280var predictionFunc = mlContext.Model.CreatePredictionEngine<IrisInput, IrisPrediction>(model); 752mlContext.Model.Save(model, cachedTrainData.Schema, modelPath); 762ITransformer loadedModel = newContext.Model.Load(modelPath, out var schema);
Scenarios\Api\Estimators\DecomposableTrainAndPredict.cs (1)
40var engine = ml.Model.CreatePredictionEngine<IrisDataNoLabel, IrisPrediction>(model);
Scenarios\Api\Estimators\Extensibility.cs (1)
49var engine = ml.Model.CreatePredictionEngine<IrisDataNoLabel, IrisPrediction>(model);
Scenarios\Api\Estimators\MultithreadedPrediction.cs (1)
40var engine = ml.Model.CreatePredictionEngine<SentimentData, SentimentPrediction>(model);
Scenarios\Api\Estimators\PredictAndMetadata.cs (1)
37var engine = ml.Model.CreatePredictionEngine<IrisDataNoLabel, IrisPredictionNotCasted>(model);
Scenarios\Api\Estimators\SimpleTrainAndPredict.cs (2)
38var engine = ml.Model.CreatePredictionEngine<SentimentData, SentimentPrediction>(model); 77var engine = ml.Model.CreatePredictionEngine<SentimentData, SentimentPrediction>(model);
Scenarios\ClusteringTests.cs (1)
73var predictFunction = mlContext.Model.CreatePredictionEngine<ClusteringData, ClusteringPrediction>(trainedModel);
Scenarios\IrisPlantClassificationTests.cs (1)
49var predictFunction = mlContext.Model.CreatePredictionEngine<IrisData, IrisPrediction>(trainedModel);
Scenarios\IrisPlantClassificationWithStringLabelTests.cs (1)
48var predictFunction = mlContext.Model.CreatePredictionEngine<IrisDataWithStringLabel, IrisPredictionWithStringLabel>(trainedModel);
Scenarios\WordBagTest.cs (2)
39var predictionEngine = mlContext.Model.CreatePredictionEngine<TextData, TransformedTextData>(textTransformer); 74var predictionEngine = mlContext.Model.CreatePredictionEngine<TextData, TransformedTextData>(textTransformer);
ScenariosWithDirectInstantiation\IrisPlantClassificationTests.cs (1)
50var predictFunction = mlContext.Model.CreatePredictionEngine<IrisData, IrisPrediction>(trainedModel);
TrainerEstimators\CalibratorEstimators.cs (1)
259oldPlattCalibratorTransformer = ML.Model.Load(fs, out var schema);
TrainerEstimators\LbfgsTests.cs (4)
122ML.Model.Save(transformer, dataView.Schema, modelAndSchemaPath); 126transformerChain = ML.Model.Load(fs, out var schema); 216ML.Model.Save(transformer, dataView.Schema, modelAndSchemaPath); 221transformerChain = ML.Model.Load(fs, out var schema);
TrainerEstimators\MatrixFactorizationTests.cs (1)
543model = ML.Model.Load(fs, out var schema);
TrainerEstimators\TreeEnsembleFeaturizerTest.cs (4)
622ML.Model.Save(model, null, fs); 625loadedModel = ML.Model.Load(fs, out var schema); 679ML.Model.Save(model, null, fs); 682loadedModel = ML.Model.Load(fs, out var schema);
Transformers\ConvertTests.cs (1)
396modelOld = ML.Model.Load(fs, out var schema);
Transformers\CopyColumnEstimatorTests.cs (2)
103env.Model.Save(transformer, null, ms); 105var loadedTransformer = env.Model.Load(ms, out var schema);
Transformers\HashTests.cs (2)
338var model = ML.Model.Load(modelPath, out var _); 363var model = ML.Model.Load(modelPath, out _);
Transformers\NormalizerTests.cs (3)
1006var normalizer = ML.Model.Load(modelPath, out var schema); 1059ML.Model.Save(model, data.Schema, modelAndSchemaPath); 1060var loadedModel = ML.Model.Load(modelAndSchemaPath, out var schema);
Transformers\SelectColumnsTests.cs (4)
183ML.Model.Save(transformer, null, ms); 185var loadedTransformer = ML.Model.Load(ms, out var schema); 203ML.Model.Save(transformer, null, ms); 205var loadedTransformer = ML.Model.Load(ms, out var schema);
Transformers\TextFeaturizerTests.cs (2)
751var model = ML.Model.Load(modelPath, out var inputSchema); 760var engine = ML.Model.CreatePredictionEngine<SentimentData, SentimentPrediction>(model, inputSchema);
Transformers\ValueMappingTests.cs (2)
698ML.Model.Save(transformer, null, ms); 700var loadedTransformer = ML.Model.Load(ms, out var schema);
Microsoft.ML.TimeSeries.Tests (4)
TimeSeriesDirectApi.cs (4)
252model2 = ml.Model.Load(file, out var schema); 272model3 = ml.Model.Load(file, out var schema); 340model2 = ml.Model.Load(file, out var schema); 495modelCopy = ml.Model.Load(file, out DataViewSchema schema);