private static void SaveModelAsFile(LocalEnvironment env, TransformerChain <BinaryPredictionTransformer <Microsoft.ML.Runtime.Internal.Internallearn.IPredictorWithFeatureWeights <float> > > model)
        {
            using (var fs = new FileStream(ModelPath, FileMode.Create, FileAccess.Write, FileShare.Write))
                model.SaveTo(env, fs);

            Console.WriteLine("The model is saved to {0}", ModelPath);
        }
Exemple #2
0
        private static void SaveModelAsFile(LocalEnvironment env, TransformerChain <ClusteringPredictionTransformer <KMeansPredictor> > model)
        {
            using (var fs = new FileStream(ModelPath, FileMode.Create, FileAccess.Write, FileShare.Write))
                model.SaveTo(env, fs);

            Console.WriteLine("The model is saved to {0}", ModelPath);
        }
Exemple #3
0
        private static void PerformStep6(TransformerChain <RegressionPredictionTransformer <LinearRegressionPredictor> > trainedModel, IHostEnvironment mlContext)
        {
            byte[] bytes;
            using (var stream = new MemoryStream())
            {
                trainedModel.SaveTo(mlContext, stream);
                bytes = stream.ToArray();
            }

            Redis.GetDatabase(1).StringSet("tm", bytes);
        }