public TargetCategoricalClass(SchemaVariable _variable, Node _node)
 {
     variable = _variable;
     node = _node;
     ClassSd = new SortedList<string, int>();
     Def.Db.TargetCategoricalClassFill(node, ClassSd);
 }
示例#2
0
 public Predictor(SchemaVariable var, Node _node, int predictorLstIdx)
 {
     ChildrenGroups = new ValueGroup(this, 2);
     Variable = var;
     node = _node;
     PredictorLstIdx = predictorLstIdx;
     ValueSd = new SortedList<string,int>();
 }
示例#3
0
 //The variation of the index for this predictor ex:
 //Sex: female, male offset 1 = male
 public PredictorMv(SchemaVariable var, Node _node, int idx, int fieldSpan, int nativeIdx, int offSet, int predictorLstIdx, MvTb MvTb)
 {
     Variable = var;
     N = _node;
     PredMvLstIdx = idx;
     Table = MvTb;
     FieldSpan = fieldSpan;
     NativeIdx = nativeIdx;
     Offset = offSet;
     PredictorLstIdx = predictorLstIdx;
     if (Variable.VariableTypeUserSet == SchemaVariable.VariableTypeEnum.Continuous) {
         LowerNumber = N.PredictorLst[PredictorLstIdx].LowerNumber;
         HigherNumber = N.PredictorLst[PredictorLstIdx].HigherNumber;
     }
 }
示例#4
0
        public bool SchemaFill(Schema sch)
        {
            OdbcCommand cmd = null;
            cmd = new OdbcCommand("select * from  " + Def.DbBsTb + " Limit 1", con);
            SchemaVariable var;
            OdbcDataReader reader = cmd.ExecuteReader();
            bool r = false;
            string typeName;
            try {

                reader.Read();
                for (int x = 0; x < reader.FieldCount; ++x) {
                    var = new SchemaVariable();
                    var.Name = reader.GetName(x).ToLowerInvariant();
                    if (var.Name == Def.DbTableIdName) {
                        continue;
                    }
                    typeName = reader.GetDataTypeName(x).ToLowerInvariant();
                    if (typeName == "float4" || typeName == "float8" || typeName == "real" || typeName == "dbtype_i2" || typeName == "dbtype_i4" || typeName == "dbtype_ui1" || typeName == "dbtype_r8" || typeName == "dbtype_r4" || typeName == "dbtype_numeric" || typeName == "integer" || typeName == "float" || typeName == "numeric" || typeName == "number") {
                        var.DataType = SchemaVariable.DataTypeEnum.Number;
                        var.VariableTypeDetected = SchemaVariable.VariableTypeEnum.Continuous;
                        var.VariableTypeUserSet = SchemaVariable.VariableTypeEnum.Continuous;
                    } else {
                        //if (typeName == "date")
                        //    continue;
                        var.DataType = SchemaVariable.DataTypeEnum.Text;
                        var.VariableTypeDetected = SchemaVariable.VariableTypeEnum.Categorical;
                        var.VariableTypeUserSet = SchemaVariable.VariableTypeEnum.Categorical;
                    }
                    Def.Schema.VariableLst.Add(var);
                    r = true;
                }
            } catch (Exception ex) {
                MessageBox.Show(ex.Message, "Error! in SchemaFill() Database.cs");
            } finally {
                reader.Close();
            }
            return r;
        }