예제 #1
0
        /// <summary>
        /// Sets label ID to all contained vectors
        /// </summary>
        /// <param name="_labelID">The label identifier.</param>
        public void CloseDeploy(Int32 _labelID = -1)
        {
            if (DoAutoSetUnknownLabels && _labelID == -1)
            {
                var vectors             = this.Select(x => x.vector);
                FeatureVectorSet fv_set = new FeatureVectorSet(vectors);
                _labelID = fv_set.GetDominantClass();
            }

            labelID = _labelID;

            foreach (var fv in this)
            {
                fv.labelID = labelID;
            }
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FeatureVectorWithLabelIDSet"/> class.
        /// </summary>
        /// <param name="vectors">The vectors.</param>
        /// <param name="_labelID">The label identifier.</param>
        public void Deploy(String _name, IEnumerable <FeatureVector> vectors, Int32 _labelID = -1)
        {
            name    = _name;
            labelID = _labelID;

            if (vectors != null)
            {
                if (DoAutoSetUnknownLabels && labelID == -1)
                {
                    FeatureVectorSet fv_set = new FeatureVectorSet(vectors);
                    labelID = fv_set.GetDominantClass();
                }

                foreach (var fv in vectors)
                {
                    var fv_id = new FeatureVectorWithLabelID(fv, labelID);
                    Add(fv_id);
                }
            }
        }