Exemplo n.º 1
0
        public static TSample ApplyMask <TSample, TObj, TMark>(TSample src, SampleMaskDelegate <TObj, TMark> mask)
            where TSample : MarkedSample <TObj, TMark>, new()
        {
            if (src == null)
            {
                throw new MLException("Source sample is null");
            }

            if (mask == null)
            {
                return(src);
            }

            var result  = new TSample();
            int counter = -1;

            foreach (var item in src)
            {
                counter++;
                if (mask(item.Key, item.Value, counter))
                {
                    result[item.Key] = item.Value;
                }
            }

            return(result);
        }
Exemplo n.º 2
0
            public MaskHandle(AlgorithmBase <TObj> algorithm, SampleMaskDelegate mask)
            {
                if (algorithm == null)
                {
                    throw new MLException("MaskHandle.ctor(algorithm=null)");
                }

                m_Algorithm = algorithm;
                m_Mask      = mask ?? ALL;
            }
Exemplo n.º 3
0
 public MaskHandle ApplySampleMask(SampleMaskDelegate mask)
 {
     m_MaskHandle = new MaskHandle(this, mask);
     return(m_MaskHandle);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Apply mask to the sample
 /// </summary>
 public RegressionSample <TObj> ApplyMask(SampleMaskDelegate <TObj, double> mask)
 {
     return(GeneralUtils.ApplyMask <RegressionSample <TObj>, TObj, double>(this, mask));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Apply mask to the sample
 /// </summary>
 public ClassifiedSample <TObj> ApplyMask(SampleMaskDelegate <TObj, Class> mask)
 {
     return(GeneralUtils.ApplyMask <ClassifiedSample <TObj>, TObj, Class>(this, mask));
 }