Пример #1
0
    public void PredictCross()
    {
        if (this.model == null)
        {
            Debug.Log("Create model before");
            return;
        }

        // Call lib to predict test spheres
        foreach (var testSphere in testSpheres)
        {
            var position            = testSphere.position;
            var transformedPosition = TransformCross(position);

            double[] inputs    = { transformedPosition.x, transformedPosition.z };
            var      predicted = LinearClassification.linear_model_predict_classification(this.model.Value, 2, inputs);

            position = new Vector3(
                position.x,
                predicted * (float)0.5,
                position.z
                );

            testSphere.position = position;
        }
    }
Пример #2
0
    public void PredictXor()
    {
        if (this.model == null)
        {
            Debug.Log("Create model before");
            return;
        }

        // Call lib to predict test spheres
        foreach (var testSphere in testSpheres)
        {
            var      position  = testSphere.position;
            double[] inputs    = { Math.Pow(position.x + position.z, 2) };
            var      predicted = LinearClassification.linear_model_predict_classification(this.model.Value, 1, inputs);

            position = new Vector3(
                position.x,
                predicted * (float)0.5,
                position.z
                );

            testSphere.position = position;
        }

        Debug.Log("Predicted");
    }