public static EmpiricalDistOperationParameters GetEmpiricalDistOperationParameters(HistogramOperationModel m1, HistogramOperationModel m2, int sampleSize) { var psm = m1.SchemaModel as IDEASchemaModel; var filter1 = ""; var filterModels = new List <FilterModel>(); filter1 = FilterModel.GetFilterModelsRecursive(m1, new List <IFilterProviderOperationModel>(), filterModels, true); var filter2 = ""; filterModels = new List <FilterModel>(); filter2 = FilterModel.GetFilterModelsRecursive(m2, new List <IFilterProviderOperationModel>(), filterModels, true); var m1Iom = m1.GetAttributeUsageTransformationModel(AttributeUsage.X).FirstOrDefault(); var m2Iom = m2.GetAttributeUsageTransformationModel(AttributeUsage.X).FirstOrDefault(); var parameters = new EmpiricalDistOperationParameters() { AdapterName = psm.RootOriginModel.DatasetConfiguration.Schema.RawName, Filter = FilterModel.And(filter1, filter2), Attrs = new[] { m1Iom, m2Iom }.Select(a => a.AttributeModel.RawName).ToList(), SampleStreamBlockSize = sampleSize, KeepSamples = false }; return(parameters); }
public static ExampleOperationParameters GetExampleOperationParameters(ExampleOperationModel model, int sampleSize) { var psm = model.SchemaModel as IDEASchemaModel; var filter = ""; var filterModels = new List <FilterModel>(); filter = FilterModel.GetFilterModelsRecursive(model, new List <IFilterProviderOperationModel>(), filterModels, true); var parameters = new ExampleOperationParameters { AdapterName = psm.RootOriginModel.DatasetConfiguration.Schema.RawName, Filter = filter, Dimensions = model.AttributeUsageTransformationModels.Select(atm => atm.AttributeModel.Index).ToList(), DummyValue = model.DummyValue, ExampleType = model.ExampleOperationType.ToString(), SampleStreamBlockSize = sampleSize }; return(parameters); }
private void StatisticalComparisonOperationModel_OperationModelUpdated(object sender, OperationModelUpdatedEventArgs e) { var model = (StatisticalComparisonOperationModel)sender; if (model.StatisticallyComparableOperationModels.Count == 2 && !(e is BrushOperationModelUpdatedEventArgs)) { model.ComparisonOrder = _nextComparisonOrder++; _modelToSaveViewModel[model] = new StatisticalComparisonSaveViewModel(); var filter = ""; var filterModels = new List <FilterModel>(); filter = FilterModel.GetFilterModelsRecursive(model.StatisticallyComparableOperationModels[0], new List <IFilterProviderOperationModel>(), filterModels, true); _modelToSaveViewModel[model].FilterDist0 = filter; filter = ""; filterModels = new List <FilterModel>(); filter = FilterModel.GetFilterModelsRecursive(model.StatisticallyComparableOperationModels[1], new List <IFilterProviderOperationModel>(), filterModels, true); _modelToSaveViewModel[model].FilterDist1 = filter; model.ExecutionId += 1; MainViewController.Instance.MainModel.QueryExecuter.ExecuteOperationModel(model, false); } }
private void OperationModel_OperationModelUpdated(object sender, OperationModelUpdatedEventArgs e) { if (_mainModel.IsDefaultHypothesisEnabled) { var model = sender as HistogramOperationModel; var filter = ""; var filterModels = new List <FilterModel>(); filter = FilterModel.GetFilterModelsRecursive(model, new List <IFilterProviderOperationModel>(), filterModels, true); if (!filterModels.Any()) { if (model.StatisticalComparisonOperationModel != null) { RemoveStatisticalComparisonOperationModel(model.StatisticalComparisonOperationModel); model.StatisticalComparisonOperationModel = null; } } else { bool anyComparison = false; foreach (var statisticalComparisonOperationViewModel in ComparisonViewController.Instance.StatisticalComparisonViews.Keys) { foreach (var ovm in statisticalComparisonOperationViewModel.OperationViewModels) { if (ovm.OperationModel == model) { anyComparison = true; break; } } } if (!anyComparison) { StatisticalComparisonOperationModel statModel = model.StatisticalComparisonOperationModel; bool add = false; if (model.StatisticalComparisonOperationModel == null) { statModel = new StatisticalComparisonOperationModel(model.SchemaModel); var a1 = model.GetAttributeUsageTransformationModel(AttributeUsage.X).FirstOrDefault(); if ((a1.AttributeModel as AttributeFieldModel).InputDataType == InputDataTypeConstants.FLOAT || (a1.AttributeModel as AttributeFieldModel).InputDataType == InputDataTypeConstants.INT) { //statModel.TestType = TestType.ttest; } model.StatisticalComparisonOperationModel = statModel; add = true; } foreach (var m in statModel.StatisticallyComparableOperationModels.ToArray()) { statModel.RemoveStatisticallyComparableOperationModel(m); } statModel.AddStatisticallyComparableOperationModel(model); statModel.AddStatisticallyComparableOperationModel( OperationViewModelFactory.CreateDefaultHistogramOperationViewModel( model.SchemaModel, model.GetAttributeUsageTransformationModel(AttributeUsage.X).First().AttributeModel, new Pt()).HistogramOperationModel); if (add) { this.AddStatisticalComparisonOperationModel(statModel); } } } } }
public static HistogramOperationParameters GetHistogramOperationParameters(HistogramOperationModel model, int sampleSize) { var psm = model.SchemaModel as IDEASchemaModel; var filter = ""; var filterModels = new List <FilterModel>(); filter = FilterModel.GetFilterModelsRecursive(model, new List <IFilterProviderOperationModel>(), filterModels, true); var brushes = new List <string>(); foreach (var brushOperationModel in model.BrushOperationModels) { filterModels = new List <FilterModel>(); var brush = ""; if ((brushOperationModel as IFilterProviderOperationModel).FilterModels.Any()) { brush = FilterModel.GetFilterModelsRecursive(brushOperationModel, new List <IFilterProviderOperationModel>(), filterModels, false); } brushes.Add(brush); } var nrOfBins = new List <double>(); nrOfBins = new[] { MainViewController.Instance.MainModel.NrOfXBins, MainViewController.Instance.MainModel.NrOfYBins }.Concat( model.GetAttributeUsageTransformationModel(AttributeUsage.Group).Select(qom => MainViewController.Instance.MainModel.NrOfGroupBins)).ToList(); if ((model.GetAttributeUsageTransformationModel(AttributeUsage.X).First().AttributeModel.RawName == "long") || (model.GetAttributeUsageTransformationModel(AttributeUsage.X).First().AttributeModel.RawName == "lat")) { nrOfBins[0] = 20; } if ((model.GetAttributeUsageTransformationModel(AttributeUsage.Y).First().AttributeModel.RawName == "long") || (model.GetAttributeUsageTransformationModel(AttributeUsage.Y).First().AttributeModel.RawName == "lat")) { nrOfBins[0] = 20; } var aggregates = model.GetAttributeUsageTransformationModel(AttributeUsage.Value).Concat( model.GetAttributeUsageTransformationModel(AttributeUsage.DefaultValue)).Concat( model.GetAttributeUsageTransformationModel(AttributeUsage.X).Where(aom => aom.AggregateFunction != AggregateFunction.None)).Concat( model.GetAttributeUsageTransformationModel(AttributeUsage.Y).Where(aom => aom.AggregateFunction != AggregateFunction.None)).Distinct().ToList(); var xIom = model.GetAttributeUsageTransformationModel(AttributeUsage.X).FirstOrDefault(); var yIom = model.GetAttributeUsageTransformationModel(AttributeUsage.Y).FirstOrDefault(); var xBinning = xIom.AggregateFunction == AggregateFunction.None ? new EquiWidthBinningParameters { Dimension = xIom.AttributeModel.Index, RequestedNrOfBins = MainViewController.Instance.MainModel.NrOfXBins, } : (BinningParameters) new SingleBinBinningParameters { Dimension = xIom.AttributeModel.Index }; var yBinning = yIom.AggregateFunction == AggregateFunction.None ? new EquiWidthBinningParameters { Dimension = yIom.AttributeModel.Index, RequestedNrOfBins = MainViewController.Instance.MainModel.NrOfYBins } : (BinningParameters) new SingleBinBinningParameters { Dimension = yIom.AttributeModel.Index }; AggregateParameters sortAggregateParam = null; var aggregateParameters = new List <AggregateParameters>(); foreach (var agg in aggregates) { AggregateParameters aggParam = null; if (agg.AggregateFunction == AggregateFunction.Avg) { aggParam = new AverageAggregateParameters { Dimension = agg.AttributeModel.Index, DistinctDimension = psm.RootOriginModel.DatasetConfiguration.Schema.DistinctDimension }; } else if (agg.AggregateFunction == AggregateFunction.Count) { aggParam = new CountAggregateParameters { Dimension = agg.AttributeModel.Index, DistinctDimension = psm.RootOriginModel.DatasetConfiguration.Schema.DistinctDimension }; } else if (agg.AggregateFunction == AggregateFunction.Sum) { aggParam = new SumAggregateParameters() { Dimension = agg.AttributeModel.Index, DistinctDimension = psm.RootOriginModel.DatasetConfiguration.Schema.DistinctDimension }; } else if (agg.AggregateFunction == AggregateFunction.SumE) { aggParam = new SumEstimationAggregateParameters() { Dimension = agg.AttributeModel.Index, DistinctDimension = psm.RootOriginModel.DatasetConfiguration.Schema.DistinctDimension }; } aggregateParameters.Add(aggParam); if (agg == model.GetAttributeUsageTransformationModel(AttributeUsage.Value).Concat(model.GetAttributeUsageTransformationModel(AttributeUsage.DefaultValue)).FirstOrDefault()) { sortAggregateParam = aggParam; } aggregateParameters.Add(new MarginAggregateParameters { Dimension = agg.AttributeModel.Index, DistinctDimension = psm.RootOriginModel.DatasetConfiguration.Schema.DistinctDimension, AggregateFunction = agg.AggregateFunction.ToString() }); } var kdeDatatypes = new[] { InputDataTypeConstants.INT, InputDataTypeConstants.FLOAT }.ToList(); var globalAggregates = new List <AggregateParameters>(); foreach (var index in new[] { xIom, yIom }.Where(a => kdeDatatypes.Contains((a.AttributeModel as AttributeFieldModel).InputDataType)).Select(a => a.AttributeModel.Index).Distinct()) { globalAggregates.Add(new KDEAggregateParameters { Dimension = index, NrOfSamples = 50, DistinctDimension = psm.RootOriginModel.DatasetConfiguration.Schema.DistinctDimension }); globalAggregates.Add(new CountAggregateParameters { Dimension = index, DistinctDimension = psm.RootOriginModel.DatasetConfiguration.Schema.DistinctDimension }); } var parameters = new HistogramOperationParameters { AdapterName = psm.RootOriginModel.DatasetConfiguration.Schema.RawName, Filter = filter, Brushes = brushes, BinningParameters = Extensions.Yield(xBinning, yBinning).ToList(), SampleStreamBlockSize = sampleSize, PerBinAggregateParameters = aggregateParameters, SortPerBinAggregateParameter = sortAggregateParam, GlobalAggregateParameters = globalAggregates }; return(parameters); }