Neodroid  0.2.0
Machine Learning Environment Prototyping Tool
CategoricalSensor.cs
Go to the documentation of this file.
1 using System.Collections.Generic;
5 using UnityEngine;
6 
7 namespace droid.Runtime.Prototyping.Sensors.Experimental {
11  [AddComponentMenu(SensorComponentMenuPath._ComponentMenuPath
12  + "Categorical"
13  + SensorComponentMenuPath._Postfix)]
14  public class CategoricalSensor : Sensor,
15  IHasSingle {
16  [SerializeField] PrototypingGameObject _categoryProvider = null;
17  [SerializeField] float _observationValue = 0;
18 
19  //void OneHotEncoding() { }
20 
21  /*public override string PrototypingTypeName {
22  get { return "CategoricalSensor"; }
23  }*/
24 
25  public override IEnumerable<float> FloatEnumerable { get { return new[] {this.ObservationValue}; } }
26 
30  public override void UpdateObservation() {
31  if (this._categoryProvider is ICategoryProvider provider) {
32  this.ObservationValue = provider.CurrentCategoryValue;
33  }
34  }
35 
36  public float ObservationValue {
37  get { return this._observationValue; }
38  private set { this._observationValue = value; }
39  }
40 
41  public Space1 SingleSpace { get; }
42  }
43 }