Inheritance: PivotsAbstract
Exemplo n.º 1
0
 public override void Build(LAESA idx, int num_pivs, int num_rings, SequenceBuilder seq_builder = null)
 {
     if (seq_builder == null) {
         seq_builder = SequenceBuilders.GetIISeq(BitmapBuilders.GetSArray());
     }
     base.Build (idx, num_pivs, num_rings, seq_builder);
 }
Exemplo n.º 2
0
Arquivo: LAESA.cs Projeto: sadit/natix
 public void Build(LAESA idx, int num_pivs)
 {
     this.DB = idx.DB;
     var S = new int[num_pivs];
     this.DIST = new List<double>[num_pivs];
     int I = 0;
     for (int pivID = 0; pivID < num_pivs; ++pivID) {
         S[pivID] = pivID;
         this.DIST[pivID] = idx.DIST[pivID];
         I++;
     }
     this.PIVS = new SampleSpace("", idx.PIVS, S);
 }
Exemplo n.º 3
0
 public virtual void Build(LAESA idx, int num_pivs, int num_rings, ListIBuilder list_builder = null)
 {
     // setting up MAX_SYMBOL and alpha_stddev values
     {
         num_rings = Math.Max (8, num_rings);
         num_rings = 1 << ((int)Math.Ceiling (Math.Log (num_rings, 2)));
         this.MAX_SYMBOL = num_rings - 1;
         this.alpha_stddev = 8.0 / num_rings;
     }
     this.DB = idx.DB;
     var P = (idx.PIVS as SampleSpace);
     var S = new int[num_pivs];
     int n = this.DB.Count;
     this.STDDEV = new float[num_pivs];
     this.MEAN = new float[num_pivs];
     this.DIST = new IList<int>[num_pivs];
     int I = 0;
     Action<int> build_one_pivot = delegate(int p) {
         S [p] = P.SAMPLE [p];
         var D = new List<double>(idx.DIST[p]);
         this.ComputeStats(D, p);
         var stddev = this.STDDEV[p];
         var mean = this.MEAN[p];
         var L = new ListIFS(ListIFS.GetNumBits(this.MAX_SYMBOL));
         for (int i = 0; i < n; ++i) {
             var d = D[i];
             var sym = this.Discretize(d, stddev, mean);
             L.Add (sym);
         }
         if (list_builder == null) {
             this.DIST[p] = L;
         } else {
             this.DIST[p] = list_builder(L, this.MAX_SYMBOL);
         }
         if (I % 10 == 0 ) {
             Console.Write ("== advance: {0}/{1}, ", I, num_pivs);
             if (I % 50 == 0) {
                 Console.WriteLine ();
             }
         }
         I++;
     };
     Parallel.For(0, num_pivs, build_one_pivot);
     this.PIVS = new SampleSpace ("", P.DB, S);
     Console.WriteLine ("=== done Build CompactPivotsLRANS");
 }
Exemplo n.º 4
0
        public virtual void Build(LAESA idx, int num_pivs, int num_rings, SequenceBuilder seq_builder = null)
        {
            if (seq_builder == null) {
                seq_builder = SequenceBuilders.GetSeqPlain (32);
            }
            base.Build (idx, num_pivs, num_rings, null);
            this.SEQ = new Sequence[num_pivs];
            var build_one_pivot = new Action<int>(delegate(int p) {
                var D = this.DIST[p];
                this.SEQ[p] = seq_builder(D, this.MAX_SYMBOL+1);
                if (p % 10 == 0 || p + 1 == num_pivs) {
                    Console.Write ("== advance: {0}/{1}, ", p, num_pivs);
                    if (p % 100 == 0 || p + 1 == num_pivs) {
                        Console.WriteLine ();
                    }
                }

            });
            Parallel.For(0, num_pivs, build_one_pivot);
            this.EmulateDIST();
        }
Exemplo n.º 5
0
 public void BuildLAESA(IList<LC_RNN> indexlist, int max_instances = 0, int num_pivs = 0, SequenceBuilder seq_builder = null)
 {
     base.Build (indexlist, max_instances, seq_builder);
     var laesa = new LAESA ();
     if (num_pivs == 0) {
         laesa.Build (this.DB, this.LC_LIST.Count);
     } else {
         laesa.Build (this.DB, num_pivs);
     }
 }
Exemplo n.º 6
0
 public override void Build(LAESA idx, int num_pivs, int num_rings, ListIBuilder list_builder)
 {
     throw new NotSupportedException("This method should not be used on this specilized class");
 }
Exemplo n.º 7
0
 public static string ExecuteLAESA(IndexArgumentSetup setup, string nick, int numpivs)
 {
     var idxname = String.Format ("{0}/Index.LAESA.{1}", nick, numpivs);
     return Execute (setup, nick, idxname, (db) => {
         LAESA laesa = new LAESA ();
         laesa.Build (db, numpivs, setup.CORES);
         return laesa;
     });
 }