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); }
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); }
public static List <PriceCandle> GetPriceCandles(TradingSymbol trading_symbol, TimeScale time_scale, DateTime start_inclusive, DateTime end_exclusive) { string data_path = Path.Combine(binary_data_root_path, trading_symbol.Broker, trading_symbol.Account, trading_symbol.Symbol, ToolsEnum.EnumToString(time_scale)); if (!Directory.Exists(data_path)) { throw new Exception("No data for trading symbol: " + trading_symbol); } string[] files = Directory.GetFiles(data_path); if (files.Length == 0) { throw new Exception("No data for trading symbol: " + trading_symbol); } return(ToolsIOSerialization.SerializeFromFile <List <PriceCandle> >(files[0])); }