コード例 #1
0
    private static void RunTutorPersonalityTest(Emotivector emotivector)
    {
        Tutor joao  = new Tutor("Joao");
        Tutor maria = new Tutor("Maria");

        joao.Personality = new ExpectancyPersonality(new Emotion[3, 6]
        {
            {
                /* Negative */
                new Emotion(EmotionEnum.Anger, .5f),
                new Emotion(EmotionEnum.Neutral, 1f),
                new Emotion(EmotionEnum.Surprise, .2f),
                new Emotion(EmotionEnum.Anger, .2f),
                new Emotion(EmotionEnum.Neutral, 1f),
                new Emotion(EmotionEnum.Surprise, .8f)
            },
            {
                /* Neutral */
                new Emotion(EmotionEnum.Sadness, .3f),
                new Emotion(EmotionEnum.Neutral, 1f),
                new Emotion(EmotionEnum.Happiness, .6f),
                new Emotion(EmotionEnum.Sadness, .2f),
                new Emotion(EmotionEnum.Neutral, 1f),
                new Emotion(EmotionEnum.Happiness, .8f)
            },
            {
                /* Positive */
                new Emotion(EmotionEnum.Sadness, .2f),
                new Emotion(EmotionEnum.Neutral, 1f),
                new Emotion(EmotionEnum.Happiness, .2f),
                new Emotion(EmotionEnum.Sadness, .2f),
                new Emotion(EmotionEnum.Neutral, 1f),
                new Emotion(EmotionEnum.Happiness, 1f)
            }
        });
        maria.Personality = joao.Personality;

        var emotivectorAppraisal = new EmotivectorAppraisal();
        var updater = new ValuesCheckAffectiveUpdater {
            Emotivector = emotivector
        };

        emotivectorAppraisal.AddUpdater(updater);
        IAffectiveAppraisal appraisal = emotivectorAppraisal;

        Debug.Log(joao.Emotion);
        emotivector.AddValue(.65f);
        appraisal.ComputeUserEmotion(null, null);
        appraisal.ComputeTutorEmotion(null, null, joao);
        Debug.Log(joao.Emotion);
        emotivector.AddValue(.4f);
        appraisal.ComputeUserEmotion(null, null);
        appraisal.ComputeTutorEmotion(null, null, joao);
        Debug.Log(joao.Emotion);
    }
コード例 #2
0
    public override Emotivector Update(History history, User user)
    {
        if (Emotivector == null)
        {
            return(null);
        }

        var state = PersistentDataStorage.Instance.GetState();
        // TODO HACK
        JSONArray values = state[Name].AsArray;

        if (_count < values.Count)
        {
            int i;
            for (i = _count; i < values.Count - 1; i++)
            {
                Emotivector.AddValue(MathUtils.Normalize(values[i], Min, Max));
                Emotivector.Predict();
            }

            // Don't predict the last addition
            Emotivector.AddValue(MathUtils.Normalize(values[i], Min, Max));
            _count = values.Count;

            return(Emotivector);
        }

        return(null);
    }
コード例 #3
0
    public override Emotivector Update(History history, User user)
    {
        if (Emotivector == null)
        {
            return(null);
        }

        var values = GetListFromValues();

        if (_count < values.Count)
        {
            int i;
            for (i = _count; i < values.Count - 1; i++)
            {
                Emotivector.AddValue(MathUtils.Normalize(values[i], Min, Max));
                Emotivector.Predict();
            }

            // Don't predict the last addition
            Emotivector.AddValue(MathUtils.Normalize(values[i], Min, Max));
            _count = values.Count;

            return(Emotivector);
        }

        return(null);
    }
コード例 #4
0
    // Use this for initialization
    void Start()
    {
        if (_valueInput == null || _expectedValuePrefab == null || _content == null || _valueInput == null ||
            _addPredictButton == null || _expectancyLog == null)
        {
            Debug.LogWarning("Some of the needed prefabs or components are NULL. This object may not work properly!");
        }

        if (_addPredictButton != null)
        {
            _addPredictButton.onClick.AddListener(delegate
            {
                if (_emotivector == null)
                {
                    Debug.LogWarning("Emotivector is NULL");
                    return;
                }

                float value = Convert.ToSingle(_valueInput.text);
                _emotivector.AddValue(value);
                _expectancyLog.text = _emotivector.ComputeExpectancy().ToString();
                _emotivector.Predict();
                UpdateGraph();

                Debug.Log("Last Prediction Value: " + _emotivector.GetPredictions().Last());
            });
        }
    }