Пример #1
0
        public AssociationRules()
        {
            this.InitializeComponent();
            viewModel = this.DataContext as ViewModel;

            //PMML path
            pmmlPath = "ms-appx:///PredictiveAnalytics/Data/Groceries.pmml";

            //Initialize the recommended item collection
            recommendedItemCollection = new Dictionary <string, object>();

            //Transaction (combobox) selection changed event trigger
            Transactions.SelectionChanged += Transactions_SelectionChanged;

            if (!Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
            {
                //Applies style to predicted column
                viewModel.PredictedColumnStyle = this.Resources["predictedColumnColor"] as Style;
                if (inputDataTable == null)
                {
                    //resource path
                    string resourcePath = "ms-appx:///PredictiveAnalytics/Getting Started/Association Rules";
                    // input data
                    inputDataTable = new Table(resourcePath + "/Groceries.txt", true, '\t');

                    // Adds content for R, C# and PMML in the resulting tab control
                    viewModel.RCode = new SyntaxHighlighterR().FormatCode(Windows.Storage.PathIO.
                                                                          ReadTextAsync(resourcePath + "/Groceries.R").GetAwaiter().GetResult());
                    viewModel.CSharpCode = new SyntaxRichTextBoxCS().FormatCode(Windows.Storage.PathIO.
                                                                                ReadTextAsync(resourcePath + "/Groceries.cs").GetAwaiter().GetResult());
                    viewModel.PMML = SyntaxHighlighterXAML.FormatCode(Windows.Storage.PathIO.ReadTextAsync(pmmlPath).GetAwaiter().GetResult());

                    // Resizes grid column based on its value length
                    this.SfDataGrid.GridColumnSizer = new GridColumnSizerExt(this.SfDataGrid);
                }

                //Transaction loaded event trigger
                Transactions.Loaded += Transactions_Loaded;
            }
            else
            {
                Transactions.SelectedIndex = 0;
            }
        }
Пример #2
0
        public GeneralRegression()
        {
            this.InitializeComponent();
            viewModel = this.DataContext as ViewModel;

            // PMML path
            pmmlPath = "ms-appx:///PredictiveAnalytics/Data/Audit.pmml";

            //Initialize the predicted breast cancer status collection
            predictedAdjustedCollection = new Dictionary <string, object>();

            if (!Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
            {
                //Applies style to predicted column
                viewModel.PredictedColumnStyle = this.Resources["predictedColumnColor"] as Style;

                if (inputDataTable == null)
                {
                    //resource path
                    string resourcePath = "ms-appx:///PredictiveAnalytics/Getting Started/General Regression";
                    // input data
                    inputDataTable = new Table(resourcePath + "/Audit.csv", true, ',');

                    // Adds content for R, C# and PMML in the resulting tab control
                    viewModel.RCode = new SyntaxHighlighterR().FormatCode(Windows.Storage.PathIO.
                                                                          ReadTextAsync(resourcePath + "/Audit.R").GetAwaiter().GetResult());
                    viewModel.CSharpCode = new SyntaxRichTextBoxCS().FormatCode(Windows.Storage.PathIO.
                                                                                ReadTextAsync(resourcePath + "/Audit.cs").GetAwaiter().GetResult());
                    viewModel.PMML = SyntaxHighlighterXAML.FormatCode(Windows.Storage.PathIO.ReadTextAsync(pmmlPath).GetAwaiter().GetResult());

                    // Resizes grid column based on its value length
                    this.SfDataGrid.GridColumnSizer = new GridColumnSizerExt(this.SfDataGrid);
                }

                //InputRecord (combobox) loaded event trigger
                InputRecords.Loaded += InputRecords_Loaded;

                //Input record (combo box) selection changed event trigger
                InputRecords.SelectionChanged += InputRecords_SelectionChanged;
            }
        }
Пример #3
0
        public ClusteringModel()
        {
            this.InitializeComponent();
            viewModel = this.DataContext as ViewModel;

            // PMML path
            pmmlPath = "ms-appx:///PredictiveAnalytics/Data/Glass.pmml";

            //Initialize the predicted cluster details collection
            predictedClusterDetails = new Dictionary <string, object>();

            if (!Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
            {
                //Applies style to predicted column
                viewModel.PredictedColumnStyle = this.Resources["predictedColumnColor"] as Style;
                if (inputDataTable == null)
                {
                    //resource path
                    string resourcePath = "ms-appx:///PredictiveAnalytics/Getting Started/Clustering Model";
                    // input data
                    inputDataTable = new Table(resourcePath + "/Glass.csv", true, ',');

                    // Adds content for R, C# and PMML in the resulting tab control
                    viewModel.RCode = new SyntaxHighlighterR().FormatCode(Windows.Storage.PathIO.
                                                                          ReadTextAsync(resourcePath + "/Glass.R").GetAwaiter().GetResult());
                    viewModel.CSharpCode = new SyntaxRichTextBoxCS().FormatCode(Windows.Storage.PathIO.
                                                                                ReadTextAsync(resourcePath + "/Glass.cs").GetAwaiter().GetResult());
                    viewModel.PMML = SyntaxHighlighterXAML.FormatCode(Windows.Storage.PathIO.ReadTextAsync(pmmlPath).GetAwaiter().GetResult());

                    // Resizes grid column based on its value length
                    this.SfDataGrid.GridColumnSizer = new GridColumnSizerExt(this.SfDataGrid);
                }

                //InputRecord (combobox) loaded event trigger
                InputRecords.Loaded += InputRecords_Loaded;

                //Input record (combobox) selection changed event trigger
                InputRecords.SelectionChanged += InputRecords_SelectionChanged;
            }

            //Cluster size are added based on the values presented in PMML ("Glass.pmml")
            viewModel.ClusterInformation = new List <ClusterDetails>();
            viewModel.ClusterInformation.Add(new ClusterDetails()
            {
                ID = "Cluster 1", Size = 46
            });
            viewModel.ClusterInformation.Add(new ClusterDetails()
            {
                ID = "Cluster 2", Size = 26
            });
            viewModel.ClusterInformation.Add(new ClusterDetails()
            {
                ID = "Cluster 3", Size = 26
            });
            viewModel.ClusterInformation.Add(new ClusterDetails()
            {
                ID = "Cluster 4", Size = 7
            });
            viewModel.ClusterInformation.Add(new ClusterDetails()
            {
                ID = "Cluster 5", Size = 61
            });
            viewModel.ClusterInformation.Add(new ClusterDetails()
            {
                ID = "Cluster 6", Size = 5
            });
        }