Пример #1
0
    ClassificationTraining createTrainingConfiguration()
    {
        ClassificationTraining c = new ClassificationTraining();

        c.NbElements = targetTransforms.Length;
        c.NbInputs   = 2;

        c.TrainingExemples = new double[c.NbElements * c.NbInputs];
        c.ExpectedResults  = new int[c.NbElements];

        for (int i = 0; i < targetMeshRenderers.Length; ++i)
        {
            MeshRenderer mr = targetMeshRenderers[i].GetComponent <MeshRenderer>();
            if (mr.material.color == redMat.color)
            {
                Transform t = targetTransforms[i].GetComponent <Transform>();
                c.TrainingExemples[i * c.NbInputs]     = t.position.x;
                c.TrainingExemples[i * c.NbInputs + 1] = t.position.z;
                c.ExpectedResults[i] = 1;
            }
            if (mr.material.color == blueMat.color)
            {
                Transform t = targetTransforms[i].GetComponent <Transform>();
                c.TrainingExemples[i * c.NbInputs]     = t.position.x;
                c.TrainingExemples[i * c.NbInputs + 1] = t.position.z;
                c.ExpectedResults[i] = -1;
            }
        }

        c.MaxIteration = 100000;

        return(c);
    }
Пример #2
0
    void ClassificationScenario(ClassificationTraining c, System.IntPtr model, int[] inputneuro)
    {
        //printModel(model);

        trainMLP(c.TrainingExemples, c.NbElements, c.ExpectedResults, model, inputneuro, inputneuro.Length, c.MaxIteration, 0.01);

        //printModel(model);

        adjustPlan(model, c.NbInputs, inputneuro);

        //removeModel(model);
    }