private void menuPredict_Click(object sender, EventArgs e) { try { int i = lbStocks.SelectedIndex; if (i < 0) { return; } StockState state = stockDictionary[Stocks[i]]; state.predict(); } catch (Exception ex) { invoke_AppendLogText(ex.Message); } }
protected void initial() { Stocks = (List <String>)lbStocks.Tag; Task task = Job.getInstance().addTask(Stocks.Count); for (int i = 0; i < Stocks.Count; i++) { StockState stockState = new StockState(Stocks[i]); stockState.loadHistoryData(System.Windows.Forms.Application.StartupPath + Path.DirectorySeparatorChar + Stocks[i] + ".csv"); //BP bpNetwork = new BP(Constants.Input_Days * 4, Constants.Hidden_Layor_Count, Constants.Output_Days * 4); //stockState.neuralMatrix = bpNetwork; String filename = System.Windows.Forms.Application.StartupPath + Path.DirectorySeparatorChar + Stocks[i] + ".data"; stockState.loadNeuralMatrixData(filename); stockDictionary.Add(Stocks[i], stockState); task.process(); } isInitializing = false; }
private void lbStocks_MouseUp(object sender, MouseEventArgs e) { if (isInitializing) { return; } int i = lbStocks.SelectedIndex; if (i < 0) { return; } StockState state = stockDictionary[Stocks[i]]; if (state.predictData != null) { drawDailyK(state.predictData); } }
private void menuTrain_Click(object sender, EventArgs e) { try { int i = lbStocks.SelectedIndex; if (i < 0) { return; } StockState state = stockDictionary[Stocks[i]]; state.initial(); Thread thrd = new Thread(state.training); thrd.Start(); } catch (Exception ex) { invoke_AppendLogText(ex.Message); } }