public static FNode BindNode(FNode Equation, CellVector Bindings, Dictionary<string, int> Map)
        {

            FNode t = Equation.CloneOfMe();
            foreach(KeyValuePair<string,int> kv in Map)
            {
                string name = kv.Key;
                int idx = kv.Value;
                FNode b = new FNodeValue(null, Bindings[idx]);
                t = FNodeCompacter.Bind(t, b, name);
            }

            return t;

        }
Beispiel #2
0
        public override void Invoke()
        {

            // Get data!!!! //

            string name = this._Parameters["@NAME"].Expression.Evaluate().valueSTRING;

            DataSet data = this._Parameters["@DATA"].Data;

            FNodeSet x = this._Parameters["@INPUT"].ExpressionSet;

            int Clusters = (int)this._Parameters["@CLUSTERS"].Expression.Evaluate().INT;

            FNode w = new FNodeValue(null, new Cell(1D));
            if (this._Parameters.Exists("@WEIGHT"))
                w = this._Parameters["@WEIGHT"].Expression;

            int MaxITT = 25;
            if (this._Parameters.Exists("@MAXITT"))
                MaxITT = (int)this._Parameters["@MAXITT"].Expression.Evaluate().valueINT;

            Predicate p = Predicate.TrueForAll;
            if (this._Parameters.Exists("@WHERE"))
                p = new Predicate(this._Parameters["@WHERE"].Expression);

            // Model //
            Thoroughbred.Seabiscut.RowCluster clus = new Thoroughbred.Seabiscut.RowCluster(name, data, p, x, w, Clusters);
            clus.MaxItterations = MaxITT;

            // Fit //
            clus.Render();

            // Push the model to the home heap //
            this.Home.Models.Reallocate(clus.Name, clus);

            // Append the notificiations //
            this.Home.IO.AppendBuffer(clus.Statistics());

        }
Beispiel #3
0
        public override void Invoke()
        {

            // Get data!!!! //
            string name = this._Parameters["@NAME"].Expression.Evaluate().valueSTRING;
            DataSet data = this._Parameters["@DATA"].Data;
            FNodeSet x = this._Parameters["@INPUT"].ExpressionSet;
            FNode y = this._Parameters["@OUTPUT"].Expression;
            FNode w = new FNodeValue(null, new Cell(1D));
            if (this._Parameters.Exists("@WEIGHT"))
                w = this._Parameters["@WEIGHT"].Expression;
            Lambda link = this._Parameters["@LINK"].Lambda;
            int MaxITT = 10;
            if (this._Parameters.Exists("@MAXITT"))
                MaxITT = (int)this._Parameters["@MAXITT"].Expression.Evaluate().valueINT;
            Predicate p = Predicate.TrueForAll;
            if (this._Parameters.Exists("@WHERE"))
                p = new Predicate(this._Parameters["@WHERE"].Expression);

            // Model //
            Thoroughbred.ARizenTalent.GeneralizedLinearModel glm = new Thoroughbred.ARizenTalent.GeneralizedLinearModel(name, data, p, y, x, w, link);
            glm.MaximumIterations = MaxITT;
            glm.Render();

            // Push the model to the home heap //
            //RecordSet rs1 = glm.ParameterData;
            //RecordSet rs2 = glm.ModelData;
            //this.Home.ChunkHeap.Reallocate(rs1.Name, rs1);
            //this.Home.ChunkHeap.Reallocate(rs2.Name, rs2);
            //this.Home.Lambdas.Reallocate(glm.Name + "_LINK", link);
            this.Home.Models.Reallocate(glm.Name, glm);

        }
Beispiel #4
0
        public override void Invoke()
        {

            // Get data!!!! //
            string name = this._Parameters["@NAME"].Expression.Evaluate().valueSTRING;
            DataSet data = this._Parameters["@DATA"].Data;
            FNode x = this._Parameters["@INPUT"].Expression;
            FNode y = this._Parameters["@OUTPUT"].Expression;
            FNode w = new FNodeValue(null, new Cell(1D));
            if (this._Parameters.Exists("@WEIGHT"))
                w = this._Parameters["@WEIGHT"].Expression;
            Cell scale = new Cell(10D);
            if (this._Parameters.Exists("@SCALE"))
                scale = this._Parameters["@SCALE"].Expression.Evaluate();
            int MaxITT = 10;
            if (this._Parameters.Exists("@MAXITT"))
                MaxITT = (int)this._Parameters["@MAXITT"].Expression.Evaluate().valueINT;
            bool Strict = false;
            if (this._Parameters.Exists("@STRICT"))
                Strict = this._Parameters["@STRICT"].Expression.Evaluate().valueBOOL;
            Predicate p = Predicate.TrueForAll;
            if (this._Parameters.Exists("@WHERE"))
                p = new Predicate(this._Parameters["@WHERE"].Expression);

            // Model //
            Thoroughbred.ARizenTalent.NonlinearRegressionModel nlm = new Thoroughbred.ARizenTalent.NonlinearRegressionModel(name, data, p, y, x, w);
            nlm.Scale = scale;
            nlm.MaximumIterations = MaxITT;
            nlm.IsStrict = Strict;
            if (this._Parameters.Exists("@BETA"))
                nlm.Beta = this._Parameters["@BETA"].Matrix.Evaluate().ToVector;

            // Fit //
            nlm.Render();

            // Push the model to the home heap //
            //RecordSet rs1 = nlm.ParameterData;
            //RecordSet rs2 = nlm.ModelData;
            //this.Home.ChunkHeap.Reallocate(rs1.Name, rs1);
            //this.Home.ChunkHeap.Reallocate(rs2.Name, rs2);
            this.Home.Models.Reallocate(nlm.Name, nlm);

        }
Beispiel #5
0
        public override void Invoke()
        {

            // Get data!!!! //
            string name = this._Parameters["@NAME"].Expression.Evaluate().valueSTRING;
            DataSet data = this._Parameters["@DATA"].Data;
            FNodeSet x = this._Parameters["@INPUT"].ExpressionSet;
            FNode y = this._Parameters["@OUTPUT"].Expression;

            FNode w = new FNodeValue(null, new Cell(1D));
            if (this._Parameters.Exists("@WEIGHT"))
                w = this._Parameters["@WEIGHT"].Expression;

            Predicate p = Predicate.TrueForAll;
            if (this._Parameters.Exists("@WHERE"))
                p = new Predicate(this._Parameters["@WHERE"].Expression);

            int threads = 1;
            if (this._Parameters.Exists("@PARTITIONS"))
                threads = (int)this._Parameters["@PARTITIONS"].Expression.Evaluate().valueINT;

            // Model //
            Thoroughbred.ARizenTalent.LinearRegression lm = new Thoroughbred.ARizenTalent.LinearRegression(name, data, p, y, x, w);
            if (threads == 1)
            {
                lm.Render();
            }
            else
            {
                lm.PartitionedRender(threads);
            }

            // Push the model to the home heap //
            //RecordSet rs1 = lm.ParameterData;
            //RecordSet rs2 = lm.ModelData;
            //this.Home.ChunkHeap.Reallocate(rs1.Name, rs1);
            //this.Home.ChunkHeap.Reallocate(rs2.Name, rs2);
            this.Home.Models.Reallocate(lm.Name, lm);
            this.Home.IO.AppendBuffer(lm.Statistics());

        }