Ejemplo n.º 1
0
    private void TrainModel(System.IntPtr model, double[,] values)
    {
        var nbInputs = values.GetUpperBound(0) - 1;

        for (int y = 0; y < values.GetUpperBound(1); y++)
        {
            double[] inputs   = new double[nbInputs];
            int      expected = 0;

            for (int x = 0; x < values.GetUpperBound(0); x++)
            {
                var value = values[x, y];

                if (x == nbInputs)
                {
                    expected = Convert.ToInt32(value);
                }
                else
                {
                    inputs[x] = value;
                }
            }

            PanebWrapper.classification_train(model, inputs.Length, inputs, expected);
        }
    }
Ejemplo n.º 2
0
    private void TrainModel(System.IntPtr weights)
    {
        for (int i = 0; i < 300; ++i)
        {
            foreach (var sphere in spheres)
            {
                var transform = sphere.GetComponent <Transform>();

                var x        = transform.position.x;
                var z        = transform.position.z;
                var expected = (int)transform.position.y;

                PanebWrapper.classification_train(weights, 2, new double[] { x, z }, expected);
            }
        }
    }