HsRangeCa CalculateHsRangeCa(string bucketCounts, int [] samplesCount, bool isVerbose) { ClusterTree rt = new ClusterTree(); Props parameters = GetParams(bucketCounts); parameters.Set("IsCreatingClusterTree", "true"); HsRangeCa ca = new HsRangeCa(parameters); CaMcGen gen = new CaMcGen { Clusterizer = ca, IsVerbose = isVerbose, // IsVerboseSamples = true, RngSeed = 0, SamplesCount = samplesCount }; rt.Root = gen.Generate(); string fileName = Path.Combine(_outDir, bucketCounts.Replace(' ', 'x')) + ".dat"; rt.Write(fileName); parameters.Set("ClusterTreeFile", fileName); parameters.Set("IsCreatingClusterTree", "false"); HsRangeCa ca1 = new HsRangeCa(parameters); return(ca1); }
HsSdKMeansAdaptiveCa CalculateCa(Props parameters, int[] samplesCount, int rngSeed) { ClusterTree rt = new ClusterTree(); parameters.Set("IsCreatingClusterTree", "true"); HsSdKMeansAdaptiveCa ca = new HsSdKMeansAdaptiveCa(parameters); CaMcGen gen = new CaMcGen { Clusterizer = ca, IsVerbose = false, // IsVerboseSamples = true, RngSeed = rngSeed, SamplesCount = samplesCount }; rt.Root = gen.Generate(); string fileName = Path.Combine(_outDir, "ca-hssd-km.dat"); rt.Write(fileName); parameters.Set("ClusterTreeFile", fileName); parameters.Set("IsCreatingClusterTree", "false"); HsSdKMeansAdaptiveCa ca1 = new HsSdKMeansAdaptiveCa(parameters); return(ca1); }
static int Main(string[] args) { if (!Parser.ParseArgumentsWithUsage(args, _cmdLine)) { return(1); } if (_cmdLine.DebuggerLaunch) { Debugger.Launch(); } Props caProps = XmlSerializerExt.Deserialize <Props>(_cmdLine.ChanceAbstractionFile); caProps.Set("IsCreatingClusterTree", "true"); IChanceAbstraction ca = ChanceAbstractionHelper.CreateFromProps(caProps); Console.WriteLine("CA: {0}", ca.Name); List <int> samplesCount = new List <int>(); foreach (string sc in _cmdLine.SamplesCount.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { samplesCount.Add(int.Parse(sc)); } int rngSeed = _cmdLine.RngSeed == 0 ? (int)DateTime.Now.Ticks : _cmdLine.RngSeed; Console.WriteLine("RNG seed: {0}", rngSeed); CaMcGen gen = new CaMcGen { Clusterizer = (IClusterizer)ca, IsVerbose = true, // IsVerboseSamples = true, RngSeed = rngSeed, SamplesCount = samplesCount.ToArray() }; ClusterTree rt = new ClusterTree(); rt.Root = gen.Generate(); string dir = Path.GetDirectoryName(_cmdLine.ChanceAbstractionFile); string file = Path.GetFileNameWithoutExtension(_cmdLine.ChanceAbstractionFile) + ".dat"; string fileName = Path.Combine(dir, file); Console.WriteLine("Writing range tree to {0}", fileName); rt.Write(fileName); return(0); }
public void Test_Interactive() { string bucketCounts = "8 7 6 5"; HsRangeCa ca = new HsRangeCa(GetParams(bucketCounts)); CaMcGen gen = new CaMcGen { Clusterizer = ca, IsVerbose = true, // IsVerboseSamples = true, RngSeed = 0, SamplesCount = new int[] { 0, 100, 10, 10 } }; gen.Generate(); }