void CheckIfClearToEnterStation() //called once at the end of journey duration (invoked in Depart) and every time the train is assigned to a new timetable item { if (Time.time >= journeyEndTime && myCurrentTimetableItem != null && myCurrentTimetableItem.platform && !myCurrentTimetableItem.modificationFlag) { SetTrainColor(myCurrentTimetableItem.destination.materialColor); peopleOnBoard.Clear(); if (myCurrentTimetableItem.platform.isLeftHanded) //set the train to be left or right handed according to platform { chiralTrainObjects.transform.rotation = Quaternion.Euler(0f, 180f, 0f); chiralTrainObjects.transform.localPosition = chiralTrainObjects.leftHandedPosition; } else { chiralTrainObjects.transform.rotation = Quaternion.Euler(Vector3.zero); chiralTrainObjects.transform.localPosition = Vector3.zero; } Vector3 trackPosition = transform.position; trackPosition.z = myCurrentTimetableItem.platform.platformSignalTrigger.bounds.center.z + 1f; //pivot of train is off centre by about 1 unit transform.position = trackPosition; direction = Vector3.right; rb.velocity = direction * speed; status = TrainStatus.Arriving; journeyStartTime = 0f; journeyEndTime = 0f; GameUIManager.instance.OnTrainEnterStation(myCurrentTimetableItem); //fade out the timetable UI item GameUIManager.instance.UpdateTrainStatus(this, "Approaching platform..."); } }
void FixedUpdate() { Vector3 newVelocity = rb.velocity; switch (status) //both of these rely on startSpeedX set at the point this status is set { case TrainStatus.Braking: if (rb.velocity.x <= 0.001f) //if we have stopped then open doors { status = TrainStatus.Idle; rb.constraints |= RigidbodyConstraints.FreezePositionX; //Set freeze x position direction = -direction; //change directions because train is at terminal GameUIManager.instance.UpdateTrainStatus(this, "Now boarding..."); OpenDoors(); } else //otherwise we are braking: reduce velocity to zero as we reach target position { Mathf.SmoothDamp(transform.position.x, accelerationTargetX, ref newVelocity.x, 2f, speed, Time.fixedDeltaTime); } break; case TrainStatus.Departing: Mathf.SmoothDamp(transform.position.x, accelerationTargetX, ref newVelocity.x, 2f, speed, Time.fixedDeltaTime); break; } if (rb.velocity != newVelocity) { rb.velocity = newVelocity; } }
internal TrainingDocumentInfo(string documentName, int pages, IReadOnlyList <ErrorInformation> errors, TrainStatus status) { DocumentName = documentName; Pages = pages; Errors = errors; Status = status; }
internal TrainingDocumentInfo(string documentName, int pageCount, IList <FormRecognizerError> errors, TrainStatus status) { DocumentName = documentName; PageCount = pageCount; Errors = errors; Status = status; }
public void New() { Save(); if (Thread != null && Thread.IsAlive) { Thread.Join(); // Wait for last thread to finish working before starting again. } tbName.Text = ""; tbInputs.Text = "82"; tbHiddens.Text = "100"; tbOutputs.Text = "1"; NetworkParameters parameters = new NetworkParameters(); tbLearningRate.Text = parameters.LearningRate.ToString(); tbLearningRateDecay.Text = parameters.LearningRateDecay.ToString(); tbMomentum.Text = parameters.Momentum.ToString(); tbMomentumDecay.Text = parameters.MomentumDecay.ToString(); tbInitialWeightMin.Text = parameters.InitialWeightInterval.Item1.ToString(); tbInitialWeightMax.Text = parameters.InitialWeightInterval.Item2.ToString(); cbTerminationType.Text = "ByValidationSet"; tbIterations.Text = "20000"; tbValidateCycle.Text = "500"; ValidationPlot.Collection.Clear(); TrainingPlot.Collection.Clear(); CurrentErrorHistoryIndex = 0; Status = TrainStatus.Create; lbError.Content = lbIteration.Content = lbTimeElapsed.Content = "0"; }
public TrainStatus GetTrainStatus() { TrainStatus trainStatus = new TrainStatus(); trainStatus.LogoUrl = CtaLogoImageUrl; HtmlWeb client = new HtmlWeb(); HtmlDocument document = client.Load(CtaStatusUrl); if (!ReferenceEquals(document, null) && !ReferenceEquals(document.DocumentNode, null)) { HtmlNode table = document.DocumentNode.SelectNode("//table[@class='tblsystatus']"); if (!ReferenceEquals(table, null)) { HtmlNodeCollection links = table.SelectNodes("tr//a"); foreach (HtmlNode link in links) { string relativeHref = link.Attributes["href"].Value; link.SetAttributeValue("href", "http://www.transitchicago.com" + relativeHref); } trainStatus.Table = table.OuterHtml; trainStatus.IsValid = true; } } return(trainStatus); }
// Use this for initialization void Start() { Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; gameFinished = false; status = TrainStatus.Incoming; fadeImage = GameObject.Find("Canvas/Image").GetComponent <Image>(); FadeIn(); GameObject canvas = GameObject.FindGameObjectWithTag("UICanvas"); canvas.GetComponent <Canvas>().enabled = true; GameObject.Find("Canvas/Result").GetComponent <Text>().enabled = false; playerGoals = GameObject.FindGameObjectsWithTag("ZonePlayerGoal"); foreach (GameObject goal in playerGoals) { goal.GetComponent <MeshRenderer>().enabled = false; } train = GameObject.FindGameObjectWithTag("Train"); GameObject.Find("AmbientSound").GetComponent <AudioSource>().Play(); startTime = Time.time; GameObject.Find("Canvas/NextDay").GetComponent <Text>().enabled = true; }
public async Task <ActionResult> Trainstatus() { IFacesTrainApi facesTrainApi = new FacesTrainApi(); TrainStatus status = await facesTrainApi.TrainStatusAsync(); return(View("Trainstatus", status)); }
void CloseDoors() { animator.SetTrigger("doorClose"); status = TrainStatus.Idle; rb.constraints &= ~RigidbodyConstraints.FreezePositionX; //Remove freeze x position (and let the carriage drift slightly) rb.velocity = -0.01f * speed * direction; Invoke("Depart", 2f); }
public static EmailItemRow Create(TrainStatus item) { EmailItemRow row = new EmailItemRow(); row.Icon = item.LogoUrl; row.Text = item.IsValid ? item.Table : "No data"; return(row); }
void Start() { rb = GetComponent <Rigidbody> (); animator = GetComponent <Animator>(); status = TrainStatus.Parked; doors = GetComponentsInChildren <SphereCollider>().ToArray(); chiralTrainObjects = GetComponentInChildren <ChiralTrainObjects> (); }
void SetBoardingTime() { animator.ResetTrigger("doorOpen"); status = TrainStatus.BoardingTime; myCurrentTimetableItem.platform.OnTrainBoardingTime(this); foreach (SphereCollider doorTrigger in doors) { doorTrigger.enabled = true; } Invoke("CloseDoors", boardingDuration); }
public async Task <TrainStatus> GetStatusAsync(TypeTrain type) { var st = _container.GetLatestStatus(type); ILineTrainService service = type.GetLineTrainService(); var status = await service.GetStatusAsync(); //TODO:状態保管するしくみを作成 var tstatus = new TrainStatus(status, DateTimeOffset.Now, true);; _container.UpdateLatestStatus(type, tstatus); return(tstatus); }
internal TrainingDocumentInfo(string documentName, int pages, IEnumerable <ErrorInformation> errors, TrainStatus status) { if (documentName == null) { throw new ArgumentNullException(nameof(documentName)); } if (errors == null) { throw new ArgumentNullException(nameof(errors)); } DocumentName = documentName; Pages = pages; Errors = errors.ToArray(); Status = status; }
public void OnEnterOutOfStationTrigger() //reset most things apart from journey time etc. { if (status == TrainStatus.Departing) //only want to trigger trains leaving station: Departing status will exclude trains that are inbound to station if they happen to hit the trigger { GameUIManager.instance.OnTrainOutOfStation(myCurrentTimetableItem); GameUIManager.instance.UpdateTrainStatus(this, "Travelling..."); GameManager.instance.OnTrainOutOfStation(myCurrentTimetableItem); myCurrentTimetableItem = null; foreach (GameObject personGO in peopleOnBoard.Select(p => p.gameObject)) { GameManager.instance.AddObjectToDeletionQueue(personGO); } status = TrainStatus.Parked; rb.velocity = Vector3.zero; transform.position = myDockingPoint; } }
internal static TrainingDocumentInfo DeserializeTrainingDocumentInfo(JsonElement element) { string documentName = default; int pages = default; IReadOnlyList <ErrorInformation> errors = default; TrainStatus status = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("documentName")) { documentName = property.Value.GetString(); continue; } if (property.NameEquals("pages")) { pages = property.Value.GetInt32(); continue; } if (property.NameEquals("errors")) { List <ErrorInformation> array = new List <ErrorInformation>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(ErrorInformation.DeserializeErrorInformation(item)); } } errors = array; continue; } if (property.NameEquals("status")) { status = property.Value.GetString().ToTrainStatus(); continue; } } return(new TrainingDocumentInfo(documentName, pages, errors, status)); }
private void btnLoad_Click(object sender, RoutedEventArgs e) { Save(); Microsoft.Win32.OpenFileDialog open = new Microsoft.Win32.OpenFileDialog(); open.Filter = "Neural Network|*.net"; open.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory; open.RestoreDirectory = true; if (open.ShowDialog().Value) { try { Network = (Network)Serializer.Deserialize(open.FileName); PopulateControls(Network); Status = TrainStatus.Paused; Title = Network.Name; } catch { MessageBox.Show("Could not deserialize " + open.FileName.ToString(), "Error"); } } }
public override int GetHashCode() { unchecked { var hashCode = (AtocCode != null ? AtocCode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (AtsCode != null ? AtsCode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)BankHolidayRunning; hashCode = (hashCode * 397) ^ (int)CateringCode; hashCode = (hashCode * 397) ^ (ConnectionIndicator != null ? ConnectionIndicator.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CourseIndicator != null ? CourseIndicator.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (DataSource != null ? DataSource.GetHashCode() : 0); hashCode = (hashCode * 397) ^ DateRunsFrom.GetHashCode(); hashCode = (hashCode * 397) ^ DateRunsTo.GetHashCode(); hashCode = (hashCode * 397) ^ (HeadCode != null ? HeadCode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)OperatingCharacteristics; hashCode = (hashCode * 397) ^ (OperatingCharacteristicsString != null ? OperatingCharacteristicsString.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (PortionId != null ? PortionId.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)PowerType; hashCode = (hashCode * 397) ^ (int)RecordIdentity; hashCode = (hashCode * 397) ^ (int)Reservations; hashCode = (hashCode * 397) ^ (Rsid != null ? Rsid.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)RunningDays; hashCode = (hashCode * 397) ^ (ScheduleLocations != null ? ScheduleLocations.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)SeatingClass; hashCode = (hashCode * 397) ^ (int)ServiceBranding; hashCode = (hashCode * 397) ^ (int)ServiceTypeFlags; hashCode = (hashCode * 397) ^ (int)Sleepers; hashCode = (hashCode * 397) ^ Speed; hashCode = (hashCode * 397) ^ (int)StpIndicator; hashCode = (hashCode * 397) ^ (TimingLoad != null ? TimingLoad.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TrainCategory != null ? TrainCategory.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TrainIdentity != null ? TrainIdentity.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TrainServiceCode != null ? TrainServiceCode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TrainStatus != null ? TrainStatus.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TrainUid != null ? TrainUid.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (UicCode != null ? UicCode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (UniqueId != null ? UniqueId.GetHashCode() : 0); return(hashCode); } }
public void Save() { if (Status == TrainStatus.Create || Network == null) { return; } if (Status == TrainStatus.Running) { Status = TrainStatus.Paused; } if (Thread != null && Thread.IsAlive) { Thread.Join(); // Wait for training thread to finish current training iteration to obtain most up to date network (to save/serialize). } string name = tbName.Text.Trim(); if (!Directory.Exists(name)) { Directory.CreateDirectory(name); } Serializer.Serialize(Network, System.IO.Path.Combine(name, name + "_current.net")); }
public void SetBraking(float stoppingPosX) //if you are going to have global parameters for this then make the targetSpeed in SmoothlyAccelerate global as well....and combine this with the method below { accelerationTargetX = stoppingPosX; status = TrainStatus.Braking; }
static void Main(string[] args) { try { Console.WriteLine("Registering services"); RegisterServices(); List <EmailItemRow> emailItems = new List <EmailItemRow>(); // create cubs row Console.WriteLine("Adding Cubs row"); SportingEvent cubsGame = _sportsService.GetTodaysCubsGame(); emailItems.Add(Mapper.Create(cubsGame)); // create weather row Console.WriteLine("Adding weather forecast row"); WeatherForecast weatherForecast = _weatherService.GetTodaysWeatherForecast(); emailItems.Add(Mapper.Create(weatherForecast)); // create train status row Console.WriteLine("Adding CTA status row"); TrainStatus trainStatus = _transportationService.GetTrainStatus(); emailItems.Add(Mapper.Create(trainStatus)); // initialize email Console.WriteLine("Initializing email"); string to = ConfigurationManager.AppSettings[Constants.AppSettingKeys.Services.Email.To]; string from = ConfigurationManager.AppSettings[Constants.AppSettingKeys.Services.Email.From]; string fromDisplayName = ConfigurationManager.AppSettings[Constants.AppSettingKeys.Services.Email.FromDisplayName]; string html = GetEmailTemplate("EmailTemplates/Base.html"); Console.WriteLine("Replacing email template variables (rows)"); foreach (EmailItemRow emailItem in emailItems) { string rowHtml = GetEmailTemplate("EmailTemplates/ItemRow.html"); rowHtml = rowHtml.Replace("##ICON##", emailItem.Icon); rowHtml = rowHtml.Replace("##TEXT##", emailItem.Text); emailItem.Html = rowHtml; } html = html.Replace("##ITEMROWS##", String.Join( string.Empty, emailItems .Select(item => item.Html) .ToArray())); Console.WriteLine("Sending email"); _emailService.SendEmail( to, from, fromDisplayName, "ESG - Daily Digest Email", html); Console.WriteLine("Program finished"); } catch (Exception ex) { Console.WriteLine(ex.InnerException); Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); Console.WriteLine(ex.Data); } }
// Update is called once per frame void FixedUpdate() { if (Input.GetKeyDown(KeyCode.Escape)) { SceneManager.LoadScene("Credits"); } float vel; switch (status) { case TrainStatus.Incoming: if (Time.time - startTime > 5f) { GameObject.Find("Canvas/NextDay").GetComponent <Text>().enabled = false; } vel = System.Math.Max(minVelocity, System.Math.Abs(train.transform.position.x)); vel = System.Math.Min(vel, 30.0f); train.transform.position += new Vector3(Time.deltaTime * vel * velocityFactor, 0f, 0f); if (train.transform.position.x >= 0f) { startTime = Time.time; status = TrainStatus.DoorsOpening; foreach (GameObject door in GameObject.FindGameObjectsWithTag("Door")) { door.GetComponent <DoorController>().OpenDoor(); door.GetComponent <DoorAudio>().DoorOpening(); } foreach (GameObject enemy in GameObject.FindGameObjectsWithTag("enemy")) { enemy.GetComponent <passenger>().SearchDoor(); } } break; case TrainStatus.DoorsOpening: if (Time.time - startTime > 3f) { startTime = Time.time; status = TrainStatus.Waiting; foreach (GameObject door in GameObject.FindGameObjectsWithTag("Door")) { door.GetComponent <DoorAudio>().DoorShutUp(); } } break; case TrainStatus.Waiting: if (!doorWarning && Time.time - startTime > departureTime - 3f) { foreach (GameObject door in GameObject.FindGameObjectsWithTag("Door")) { door.GetComponent <DoorAudio>().DoorWarning(); } doorWarning = true; } if (Time.time - startTime > departureTime) { startTime = Time.time; status = TrainStatus.DoorsClosing; foreach (GameObject door in GameObject.FindGameObjectsWithTag("Door")) { door.GetComponent <DoorController>().CloseDoor(); door.GetComponent <DoorAudio>().DoorClosing(); } } break; case TrainStatus.DoorsClosing: if (Time.time - startTime > 3f) { startTime = Time.time; status = TrainStatus.Outgoing; foreach (GameObject door in GameObject.FindGameObjectsWithTag("Door")) { door.GetComponent <DoorAudio>().DoorShutUp(); } GameObject.Find("SoundOutgoing").GetComponent <AudioSource>().Play(); } break; case TrainStatus.Outgoing: vel = System.Math.Max(minVelocity, 2f * System.Math.Abs(train.transform.position.x)); vel = System.Math.Min(vel, 30.0f); train.transform.position += new Vector3(Time.deltaTime * vel * velocityFactor, 0f, 0f); if (Time.time - startTime > 5f && !gameFinished) { gameFinished = true; FadeOut(); GameObject.Find("Canvas/NextDay").GetComponent <Text>().enabled = false; GameObject text = GameObject.Find("Canvas/Result"); text.GetComponent <Text>().enabled = true; text.GetComponent <Text>().text = "Better luck tomorrow"; GameObject player = GameObject.FindGameObjectWithTag("Player"); foreach (GameObject zone in playerGoals) { if (player.GetComponent <Collider>().bounds.Intersects( zone.GetComponent <Collider>().bounds )) { text.GetComponent <Text>().text = "Hooray, you made it"; break; } } } if (Time.time - startTime > 9f) { StaticContainer.origin = "game"; SceneManager.LoadScene("MainScene"); } break; default: break; } }
private void btnStart_Click(object sender, RoutedEventArgs e) { try { if (Status == TrainStatus.Running) { Status = TrainStatus.Paused; Save(); return; } if (Thread != null && Thread.IsAlive) { Thread.Join(); // Wait for last thread to finish working before starting again. } Termination termination; if (cbTerminationType.Text == "ByValidationSet") { termination = Termination.ByValidationSet(DataParser.ValidationSet, ToInt(tbValidateCycle, x => x > 0, "Validation cycle must be > 0")); } else if (cbTerminationType.Text == "ByIteration") { termination = Termination.ByIteration(ToInt(tbIterations, x => x > 0, "Iterations must be > 0")); } else { throw new Exception("Did not recognize termination type: " + cbTerminationType.Text); } NetworkParameters parameters = new NetworkParameters() { InitialWeightInterval = new Tuple <double, double>(ToDouble(tbInitialWeightMin), ToDouble(tbInitialWeightMax)), LearningRate = ToDouble(tbLearningRate, x => x > 0, "Learning rate must be > 0"), LearningRateDecay = ToDouble(tbLearningRateDecay), Momentum = ToDouble(tbMomentum, x => x >= 0 && x < 1, "Momentum must be in [0,1)"), MomentumDecay = ToDouble(tbMomentumDecay) }; string name = ToString(tbName, s => s.Trim() != string.Empty, "Network name cannot be empty."); if (Status == TrainStatus.Create && Directory.Exists(name)) { if (MessageBox.Show("Neural Net folder '" + name + "' already exists. Delete contents?\r\nIf not, use a unique name.", "Error", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { (new DirectoryInfo(name)).Delete(true); } else { return; } } if (Status == TrainStatus.Create) { Network = new Network( name, ToInt(tbInputs, x => x > 0, "Number of input nodes must be > 0"), tbHiddens.Text.Split(new char[] { ' ', ',', ';' }, StringSplitOptions.RemoveEmptyEntries).Select(x => ToInt(x, tbHiddens, xx => xx > 0, "Number of hidden nodes must be > 0 per layer")).ToList <int>(), ToInt(tbOutputs, x => x > 0, "Number of output nodes must be > 0"), termination, parameters); } else { Network.Termination.Type = termination.Type; Network.Termination.ValidationSet = termination.ValidationSet; Network.Termination.ValidateCycle = termination.ValidateCycle; Network.Termination.TotalIterations = termination.TotalIterations; Network.Parameters = parameters; Network.Name = name; } Status = TrainStatus.Running; Thread = new Thread(new ThreadStart(DoTrain)) { IsBackground = true }; Thread.Start(); } catch (Exception x) { MessageBox.Show(x.Message, "Error"); } }
public Train(int id) { Id = id; Status = TrainStatus.Idle; }
public static string ToSerialString(this TrainStatus value) => value switch {
void SetDeparting() { accelerationTargetX = GameManager.instance.outOfStationTrigger.bounds.center.x; status = TrainStatus.Departing; }
private void btnStart_Click(object sender, RoutedEventArgs e) { try { if (Status == TrainStatus.Running) { Status = TrainStatus.Paused; Save(); return; } if (Thread != null && Thread.IsAlive) Thread.Join(); // Wait for last thread to finish working before starting again. Termination termination; if (cbTerminationType.Text == "ByValidationSet") termination = Termination.ByValidationSet(DataParser.ValidationSet, ToInt(tbValidateCycle, x => x > 0, "Validation cycle must be > 0")); else if (cbTerminationType.Text == "ByIteration") termination = Termination.ByIteration(ToInt(tbIterations, x => x > 0, "Iterations must be > 0")); else throw new Exception("Did not recognize termination type: " + cbTerminationType.Text); NetworkParameters parameters = new NetworkParameters() { InitialWeightInterval = new Tuple<double, double>(ToDouble(tbInitialWeightMin), ToDouble(tbInitialWeightMax)), LearningRate = ToDouble(tbLearningRate, x => x > 0, "Learning rate must be > 0"), LearningRateDecay = ToDouble(tbLearningRateDecay), Momentum = ToDouble(tbMomentum, x => x >= 0 && x < 1, "Momentum must be in [0,1)"), MomentumDecay = ToDouble(tbMomentumDecay) }; string name = ToString(tbName, s => s.Trim() != string.Empty, "Network name cannot be empty."); if (Status == TrainStatus.Create && Directory.Exists(name)) { if (MessageBox.Show("Neural Net folder '" + name + "' already exists. Delete contents?\r\nIf not, use a unique name.", "Error", MessageBoxButton.YesNo) == MessageBoxResult.Yes) (new DirectoryInfo(name)).Delete(true); else return; } if (Status == TrainStatus.Create) { Network = new Network( name, ToInt(tbInputs, x => x > 0, "Number of input nodes must be > 0"), tbHiddens.Text.Split(new char[] { ' ', ',', ';' }, StringSplitOptions.RemoveEmptyEntries).Select(x => ToInt(x, tbHiddens, xx => xx > 0, "Number of hidden nodes must be > 0 per layer")).ToList<int>(), ToInt(tbOutputs, x => x > 0, "Number of output nodes must be > 0"), termination, parameters); } else { Network.Termination.Type = termination.Type; Network.Termination.ValidationSet = termination.ValidationSet; Network.Termination.ValidateCycle = termination.ValidateCycle; Network.Termination.TotalIterations = termination.TotalIterations; Network.Parameters = parameters; Network.Name = name; } Status = TrainStatus.Running; Thread = new Thread(new ThreadStart(DoTrain)) { IsBackground = true }; Thread.Start(); } catch (Exception x) { MessageBox.Show(x.Message, "Error"); } }
public void Save() { if (Status == TrainStatus.Create || Network == null) return; if (Status == TrainStatus.Running) Status = TrainStatus.Paused; if (Thread != null && Thread.IsAlive) Thread.Join(); // Wait for training thread to finish current training iteration to obtain most up to date network (to save/serialize). string name = tbName.Text.Trim(); if (!Directory.Exists(name)) Directory.CreateDirectory(name); Serializer.Serialize(Network, System.IO.Path.Combine(name, name + "_current.net")); }
public void New() { Save(); if (Thread != null && Thread.IsAlive) Thread.Join(); // Wait for last thread to finish working before starting again. tbName.Text = ""; tbInputs.Text = "82"; tbHiddens.Text = "100"; tbOutputs.Text = "1"; NetworkParameters parameters = new NetworkParameters(); tbLearningRate.Text = parameters.LearningRate.ToString(); tbLearningRateDecay.Text = parameters.LearningRateDecay.ToString(); tbMomentum.Text = parameters.Momentum.ToString(); tbMomentumDecay.Text = parameters.MomentumDecay.ToString(); tbInitialWeightMin.Text = parameters.InitialWeightInterval.Item1.ToString(); tbInitialWeightMax.Text = parameters.InitialWeightInterval.Item2.ToString(); cbTerminationType.Text = "ByValidationSet"; tbIterations.Text = "20000"; tbValidateCycle.Text = "500"; ValidationPlot.Collection.Clear(); TrainingPlot.Collection.Clear(); CurrentErrorHistoryIndex = 0; Status = TrainStatus.Create; lbError.Content = lbIteration.Content = lbTimeElapsed.Content = "0"; }