Example #1
0
        static void ExampleML4()
        {
            string         file_path_ser             = @"D:\Dropbox\TestData\ML4\brains_dataset.ser";
            IDataSetHybrid data_set_hybrid_unlabeled = null;

            if (File.Exists(file_path_ser))
            {
                try
                {
                    data_set_hybrid_unlabeled = DataSetHybrid.Read(new BinaryReader(File.Open(file_path_ser, FileMode.Open)));
                }
                catch (Exception)
                {
                    data_set_hybrid_unlabeled = null;
                }
            }

            if (data_set_hybrid_unlabeled == null)
            {
                IDataSet <int> data_set0 = ReadExcellNominal(@"D:\Dropbox\TestData\ML4\brains_ml.xlsx");
                data_set_hybrid_unlabeled = CleanUpML4(data_set0);
                ToolsIOSerialization.SerializeToFile(file_path_ser, data_set_hybrid_unlabeled);
            }

            IDataSet <int>      data_set_nominal_unlabeled          = data_set_hybrid_unlabeled.ConvertToNominal(5);
            IDataSet <int, int> data_set_nominal_labeled            = data_set_nominal_unlabeled.PromoteFeatureToLabel(0);
            Tuple <IDataSet <int, int>, IDataSet <int, int> > split = data_set_nominal_labeled.Split();
            IDataSet <int, int> training_set = split.Item1;
            IDataSet <int, int> test_set     = split.Item2;

            ProccessDataSetNominalJoinTable(training_set, test_set);
        }
Example #2
0
        public void TestTrivial1(IAlphaPartitionTreeBuilder <float, float> builder)
        {
            ImageRaster3D <float> image            = new ImageRaster3D <float>(10, 10, 10);
            ITopologyElementEdge  element_topology = new TopologyElementRaster3D6Connectivity(image.Raster).GetElementEdgeRasterTopology();
            IFunctionDissimilarity <float, float> edge_function = new FunctionDistanceAbsoluteDifference();
            IAlphaPartitionTree <float>           tree          = builder.BuildAlphaPartitionTree(element_topology, edge_function, image.GetElementValues(false));

            Assert.AreEqual(1000, tree.GetRealElementsIndexesWithMaxAlfa(0, 0).Length);
            Assert.AreEqual(3700, tree.GetFullElementsIndexesWithMaxAlfa(0, 0).Length);


            ToolsIOSerialization.SerializeToFile(@"E:\Data\Dropbox\Dropbox\TestData\Tree.blb", tree);
        }