Beispiel #1
0
 /// <summary>
 /// 初始化文件目录
 /// </summary>
 private void initFile()
 {
     //TODO
     //解析文字数据---保存在里textParser里面的List中
     textParser = new TextParser(prjPath + "\\text");
     //解析矢量数据----保存在VectorParser里面的List中
     vectorParser = new VectorParser(prjPath + "\\vector");
 }
Beispiel #2
0
    public void HandleInputEntered(string input)
    {
        Vector3 vector;

        if (VectorParser.TryParse(input, out vector))
        {
            AddNewVector(vector);
        }
        else
        {
            Debug.Log("Couldn't parse input: " + input);
        }
    }
 public virtual double[] readInput()
 {
     try
     {
         string inputLine = bufferedReader.readLine();
         if (inputLine != null)
         {
             double[] inputBuffer = VectorParser.parseDoubleArray(inputLine);
             return(inputBuffer);
         }
         return(null);
     }
     catch (IOException ex)
     {
         throw new NeurophInputException("Error reading input from stream!", ex);
     }
 }
Beispiel #4
0
    public void Tests()
    {
        var shouldSucceed = new Dictionary <string, Vector3>
        {
            { "1, 2, 3", new Vector3(1f, 2f, 3f) },
            { "0.1, 0.23; -12", new Vector3(0.1f, 0.23f, -12f) },
            { "1.2; 99 98.34", new Vector3(1.2f, 99.0f, 98.34f) },
            { "-0.1, 0, 0", new Vector3(-0.1f, 0f, 0f) },
            { "1.1 2.2 3.3", new Vector3(1.1f, 2.2f, 3.3f) },
            { "1.2, 3, 4.5  ", new Vector3(1.2f, 3.0f, 4.5f) }
        };

        var shouldFail = new List <string>
        {
            "junk",
            "123451",
            "12.232",
            "",
            "1",
            "1.0, 2.24",
            ".12 .123 .123"
        };

        Vector3 vec;

        foreach (var kvPair in shouldSucceed)
        {
            var success = VectorParser.TryParse(kvPair.Key, out vec);
            Assert.IsTrue(success && vec == kvPair.Value, kvPair.Key);
        }

        foreach (var str in shouldFail)
        {
            var success = VectorParser.TryParse(str, out vec);

            if (success)
            {
                Debug.LogWarningFormat("{0}", vec);
            }

            Assert.IsFalse(success, str);
        }
    }
Beispiel #5
0
 public DataSetRow(List <double> input)
 {
     this.input = VectorParser.toDoubleArray(input);
 }
Beispiel #6
0
 /// <summary>
 /// Creates new training element with specified input and desired output
 /// vectors
 /// </summary>
 /// <param name="input">
 ///            input vector </param>
 /// <param name="desiredOutput">
 ///            desired output vector </param>
 public DataSetRow(List <double> input, List <double> desiredOutput)
 {
     this.input         = VectorParser.toDoubleArray(input);
     this.desiredOutput = VectorParser.toDoubleArray(desiredOutput);
 }
Beispiel #7
0
 /// <summary>
 /// Creates new training element with specified input and desired output
 /// vectors specifed as strings
 /// </summary>
 /// <param name="input"> input vector as space separated string </param>
 /// <param name="desiredOutput"> desired output vector as space separated string </param>
 public DataSetRow(string input, string desiredOutput)
 {
     this.input         = VectorParser.parseDoubleArray(input);
     this.desiredOutput = VectorParser.parseDoubleArray(desiredOutput);
 }