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); }
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); }
// 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()); }); } }