Ejemplo n.º 1
0
        /// <summary>
        /// Extracts an item from a given instance by delegating the call to the wrapped mapping.
        /// </summary>
        /// <param name="instanceSource">The source of instances providing the <paramref name="instance"/>.</param>
        /// <param name="instance">The instance to extract the item from.</param>
        /// <returns>The extracted item.</returns>
        public TItem GetItem(SplitInstanceSource <TInstanceSource> instanceSource, TInstance instance)
        {
            if (instanceSource == null)
            {
                throw new ArgumentNullException("instanceSource");
            }

            return(this.mapping.GetItem(instanceSource.InstanceSource, instance));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Retrieves a list of instances from a given instance source.
        /// Dependent on <see cref="SplitInstanceSource{TInstanceSource}.IsTrainingSet"/>, the instances of
        /// the training or test set are returned.
        /// </summary>
        /// <param name="instanceSource">The source to retrieve instances from.</param>
        /// <returns>The list of retrieved instances.</returns>
        public IEnumerable <TInstance> GetInstances(SplitInstanceSource <TInstanceSource> instanceSource)
        {
            if (instanceSource == null)
            {
                throw new ArgumentNullException("instanceSource");
            }

            this.UpdateCachedInstances(instanceSource.InstanceSource);
            return(instanceSource.IsTrainingSet ? this.cachedTrainingSetInstances : this.cachedTestSetInstances);
        }