Ejemplo n.º 1
0
        public RealReviewScoreData GetRealReviewScore(Business business)
        {
            string webRootPath = _hostingEnvironment.ContentRootPath + @"\Data\yelp_labelled.txt";
            RealReviewScoreData      realReviewScoreData       = new RealReviewScoreData();
            BinaryClassifierPipeline _binaryClassifierPipeline = new BinaryClassifierPipeline(webRootPath);
            float allProbability = 0;

            realReviewScoreData.Accuracy          = _binaryClassifierPipeline.Accuracy;
            realReviewScoreData.AreaUnderROCCurve = _binaryClassifierPipeline.AreaUnderROCCurve;
            realReviewScoreData.F1Score           = _binaryClassifierPipeline.F1Score;
            foreach (var reviewTxt in business.Reviews)
            {
                allProbability += _binaryClassifierPipeline.GetProbabilityByUsingModelWithSingleItem(reviewTxt) * 100;
            }
            realReviewScoreData.RealReviewScore = Convert.ToInt32(allProbability / 3);
            return(realReviewScoreData);
        }
Ejemplo n.º 2
0
        public RealReviewScoreData GetRealReviewScore([FromBody] Business business)
        {
            RealReviewScoreData      realReviewScoreData       = new RealReviewScoreData();
            BinaryClassifierPipeline _binaryClassifierPipeline = new BinaryClassifierPipeline();
            float allProbability = 0;

            realReviewScoreData.Accuracy          = _binaryClassifierPipeline.Accuracy;
            realReviewScoreData.AreaUnderROCCurve = _binaryClassifierPipeline.AreaUnderROCCurve;
            realReviewScoreData.F1Score           = _binaryClassifierPipeline.F1Score;
            realReviewScoreData.Reviews           = business.reviews;
            foreach (var reviewTxt in business.reviews)
            {
                allProbability += _binaryClassifierPipeline.GetProbabilityByUsingModelWithSingleItem(reviewTxt) * 100;
            }
            realReviewScoreData.RealReviewScore = Convert.ToInt32(allProbability / 3);
            return(realReviewScoreData);
        }