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); }
public MaskHandle(AlgorithmBase <TObj> algorithm, SampleMaskDelegate mask) { if (algorithm == null) { throw new MLException("MaskHandle.ctor(algorithm=null)"); } m_Algorithm = algorithm; m_Mask = mask ?? ALL; }
public MaskHandle ApplySampleMask(SampleMaskDelegate mask) { m_MaskHandle = new MaskHandle(this, mask); return(m_MaskHandle); }
/// <summary> /// Apply mask to the sample /// </summary> public RegressionSample <TObj> ApplyMask(SampleMaskDelegate <TObj, double> mask) { return(GeneralUtils.ApplyMask <RegressionSample <TObj>, TObj, double>(this, mask)); }
/// <summary> /// Apply mask to the sample /// </summary> public ClassifiedSample <TObj> ApplyMask(SampleMaskDelegate <TObj, Class> mask) { return(GeneralUtils.ApplyMask <ClassifiedSample <TObj>, TObj, Class>(this, mask)); }