コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ClassificationNetwork"/> class, using the existing <see cref="ClassificationNetwork"/> object.
        /// </summary>
        /// <param name="other">The <see cref="ClassificationNetwork"/> to copy the data from.</param>
        /// <param name="cloneLayers">The value indicating whether the network layers should be cloned.</param>
        private ClassificationNetwork(ClassificationNetwork other, bool cloneLayers)
            : base(other, cloneLayers)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            this.classes.AddRange(other.classes);
            this.allowedClasses.UnionWith(other.allowedClasses);
            this.BlankClass = other.BlankClass;
            this.ConfigureAllowedClasses();
        }
コード例 #2
0
 /// <summary>
 /// Creates a classification neural network from the specified file.
 /// </summary>
 /// <param name="fileName">A string that contains the name of the file from which to create the <see cref="ClassificationNetwork"/>.</param>
 /// <returns>The <see cref="ClassificationNetwork"/> this method creates.</returns>
 public static new ClassificationNetwork FromFile(string fileName)
 {
     return(ClassificationNetwork.FromString(File.ReadAllText(fileName, Encoding.UTF8)));
 }
コード例 #3
0
 /// <summary>
 /// Creates a classification neural network from the specified byte array.
 /// </summary>
 /// <param name="buffer">The buffer to read the <see cref="ClassificationNetwork"/> from.</param>
 /// <returns>The <see cref="ClassificationNetwork"/> this method creates.</returns>
 public static new ClassificationNetwork FromMemory(byte[] buffer)
 {
     return(ClassificationNetwork.FromString(UTF8Encoding.UTF8.GetString(buffer)));
 }
コード例 #4
0
 /// <summary>
 /// Creates a classification neural network from a string that contains network architecture.
 /// </summary>
 /// <param name="architecture">The network architecture.</param>
 /// <param name="classes">The classes the network should able to classify into.</param>
 /// <returns>The <see cref="ClassificationNetwork"/> object this method creates.</returns>
 public static ClassificationNetwork FromArchitecture(string architecture, IList <string> classes)
 {
     return(ClassificationNetwork.FromArchitecture(architecture, classes, classes, null));
 }