Ejemplo n.º 1
0
        // Metodas, kuris nuskaito duomenis <Pusiau apmokytam modeliui>
        public static List <Machine_LearningML.Model.ModelInput> GetDataWeak(string path)
        {
            classes.Clear();
            List <Machine_LearningML.Model.ModelInput> data = new List <Machine_LearningML.Model.ModelInput>();
            string line;
            bool   x = false;

            System.IO.StreamReader file = new System.IO.StreamReader(path);
            while ((line = file.ReadLine()) != null)
            {
                if (x)
                {
                    string[] arr = line.Split(',');
                    Machine_LearningML.Model.ModelInput sampleData = new Machine_LearningML.Model.ModelInput()
                    {
                        Price           = Convert.ToSingle(arr[0]),
                        CPU             = Convert.ToSingle(arr[2]),
                        Cores           = Convert.ToSingle(arr[3]),
                        RAM             = Convert.ToSingle(arr[4]),
                        SSDorHDD        = Convert.ToSingle(arr[5]),
                        StorageCapacity = Convert.ToSingle(arr[6]),
                        VRAM            = Convert.ToSingle(arr[7]),
                        Diagonal        = Convert.ToSingle(arr[8]),
                        Weight          = Convert.ToSingle(arr[9]),
                        BatteryCapacity = Convert.ToSingle(arr[10]),
                        RefreshRate     = Convert.ToSingle(arr[11]),
                    };
                    data.Add(sampleData);
                    classes.Add(Convert.ToInt32(arr[12]));
                }
                x = true;
            }
            file.Close();
            return(data);
        }
Ejemplo n.º 2
0
        // For more info on consuming ML.NET models, visit https://aka.ms/mlnet-consume
        // Method for consuming model in your app
        public static ModelOutput Predict(ModelInput input)
        {
            ModelOutput result = PredictionEngine.Value.Predict(input);

            return(result);
        }