示例#1
0
    public void BackPropSaveLoad1()
    {
        // ARRANGE
        string            path    = Application.dataPath + "/Test/testWeights1.text";
        List <double[][]> weights = new List <double[][]>();

        double[][] w1 = new double[][] {
            new double[] { 1.0, 3.450, 5.34, 7.0, 9.4 },
            new double[] { 0.2, 2.0, 4.0, 6.0, 11.12 }
        };

        weights.Add(w1);

        // ACT
        SaveWeights.WriteToFile(path, weights);

        BackPropWeights prop = new BackPropWeights();

        prop.layers       = new int[] { 5, 2 };
        prop.lengthLayers = 2;

        List <double[][]> weightsSaved = prop.LoadWeights(path);

        // ASSERT
        Assert.That(weightsSaved, Is.EqualTo(weights));
    }
示例#2
0
 //Initialise objects
 void Start()
 {
     Rigidbody = GetComponent <Rigidbody>();
     backProp  = new BackPropNetwork();
     Rigidbody.GetComponent <CarPhysics>().driver = Driver.BackProp;
     controller = new CarController();
     saveLoad   = new BackPropWeights();
     Rigidbody.GetComponent <Sensor>().sensorLenght += 5;
     position = new ResetPosition();
 }
 //Initialise objects
 void Start()
 {
     Rigidbody = GetComponent <Rigidbody>();
     Reset.onClick.AddListener(ResetCurrent);
     Restart.onClick.AddListener(RestartCurrent);
     LearningRate = LearningModeScript.LearningRate;
     NoLaps       = LearningModeScript.NoLaps;
     backProp     = new BackPropNetwork();
     Rigidbody.GetComponent <CarPhysics>().driver = Driver.USER;
     controller = new CarController();
     saveLoad   = new BackPropWeights();
     Rigidbody.GetComponent <Sensor>().sensorLenght += 5;
     position = new ResetPosition();
 }