// can return null if norms aren't stored
 protected internal virtual byte[] GetNorms(System.String field)
 {
     lock (this)
     {
         Norm norm = (Norm)norms[field];
         if (norm == null)
         {
             return(null);                    // not indexed, or norms not stored
         }
         lock (norm)
         {
             if (norm.bytes == null)
             {
                 // value not yet read
                 byte[] bytes = new byte[MaxDoc()];
                 Norms(field, bytes, 0);
                 norm.bytes = bytes;                         // cache it
                 // it's OK to close the underlying IndexInput as we have cached the
                 // norms and will never read them again.
                 norm.Close();
             }
             return(norm.bytes);
         }
     }
 }
Exemple #2
0
        public void Finish()
        {
            Finished = true;

            Task.WaitAll(Writer);

            File.Close();

            if (Setup)
            {
                //Write Mean
                float[] mean = new float[Statistics.Length];
                for (int i = 0; i < mean.Length; i++)
                {
                    mean[i] = Statistics[i].Mean();
                }
                Norm.WriteLine(String.Join(Separator, Array.ConvertAll(mean, x => x.ToString(Accuracy))));

                //Write Std
                float[] std = new float[Statistics.Length];
                for (int i = 0; i < std.Length; i++)
                {
                    std[i] = Statistics[i].Std();
                }
                Norm.WriteLine(String.Join(Separator, Array.ConvertAll(std, x => x.ToString(Accuracy))));
            }

            Norm.Close();
        }
Exemple #3
0
        public void Finish()
        {
            if (Labels != null)
            {
                for (int i = 0; i < Names.Length; i++)
                {
                    Labels.WriteLine("[" + i + "]" + " " + Names[i]);
                }
                Labels.Close();
            }

            if (File != null)
            {
                File.Close();
            }

            if (Norm != null)
            {
                string mean = string.Empty;
                for (int i = 0; i < Mean.Length; i++)
                {
                    mean += Mean[i].Mean().ToString(Accuracy) + Separator;
                }
                mean = mean.Remove(mean.Length - 1);
                mean = mean.Replace(",", ".");
                Norm.WriteLine(mean);

                string std = string.Empty;
                for (int i = 0; i < Std.Length; i++)
                {
                    std += (Std[i].Std() / Weights[i]).ToString(Accuracy) + Separator;
                }
                std = std.Remove(std.Length - 1);
                std = std.Replace(",", ".");
                Norm.WriteLine(std);

                Norm.Close();
            }
        }