Exemplo n.º 1
0
        /// <summary>
        /// Update the object with the given name.
        /// </summary>
        /// <param name="data">The object data</param>
        /// <param name="name">The name of the object to update</param>
        public void UpdateFile(string name, object data)
        {
            DataStorageTag tag = GetStorageTag(name);

            tag["Last Update"] = DateTime.Now;
            UpdateFile(data, tag, name);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Update the file with the given name, with new data storage tag and new data.
        /// </summary>
        /// <param name="data">The object data</param>
        /// <param name="name">The name of the data object</param>
        /// <param name="tag">The storage </param>
        public void UpdateFile(object data, DataStorageTag tag, string name)
        {
            System.IO.FileInfo dataFile = new System.IO.FileInfo(vaultDirectory + "\\" +
                                                                 name + extension);

            if (dataFile.Exists)
            {
                RemoveFile(name);
                AddObject(data, tag, name);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Add a managed object, passing in the object, the storage tag and the object
        /// name as a string.
        /// </summary>
        /// <param name="name">The name used to identify the object</param>
        /// <param name="obj">The object</param>
        /// <param name="tag">The data storage tab</param>
        public void AddObject(object obj, DataStorageTag tag, string name)
        {
            BinaryFormatter bf = new BinaryFormatter();

            System.IO.FileInfo serFile = new System.IO.FileInfo(vaultDirectory + "\\" +
                                                                name + extension);
            System.IO.FileStream fs = serFile.Open(System.IO.FileMode.Create,
                                                   System.IO.FileAccess.Write, System.IO.FileShare.None);

            bf.Serialize(fs, tag);
            bf.Serialize(fs, obj);
            fs.Flush();
            fs.Close();
        }
Exemplo n.º 4
0
 /// <summary>
 /// Saves the network to the pocket if it has a lower error than
 /// the existing version of the network.
 /// </summary>
 /// <param name="network">The network to add to the pocket</param>
 /// <param name="trainer">The trainer training the network</param>
 public void SaveNetwork(Network network, Trainer trainer)
 {
     if (!saved)
     {
         DataStorageTag tag = new DataStorageTag();
         tag.Description     = "Pocket to manage the " + error + " error.";
         tag["last updated"] = trainer.EpochCount;
         tag["error value"]  = trainer.ErrorManager.GetError(error);
         manager.AddObject(network, tag, fileName);
         saved = true;
     }
     else
     {
         DataStorageTag tag = manager.GetStorageTag(fileName);
         tag["last updated"] = trainer.EpochCount;
         tag["error value"]  = trainer.ErrorManager.GetError(error);
         manager.UpdateFile(network, tag, fileName);
     }
     lastUpdateEpoch = trainer.EpochCount;
     lastErrorVal    = trainer.ErrorManager.GetError(error);
 }
Exemplo n.º 5
0
		/// <summary>
		/// Add a new network to the vault.
		/// </summary>
		/// <param name="name">The name of the network</param>
		/// <param name="network">The network</param>
		/// <param name="tag">The storage tag for this network</param>
		public void AddNetwork(Network network, DataStorageTag tag, string name) {
			myManager.AddObject(network, tag, name);
		}
Exemplo n.º 6
0
		/// <summary>
		/// Update the given network and the data storage tag.
		/// </summary>
		/// <param name="name">The name of the network</param>
		/// <param name="network">The network data</param>
		/// <param name="tag">The storage tag to update</param>
		public void UpdateNetwork(Network network, DataStorageTag tag, String name) {
			myManager.UpdateFile(network, tag, name);
		}
Exemplo n.º 7
0
		/// <summary>
		/// Add a managed object, passing in the object, the storage tag and the object
		/// name as a string.
		/// </summary>
		/// <param name="name">The name used to identify the object</param>
		/// <param name="obj">The object</param>
		/// <param name="tag">The data storage tab</param>
		public void AddObject(object obj, DataStorageTag tag, string name) {
			BinaryFormatter bf = new BinaryFormatter();
			System.IO.FileInfo serFile = new System.IO.FileInfo(vaultDirectory + "\\" +
				name + extension);
			System.IO.FileStream fs = serFile.Open(System.IO.FileMode.Create, 
				System.IO.FileAccess.Write, System.IO.FileShare.None);

			bf.Serialize(fs, tag);
			bf.Serialize(fs, obj);
			fs.Flush();
			fs.Close();
		}
Exemplo n.º 8
0
 /// <summary>
 /// Add a new network to the vault.
 /// </summary>
 /// <param name="name">The name of the network</param>
 /// <param name="network">The network</param>
 /// <param name="tag">The storage tag for this network</param>
 public void AddNetwork(Network network, DataStorageTag tag, string name)
 {
     myManager.AddObject(network, tag, name);
 }
Exemplo n.º 9
0
		/// <summary>
		/// Add a new data reader to the vault.
		/// </summary>
		/// <param name="name">The name of the network</param>
		/// <param name="reader">The data reader</param>
		/// <param name="tag">The storage tag for this network</param>
		public void AddNetwork(Neural.Data.DataReader reader, DataStorageTag tag, string name) 
		{
			myManager.AddObject(reader, tag, name);
		}
Exemplo n.º 10
0
 /// <summary>
 /// Add a new data reader to the vault.
 /// </summary>
 /// <param name="name">The name of the network</param>
 /// <param name="reader">The data reader</param>
 /// <param name="tag">The storage tag for this network</param>
 public void AddNetwork(Neural.Data.DataReader reader, DataStorageTag tag, string name)
 {
     myManager.AddObject(reader, tag, name);
 }
Exemplo n.º 11
0
        /// <summary>
        /// Add an object to be managed by the manager, passing in the object and the
        /// name.  The data storage tag is the default data storage tag.
        /// </summary>
        /// <param name="name">The name of the object</param>
        /// <param name="obj">The object to maange</param>
        public void AddObject(object obj, string name)
        {
            DataStorageTag tag = GetStorageTag(name);

            AddObject(obj, tag, name);
        }
Exemplo n.º 12
0
		/// <summary>
		/// Update the result set in the vault with the given storage tag.
		/// </summary>
		/// <param name="data">The result set</param>
		/// <param name="name">The name of the storage tag</param>
		/// <param name="tag">The data storage tag</param>
		public void UpdateDataSet(Neural.ResultSet data, DataStorageTag tag, string name) {
			manager.UpdateFile(data, tag, name);
		}
Exemplo n.º 13
0
		/// <summary>
		/// Adds a result set to the vault with the given storage tag.
		/// </summary>
		/// <param name="data">The result set</param>
		/// <param name="name">The name of throws the result set</param>
		/// <param name="tag">The data storage tag</param>
		public void AddInputData(Neural.ResultSet data, DataStorageTag tag, string name) {
			manager.AddObject(data, tag, name);
		}
Exemplo n.º 14
0
 /// <summary>
 /// Updates the given data file and data storage tag.
 /// </summary>
 /// <param name="eset">The data to update</param>
 /// <param name="name">The name of the data set</param>
 /// <param name="tag">The data storage tag for the data</param>
 public void UpdateDataFile(ExampleSet eset, DataStorageTag tag, String name)
 {
     myManager.UpdateFile(eset, tag, name);
 }
Exemplo n.º 15
0
 /// <summary>
 /// Adds a new example set to the vault with the given name and the given
 /// storage tag.
 /// </summary>
 /// <param name="eset">The example set to store</param>
 /// <param name="name">The name of the example set</param>
 /// <param name="tag">The Data Storage Tag for the example set</param>
 public void AddDataFile(ExampleSet eset, DataStorageTag tag, String name)
 {
     myManager.AddObject(eset, tag, name);
 }
Exemplo n.º 16
0
		/// <summary>
		/// Saves the network to the pocket if it has a lower error than
		/// the existing version of the network.
		/// </summary>
		/// <param name="network">The network to add to the pocket</param>
		/// <param name="trainer">The trainer training the network</param>
		public void SaveNetwork(Network network, Trainer trainer) {
			if(!saved) {
				DataStorageTag tag = new DataStorageTag();
				tag.Description = "Pocket to manage the " + error + " error.";
				tag["last updated"] = trainer.EpochCount;
				tag["error value"] = trainer.ErrorManager.GetError(error);
				manager.AddObject(network, tag, fileName);
				saved = true;
			} 
			else {
				DataStorageTag tag = manager.GetStorageTag(fileName);
				tag["last updated"] = trainer.EpochCount;
				tag["error value"] = trainer.ErrorManager.GetError(error);
				manager.UpdateFile(network, tag, fileName);
			}
			lastUpdateEpoch = trainer.EpochCount;
			lastErrorVal = trainer.ErrorManager.GetError(error);
		}
Exemplo n.º 17
0
 /// <summary>
 /// Updates the given data set and the storage tag.
 /// </summary>
 /// <param name="data">The data set</param>
 /// <param name="name">The name of the data set</param>
 /// <param name="tag">The data storage tag</param>
 public void UpdateDataSet(ArrayList data, DataStorageTag tag, string name)
 {
     manager.UpdateFile(data, tag, name);
 }
Exemplo n.º 18
0
		/// <summary>
		/// Adds a new example set to the vault with the given name and the given
		/// storage tag.
		/// </summary>
		/// <param name="eset">The example set to store</param>
		/// <param name="name">The name of the example set</param>
		/// <param name="tag">The Data Storage Tag for the example set</param>
		public void AddDataFile(ExampleSet eset, DataStorageTag tag, String name) {
			myManager.AddObject(eset, tag, name);
		}
Exemplo n.º 19
0
 /// <summary>
 /// Adds data to the manager.
 /// </summary>
 /// <param name="data">The data to store</param>
 /// <param name="name">The name of the data file</param>
 /// <param name="tag">The data storage tag</param>
 public void AddInputData(ArrayList data, DataStorageTag tag, string name)
 {
     manager.AddObject(data, tag, name);
 }
Exemplo n.º 20
0
		/// <summary>
		/// Updates the given data set and the storage tag.
		/// </summary>
		/// <param name="data">The data set</param>
		/// <param name="name">The name of the data set</param>
		/// <param name="tag">The data storage tag</param>
		public void UpdateDataSet(ArrayList data, DataStorageTag tag, string name) {
			manager.UpdateFile(data, tag, name);
		}
Exemplo n.º 21
0
 /// <summary>
 /// Update the given data reader and the data storage tag.
 /// </summary>
 /// <param name="name">The name of the network</param>
 /// <param name="reader">The data reader configuration</param>
 /// <param name="tag">The storage tag to update</param>
 public void UpdateReader(Neural.Data.DataReader reader, DataStorageTag tag, string name)
 {
     myManager.UpdateFile(reader, tag, name);
 }
Exemplo n.º 22
0
		/// <summary>
		/// Updates the given data file and data storage tag.
		/// </summary>
		/// <param name="eset">The data to update</param>
		/// <param name="name">The name of the data set</param>
		/// <param name="tag">The data storage tag for the data</param>
		public void UpdateDataFile(ExampleSet eset, DataStorageTag tag, String name) {
			myManager.UpdateFile(eset, tag, name);
		}
Exemplo n.º 23
0
 /// <summary>
 /// Update the result set in the vault with the given storage tag.
 /// </summary>
 /// <param name="data">The result set</param>
 /// <param name="name">The name of the storage tag</param>
 /// <param name="tag">The data storage tag</param>
 public void UpdateDataSet(Neural.ResultSet data, DataStorageTag tag, string name)
 {
     manager.UpdateFile(data, tag, name);
 }
Exemplo n.º 24
0
 /// <summary>
 /// Adds a result set to the vault with the given storage tag.
 /// </summary>
 /// <param name="data">The result set</param>
 /// <param name="name">The name of throws the result set</param>
 /// <param name="tag">The data storage tag</param>
 public void AddInputData(Neural.ResultSet data, DataStorageTag tag, string name)
 {
     manager.AddObject(data, tag, name);
 }
Exemplo n.º 25
0
		/// <summary>
		/// Adds data to the manager.
		/// </summary>
		/// <param name="data">The data to store</param>
		/// <param name="name">The name of the data file</param>
		/// <param name="tag">The data storage tag</param>
		public void AddInputData(ArrayList data, DataStorageTag tag, string name) {
			manager.AddObject(data, tag, name);
		}
Exemplo n.º 26
0
		/// <summary>
		/// Update the file with the given name, with new data storage tag and new data.
		/// </summary>
		/// <param name="data">The object data</param>
		/// <param name="name">The name of the data object</param>
		/// <param name="tag">The storage </param>
		public void UpdateFile(object data, DataStorageTag tag, string name) {
			System.IO.FileInfo dataFile = new System.IO.FileInfo(vaultDirectory + "\\" +
				name + extension);
	        
			if(dataFile.Exists) {
				RemoveFile(name);
				AddObject(data, tag, name);
			}
		}
Exemplo n.º 27
0
		/// <summary>
		/// Update the given data reader and the data storage tag.
		/// </summary>
		/// <param name="name">The name of the network</param>
		/// <param name="reader">The data reader configuration</param>
		/// <param name="tag">The storage tag to update</param>
		public void UpdateReader(Neural.Data.DataReader reader, DataStorageTag tag, string name) 
		{
			myManager.UpdateFile(reader, tag, name);
		}
Exemplo n.º 28
0
 /// <summary>
 /// Update the given network and the data storage tag.
 /// </summary>
 /// <param name="name">The name of the network</param>
 /// <param name="network">The network data</param>
 /// <param name="tag">The storage tag to update</param>
 public void UpdateNetwork(Network network, DataStorageTag tag, String name)
 {
     myManager.UpdateFile(network, tag, name);
 }