public override IEnumerable <Value> Eval(IEnumerable <Value> args) { foreach (Value v in child.Eval(args)) { if (!(v is Frame)) { throw new InvalidOperationException("BoxCox only works on frames"); } Frame f = v as Frame; Frame r = new Frame(); for (int i = 0; i < f.Columns.Count(); i++) { Vector vec = f.Columns[i]; if (!(vec is Numeric)) { throw new InvalidOperationException("BoxCox only works on numeric variables"); } Numeric n = vec as Numeric; List <double> l = evaluate(n.vector).ToList(); r.Columns.Add(new Numeric(l, evaluate(n.Domain))); r.Symbols.Add(new Symbol(MakeName(f.Symbols[i].Name))); } yield return(r); } }
public override IEnumerable <Value> Eval(IEnumerable <Value> args) { foreach (Value v in lhs.Eval(args)) { if (!(v is Frame)) { throw new InvalidOperationException("Formula must get frames"); } foreach (Frame r in Cross(args, 0)) { yield return(new ModelFrame(v as Frame, r, labels.Eval(args) as Frame)); } } }