public void Reload() { AllCount = MainViewModel.Default.BooksViewModel.Items.Count; StateStatistics.ReloadSeries(); RatingStatistics.ReloadSeries(); }
/// <summary> /// The prediction method which can be called from SQL Server /// </summary> /// <param name="inputCase"></param> /// <param name="predictionResult"></param> protected override void Predict(MiningCase inputCase, PredictionResult predictionResult) { //the input values and predictec label double[] values; uint label = 0; int attributeSize = 0; //convert and scale the input getValues(inputCase, out values, out label, out attributeSize); Instance instance = new Instance(1, (int)label, values, getLabels()); //obtain the votes int[] votes = getVotes(instance); label = 0; for (uint i = 1; i < votes.Length; i++) { if (votes[i] > votes[label]) { label = i; } } //construct the output AttributeStatistics attStats = new AttributeStatistics(); attStats.Attribute = getTargetAttribute(); StateStatistics stateStat = new StateStatistics(); StateValue stateVal = new StateValue(); stateVal.SetIndex(label); stateStat.Value = AttributeSet.TokenizeAttributeValue(attStats.Attribute, AttributeSet.UntokenizeAttributeValue(attStats.Attribute, stateVal)); attStats.StateStatistics.Add(stateStat); predictionResult.AddPrediction(attStats); }
public void Reload() { AllCount = MainViewModel.Default.MoviesViewModel.Items.Count; TypeStatistics.ReloadSeries(); StateStatistics.ReloadSeries(); RatingStatistics.ReloadSeries(); EveryDayStatistics.ReloadSeries(); EveryMonthStatistics.ReloadSeries(); EveryYearStatistics.ReloadSeries(); }
public ActionResult Statistics() { var model = new StateStatistics(); var entity = _stateRepository.GetAll(); // Count model.Count = entity.Count(); // Latest model.Latest = entity.OrderByDescending(c => c.Id).Take(3).Select(i => new { name = i.Name, // image = _imageService.BuildUrl(i.ImageBlob?.Name, i.Name, 40, 40), creationDate = Globalization.GetLocalDateTime(i.UTCCreation).DateTime.ToLongDateString(), // navigationPath = Url.Action(nameof(StateController.Edit), nameof(StateController).RemoveControllerSuffix(), new { @id = i.Id }) }).Cast <object>().ToList(); // Weekly data var maxDate = DateTime.UtcNow; var minDate = maxDate.AddDays(-7); entity = entity.Where(c => c.UTCCreation.Date >= minDate.Date); entity = entity.Where(c => c.UTCCreation.Date <= maxDate.Date); var items = new List <object>(); for (DateTime date = minDate.Date; date <= maxDate.Date; date = date.AddDays(1)) { var dayName = date.ToString("MMM/dd"); var dayValue = entity.Where(c => c.UTCCreation.Date.Equals(date)).Count(); items.Add(new List <object>() { dayName, dayValue }); } model.WeeklyRegistrations = items; return(Json(model)); }