示例#1
0
        private NetworkDataModel NetworkViewModelToNetworkDataModel(NetworkVM networkVM)
        {
            var defData = new NetworkDataModel();

            if (Guid.TryParse(networkVM.Id, out Guid id))
            {
                defData.Id = id;
            }

            defData.Name = networkVM.Name;
            defData.ActivationFuncName = networkVM.CurrentFunc;
            defData.LearningRate       = networkVM.LearningRate;
            defData.Layers             = networkVM.Layers.Select(l => l.NeuronsCount).ToArray();

            return(defData);
        }
示例#2
0
        public NetworkVM GetViewModel()
        {
            NetworkVM networkVM = new NetworkVM(this)
            {
                Id           = Id.ToString(),
                Layers       = new ObservableCollection <NetworkLayerVM>(Layers.ToLayerViewModels()),
                CurrentFunc  = FuncDictionary.GetFuncName(ActivationFunc),
                LearningRate = LearningRate,
                Name         = Name,
                IsPrototype  = false,
                Generation   = Generation,
                Storageid    = StorageId.ToString()
            };

            return(networkVM);
        }
示例#3
0
        public async void CreateNetwork(NetworkVM networkPrototype, string storageId = null)
        {
            var defData = NetworkViewModelToNetworkDataModel(networkPrototype);
            var network = _factory.CreateInstance(defData);

            if (string.IsNullOrEmpty(storageId))
            {
                storageId = DefaultStorage.Id.ToString();
            }

            network.StorageId = Guid.Parse(storageId);
            var storage = GetStorageModel(storageId);

            storage.AddInstance(network);

            await SaveStorageAsync(storage.Id.ToString());
        }