/// <summary> /// Normalize a row vector using Z-Score normalization on the supplied feature properties. /// </summary> /// <param name="row"></param> /// <param name="properties"></param> /// <returns></returns> public Vector Normalize(Vector row, Summary properties) { if (row == null) { throw new ArgumentNullException("Row was null"); } double[] item = new double[row.Length]; for (int i = 0; i < row.Length; i++) { item[i] = (row[i] - properties.Average[i]); } return item; }
/// <summary> /// Converts the state vector into an MDP state. /// </summary> /// <param name="state">State vector.</param> /// <param name="summary">Feature properties from the original set.</param> /// <param name="discretizer">Discretization function for generating unique state identifiers.</param> /// <returns>MDPState.</returns> public static MDPState GetState(Vector state, Summary summary, IDiscretizer discretizer) { return new MDPState((int)discretizer.Discretize(state, summary)) { Features = state }; }