public GeneralizedLinearModel(string Name, DataSet Data, Predicate Where, FNode Expected, FNodeSet Actual, FNode Weight, Lambda LinkFunction) : base(Name, Data, Where, Expected, Actual, Weight) { int val = IsCorrectLink(LinkFunction); if (val == -1) throw new Exception("Link function must have exactly one argument"); else if (val == -2) throw new Exception("Link function is not differentiable"); this._Link = LinkFunction; }
// Lambdas // public static Lambda RenderLambda(Workspace Home, HScriptParser.LambdaGenericContext context) { // Get the name // string name = context.IDENTIFIER()[0].GetText(); // Get all the pointers // List<string> pointers = new List<string>(); for (int i = 1; i < context.IDENTIFIER().Count; i++) { string var_name = context.IDENTIFIER()[i].GetText(); pointers.Add(var_name); } // Get the expression // PointerExpressionVisitor pev = new PointerExpressionVisitor(pointers, Home); // Build the node // FNode node = pev.ToNode(context.expression()); // Build the lambda // Lambda mu = new Lambda(name, node, pointers); return mu; }
public HParameter(Lambda Value) { this._affinity = HParameterAffinity.Lambda; this._lambda = Value; }
public void Add(string Name, Lambda Value) { this.Add(Name, new HParameter(Value)); }
// Statics // /// <summary> /// Tests a lambda to determine if it is a valid link function /// (1). The lambda must have exactly one pointer node /// (2). The lambda must be differentiable /// </summary> /// <param name="Link">A lambda that represents a link function</param> /// <returns></returns> public static int IsCorrectLink(Lambda Link) { // Check for one DISTINCT pointer // if (Link.Pointers.Count != 1) return -1; // Check that the link function is differntiable // string pointer = Link.Pointers.First(); if (!Link.IsDifferntiable(pointer)) return -2; // Return // return 0; }
public GeneralizedLinearModel(string Name, DataSet Data, Predicate Where, FNode Expected, FNodeSet Actual, Lambda LinkFunction) : this(Name, Data, Where, Expected, Actual, FNodeFactory.Value(1D), LinkFunction) { }
public LambdaPlan(Heap<Lambda> Heap, string Name, Lambda Expression) :base() { this._heap = Heap; this._name = Name; this._lambda = Expression; this.Name = "LAMBDA"; }