public object PredictDeveloper() { string searchType = Request.Form["type"].ToString(); IFormFile file = Request.Form.Files[0]; int type = int.Parse(searchType); List<BugModel> bugs=GetBugsFromExcel(file); string allProducts=""; string allComponents=""; string allDeveopers=""; decimal totalPrecision = 0; decimal totalRecall = 0; decimal totalFscore = 0; foreach (var item in bugs) { allProducts += item.ProductName+","; allComponents += item.ComponentName+","; allDeveopers += item.AssigneeName+","; string saverity = GetSaverityForSearch(item.SeverityTitle); ProfileMatchConfig config = developerRepository.GetConfig(saverity); int sed = config.no_of_sed; int ned = config.no_of_ned; int fd = config.no_of_fd; string query = item.ComponentName; string []queryOne = new[] { item.ComponentName, item.ProductName, item.KeyWords }; string []queryTwo = new[] { item.ComponentName+','+item.ProductName+','+item.KeyWords }; List<Developer> finalResultset = SimpleSearch(config, (type==1)? queryOne: queryTwo); item.predictedDevelopers = finalResultset; int match = 0; finalResultset.ForEach(x => { var contains = item.AssigneeName.Contains(x.DeveloperName); if (contains) match++; }); decimal actualDevelopers = item.AssigneeName.Split(',').Count(); decimal methodDevelopers= finalResultset.Count; methodDevelopers=(methodDevelopers == 0) ? methodDevelopers = 1: methodDevelopers; actualDevelopers = (actualDevelopers == 0) ? actualDevelopers = 1: actualDevelopers; decimal precision = (match / methodDevelopers); decimal recall = match / actualDevelopers; decimal precall = (precision + recall); decimal fScore = 2 * ((precision * recall) / ((precall==0)?1:precall)); item.Precision = precision; item.Recall = recall; item.Fscore = fScore; totalPrecision += precision; totalRecall += recall; totalFscore += fScore; } var summary = new SummaryModel(); summary.Bugs = bugs.Count(); summary.AvaragePrecesion = totalPrecision / summary.Bugs; summary.AvarageRecall = totalRecall / summary.Bugs; summary.AvarageFscore = totalFscore / summary.Bugs; int productCount= allProducts.Split(',').Distinct().Count(); int ComponentCount = allComponents.Split(',').Distinct().Count(); summary.Products = productCount > 0 ? (productCount - 1) : 0; summary.Components = ComponentCount > 0 ? (ComponentCount - 1) : 0; summary.Developers = allDeveopers.Split(',').Distinct().Count(); return new {bugs,summary}; //return this.Content(sb.ToString()); }