コード例 #1
0
        public void LoadDataSet(string strDataFile)
        {
            StreamReader reader = null;

            try
            {
                reader = new StreamReader(strDataFile);
                string strTemps = reader.ReadToEnd();
                reader.Close();

                string[] strLines = Regex.Split(strTemps, "\r\n");

                NumPattern  = strLines.Length - 1;
                ArrActuals  = new double[NumPattern][];
                ArrPredicts = new double[NumPattern][];
                ArrPattern  = new double[NumPattern][];

                for (int i = 0; i < NumPattern; i++)
                {
                    string[] strValue = strLines[i].Split(' ');

                    int iTempActual = int.Parse(strValue[0]);
                    ArrActuals[i] = new double[3];
                    switch (iTempActual)
                    {
                    case DOWNTREND:
                        ArrActuals[i][0] = 1;
                        ArrActuals[i][1] = 0;
                        ArrActuals[i][2] = 0;
                        break;

                    case NOTREND:
                        ArrActuals[i][0] = 0;
                        ArrActuals[i][1] = 1;
                        ArrActuals[i][2] = 0;
                        break;

                    case UPTREND:
                        ArrActuals[i][0] = 0;
                        ArrActuals[i][1] = 0;
                        ArrActuals[i][2] = 1;
                        break;
                    }

                    ArrPattern[i] = new double[ANNParameterBUS.InputNode];
                    for (int j = 0; j < ANNParameterBUS.InputNode; j++)
                    {
                        ArrPattern[i][j] = double.Parse(strValue[j + 1].Split(':')[1]);
                    }
                }

                ANNModel = new ANNModelBUS();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        public void LoadDataSet(string strDataFile)
        {
            StreamReader reader = null;

            try
            {
                reader = new StreamReader(strDataFile);

                string strTemp; //= reader.ReadLine();
                //Preprocess = new PreprocessBUS();
                //Preprocess.Min = double.Parse(strTemp.Split(' ')[1]);
                //Preprocess.Max = double.Parse(strTemp.Split(' ')[2]);

                strTemp = reader.ReadToEnd();
                reader.Close();

                string[] strLines = Regex.Split(strTemp, "\r\n");

                //DblActual = new double[2][];
                NumPattern         = strLines.Length - 1;
                DblActual_Forecast = new double[2][];

                DblActual_Forecast[0] = new double[NumPattern];
                DblActual_Forecast[1] = new double[NumPattern];

                ArrPattern = new double[NumPattern][];

                for (int i = 0; i < NumPattern; i++)
                {
                    string[] strValue = strLines[i].Split(' ');

                    //DblActual[i] = new double[1];

                    DblActual_Forecast[0][i] = int.Parse(strValue[0]);

                    ArrPattern[i] = new double[ANNParameterBUS.InputNode];
                    for (int j = 0; j < ANNParameterBUS.InputNode; j++)
                    {
                        ArrPattern[i][j] = double.Parse(strValue[j + 1].Split(':')[1]);
                    }
                }

                ANNModel = new ANNModelBUS();
                ANNModel.LoadModelFile();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
ファイル: ANNTrainBUS.cs プロジェクト: hksonngan/mytesgnikrow
        public void LoadDataSet(double[][] trainingSet)
        {
            NumPattern = trainingSet.Length;
            ArrActual = new double[NumPattern];
            ArrPredict = new double[NumPattern];
            ArrPattern = new double[NumPattern][];

            for (int i = 0; i < NumPattern; i++)
            {
                ArrActual[i] = trainingSet[i][ANNParameterBUS.InputNode];

                ArrPattern[i] = new double[ANNParameterBUS.InputNode];
                for (int j = 0; j < ANNParameterBUS.InputNode; j++)
                {
                    ArrPattern[i][j] = trainingSet[i][j];
                }
            }

            ANNModel = new ANNModelBUS();
        }
コード例 #4
0
ファイル: ANNTrainBUS.cs プロジェクト: hksonngan/mytesgnikrow
        public void LoadDataSet(string strDataFile)
        {
            StreamReader reader = null;

            try
            {
                reader = new StreamReader(strDataFile);
                string strTemp = reader.ReadToEnd();
                reader.Close();

                string[] strLines = Regex.Split(strTemp, "\r\n");

                NumPattern = strLines.Length - 1;
                ArrActual = new double[NumPattern];
                ArrPredict = new double[NumPattern];
                ArrPattern = new double[NumPattern][];

                for (int i = 0; i < NumPattern; i++)
                {
                    string[] strValue = strLines[i].Split(' ');

                    ArrActual[i] = double.Parse(strValue[0]);

                    ArrPattern[i] = new double[ANNParameterBUS.InputNode];
                    for (int j = 0; j < ANNParameterBUS.InputNode; j++ )
                    {
                        ArrPattern[i][j] = double.Parse(strValue[j + 1].Split(':')[1]);
                    }
                }

                ANNModel = new ANNModelBUS();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #5
0
        public void LoadDataSet(string strDataFile)
        {
            StreamReader reader = null;

            try
            {
                reader = new StreamReader(strDataFile);

                string strTemp ;//= reader.ReadLine();
                //Preprocess = new PreprocessBUS();
                //Preprocess.Min = double.Parse(strTemp.Split(' ')[1]);
                //Preprocess.Max = double.Parse(strTemp.Split(' ')[2]);

                strTemp = reader.ReadToEnd();
                reader.Close();

                string[] strLines = Regex.Split(strTemp, "\r\n");

                //DblActual = new double[2][];
                NumPattern = strLines.Length - 1;
                DblActual_Forecast = new double[2][];

                DblActual_Forecast[0] = new double[NumPattern];
                DblActual_Forecast[1] = new double[NumPattern];

                ArrPattern = new double[NumPattern][];

                for (int i = 0; i < NumPattern; i++)
                {
                    string[] strValue = strLines[i].Split(' ');

                    //DblActual[i] = new double[1];

                    DblActual_Forecast[0][i] = int.Parse(strValue[0]);

                    ArrPattern[i] = new double[ANNParameterBUS.InputNode];
                    for (int j = 0; j < ANNParameterBUS.InputNode; j++)
                    {
                        ArrPattern[i][j] = double.Parse(strValue[j + 1].Split(':')[1]);
                    }
                }

                ANNModel = new ANNModelBUS();
                ANNModel.LoadModelFile();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #6
0
        public void LoadDataSet(string strDataFile)
        {
            StreamReader reader = null;

            try
            {
                reader = new StreamReader(strDataFile);
                string strTemps = reader.ReadToEnd();
                reader.Close();

                string[] strLines = Regex.Split(strTemps, "\r\n");

                NumPattern = strLines.Length - 1;
                ArrActuals = new double[NumPattern][];
                ArrPredicts = new double[NumPattern][];
                ArrPattern = new double[NumPattern][];

                for (int i = 0; i < NumPattern; i++)
                {
                    string[] strValue = strLines[i].Split(' ');

                    int iTempActual = int.Parse(strValue[0]);
                    ArrActuals[i] = new double[3];
                    switch (iTempActual)
                    {
                        case DOWNTREND:
                            ArrActuals[i][0] = 1;
                            ArrActuals[i][1] = 0;
                            ArrActuals[i][2] = 0;
                            break;
                        case NOTREND:
                            ArrActuals[i][0] = 0;
                            ArrActuals[i][1] = 1;
                            ArrActuals[i][2] = 0;
                            break;
                        case UPTREND:
                            ArrActuals[i][0] = 0;
                            ArrActuals[i][1] = 0;
                            ArrActuals[i][2] = 1;
                            break;
                    }

                    ArrPattern[i] = new double[ANNParameterBUS.InputNode];
                    for (int j = 0; j < ANNParameterBUS.InputNode; j++)
                    {
                        ArrPattern[i][j] = double.Parse(strValue[j + 1].Split(':')[1]);
                    }
                }

                ANNModel = new ANNModelBUS();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }