Ejemplo n.º 1
0
 private void ApplyML3rdResult(List <PredictionResultModel> resultList)
 {
     if (resultList.Count >= 3)
     {
         ML3rdCarName.Text = resultList[2].Name + " - Confidence: " + resultList[2].Confidence + "%";
         CSVCarModel exactCarModel = FindCarObjectPerName(resultList[2].Name);
         ML3rdPrice.Text               = EvaluationHelper.USDToKunas(exactCarModel.Price) + " kn";
         ML3rdHorsepower.Text          = exactCarModel.Horsepower.ToString();
         ML3rdLitres.Text              = exactCarModel.Litres100km.ToString();
         ML3rdFuelType.Text            = exactCarModel.FuelType;
         ML3rdTransmission.Text        = exactCarModel.Transmission;
         pictureBox3rdML.ImageLocation = imageDir + exactCarModel.ID + ".png";
     }
     else
     {
         ML3rdCarName.Text         = "3rd Prediction had too low confidence.";
         ML3rdNumber.Visible       = false;
         ML3rdPrice.Visible        = false;
         ML3rdHorsepower.Visible   = false;
         ML3rdLitres.Visible       = false;
         ML3rdFuelType.Visible     = false;
         ML3rdTransmission.Visible = false;
         pictureBox3rdML.Visible   = false;
     }
 }
Ejemplo n.º 2
0
 private void ApplyML1stResult(List <PredictionResultModel> resultList)
 {
     if (resultList.Count >= 1)
     {
         ML1stCarName.Text = resultList[0].Name + " - Confidence: " + resultList[0].Confidence + "%";
         CSVCarModel exactCarModel = FindCarObjectPerName(resultList[0].Name);
         ML1stCarPrice.Text            = EvaluationHelper.USDToKunas(exactCarModel.Price) + " kn";
         ML1stHorsepower.Text          = exactCarModel.Horsepower.ToString();
         ML1stLitres.Text              = exactCarModel.Litres100km.ToString();
         ML1stFuelType.Text            = exactCarModel.FuelType;
         ML1stTransmission.Text        = exactCarModel.Transmission;
         pictureBox1stML.ImageLocation = imageDir + exactCarModel.ID + ".png";
     }
     else
     {
         // Should never be executed
         ML1stCarName.Text         = "Something went wrong with generating M rediction.";
         ML1stNumber.Visible       = false;
         ML1stCarPrice.Visible     = false;
         ML1stHorsepower.Visible   = false;
         ML1stLitres.Visible       = false;
         ML1stFuelType.Visible     = false;
         ML1stTransmission.Visible = false;
         pictureBox1stML.Visible   = false;
     }
 }
Ejemplo n.º 3
0
 private static void EvaluateBudget(CSVCarModel car)
 {
     if ((int)EvaluationModel.Price >= car.Price)
     {
         car.Score += 50;
     }
 }
Ejemplo n.º 4
0
 private static void EvaluateHorsepower(CSVCarModel car)
 {
     // If car has more horsepower, it gets some score points
     if ((int)EvaluationModel.Horsepower <= car.Horsepower)
     {
         car.Score += 25;
     }
     // If car horsepower is in radius of 50 HP, scores additional score
     if (Math.Abs((int)EvaluationModel.Horsepower - car.Horsepower) <= 50)
     {
         car.Score += 25;
     }
 }
Ejemplo n.º 5
0
 private static void EvaluateSeats(CSVCarModel car)
 {
     if (EvaluationModel.Seats == -1)
     {
         car.Score += 25;
     }
     else
     {
         if (car.Seats == (int)EvaluationModel.Seats)
         {
             car.Score += 25;
         }
     }
 }
Ejemplo n.º 6
0
 private static void EvalutateReleaseYear(CSVCarModel car)
 {
     if (EvaluationModel.Year == -1)
     {
         car.Score += 25;
     }
     else
     {
         if (EvaluationModel.Year == car.Year)
         {
             car.Score += 25;
         }
     }
 }
Ejemplo n.º 7
0
 private static void EvaluateFuelType(CSVCarModel car)
 {
     if (EvaluationModel.FuelType == "any")
     {
         car.Score += 25;
     }
     else
     {
         if (EvaluationModel.FuelType == car.FuelType)
         {
             car.Score += 25;
         }
     }
 }
Ejemplo n.º 8
0
 private static void EvaluateTransmission(CSVCarModel car)
 {
     if (EvaluationModel.Transmission == "any")
     {
         car.Score += 25;
     }
     else
     {
         if (EvaluationModel.Transmission == car.Transmission)
         {
             car.Score += 25;
         }
     }
 }
Ejemplo n.º 9
0
        private static void EvaluateCoefficients(CSVCarModel car)
        {
            int drivingEval    = car.DrivingScore * (int)EvaluationModel.DrivingScoreCoef;
            int comfortEval    = car.ComfortScore * (int)EvaluationModel.ComfortScoreCoef;
            int interiorEval   = car.InteriorScore * (int)EvaluationModel.InteriorScoreCoef;
            int technologyEval = car.TechnologyScore * (int)EvaluationModel.TechnologyScoreCoef;
            int storageEval    = car.StorageScore * (int)EvaluationModel.StorageScoreCoef;
            int economyEval    = car.EconomicalScore * (int)EvaluationModel.EconomicalScoreCoef;
            int goodValueEval  = car.GoodValueScore * (int)EvaluationModel.GoodValueScoreCoef;
            int overallEval    = car.OverallScore * EvaluationModel.OverallScoreCoef;


            car.Score += drivingEval + comfortEval + interiorEval + technologyEval + storageEval
                         + economyEval + goodValueEval + overallEval;
        }
Ejemplo n.º 10
0
        public static List <CSVCarModel> FetchCarList(string[] dataRows, char splitter)
        {
            List <CSVCarModel> outputListCarModels = new List <CSVCarModel>();

            //string[] headerAttributes = dataRows[0].Split(splitter);

            for (int i = 1; i < dataRows.Length - 1; i++)
            {
                string[] oneRowCarObject = dataRows[i].Split(splitter);

                // It is assumed that all data available in dataset is formated properly
                // so there are no any datatype verifications in following step

                CSVCarModel tempCarModel = new CSVCarModel();

                tempCarModel.ID              = int.Parse(oneRowCarObject[0].Trim());
                tempCarModel.Name            = oneRowCarObject[1].ToString().Trim();
                tempCarModel.Year            = int.Parse(oneRowCarObject[2].Trim());
                tempCarModel.Price           = int.Parse(oneRowCarObject[3].Trim());
                tempCarModel.OverallScore    = int.Parse(oneRowCarObject[4].Trim());
                tempCarModel.DrivingScore    = int.Parse(oneRowCarObject[5].Trim());
                tempCarModel.ComfortScore    = int.Parse(oneRowCarObject[6].Trim());
                tempCarModel.InteriorScore   = int.Parse(oneRowCarObject[7].Trim());
                tempCarModel.TechnologyScore = int.Parse(oneRowCarObject[8].Trim());
                tempCarModel.StorageScore    = int.Parse(oneRowCarObject[9].Trim());
                tempCarModel.EconomicalScore = int.Parse(oneRowCarObject[10].Trim());
                tempCarModel.GoodValueScore  = int.Parse(oneRowCarObject[11].Trim());
                tempCarModel.Litres100km     = int.Parse(oneRowCarObject[12].Trim());
                tempCarModel.Seats           = int.Parse(oneRowCarObject[13].Trim());
                tempCarModel.Transmission    = oneRowCarObject[14].ToString().Trim();
                tempCarModel.Horsepower      = int.Parse(oneRowCarObject[15].Trim());
                tempCarModel.FuelType        = oneRowCarObject[16].ToString().Trim();

                outputListCarModels.Add(tempCarModel);
            }
            return(outputListCarModels);
        }
Ejemplo n.º 11
0
 private static void EvaluateFuelEfficency(CSVCarModel car)
 {
     if (EvaluationModel.FuelEfficiency == "poor")
     {
         car.Score += 25;
     }
     else
     {
         if (EvaluationModel.FuelEfficiency == "good")
         {
             if (car.Litres100km <= 8)
             {
                 car.Score += 25;
             }
         }
         else if (EvaluationModel.FuelEfficiency == "average")
         {
             if (car.Litres100km <= 11)
             {
                 car.Score += 25;
             }
         }
     }
 }