⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tddtinducer.java

📁 Decision Tree 决策树算法ID3 数据挖掘 分类
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
   cgraph = aCgraph; // save this until we actually construct the tree.
   decisionTreeCat = null;
   totalInstWeight = -1; // illegal value.

   // this is arbitrary - no schema yet
   haveContinuousAttributes = false;

   tddtOptions.maxLevel = DEFAULT_MAX_LEVEL;
   tddtOptions.lowerBoundMinSplitWeight = DEFAULT_LB_MSW;
   tddtOptions.upperBoundMinSplitWeight = DEFAULT_UB_MSW;
   tddtOptions.minSplitWeightPercent = DEFAULT_MS_WP;
   tddtOptions.nominalLBoundOnly = DEFAULT_NOM_LBO;
   tddtOptions.debug = DEFAULT_DEBUG;
   tddtOptions.unknownEdges = DEFAULT_UNKNOWN_EDGES;
   tddtOptions.splitScoreCriterion =  SplitScore.defaultSplitScoreCriterion;
   tddtOptions.emptyNodeParentDist = DEFAULT_EMPTY_NODE_PARENT_DIST;
   tddtOptions.parentTieBreaking = DEFAULT_PARENT_TIE_BREAKING;
   tddtOptions.pruningMethod = DEFAULT_PRUNING_METHOD;
   tddtOptions.pruningBranchReplacement = DEFAULT_PRUNING_BRANCH_REPLACEMENT;
   tddtOptions.adjustThresholds = DEFAULT_ADJUST_THRESHOLDS;
   tddtOptions.pruningFactor = DEFAULT_PRUNING_FACTOR;
   tddtOptions.contMDLAdjust = DEFAULT_CONT_MDL_ADJUST;
   tddtOptions.smoothInst = DEFAULT_SMOOTH_INST;
   tddtOptions.smoothFactor = DEFAULT_SMOOTH_FACTOR;
   tddtOptions.leafDistType = defaultLeafDistType;
   tddtOptions.MEstimateFactor = DEFAULT_LEAF_M_ESTIMATE_FACTOR;
   tddtOptions.evidenceFactor = DEFAULT_LEAF_EVIDENCE_FACTOR;
   tddtOptions.evaluationMetric = DEFAULT_EVALUATION_METRIC;
}

   /** Copy constructor.
    * @param source	The TDDTInducer that is being copied.
    */
   public TDDTInducer(TDDTInducer source)
   {
      super(source);
      cgraph = null;
      decisionTreeCat = null;
      set_level(source.get_level());
      copy_options(source);
      set_total_inst_weight(source.get_total_inst_weight());

      haveContinuousAttributes = source.haveContinuousAttributes;
   }

   /** Sets the level of this TDDTInducer.
    * @param lvl The level to be set.
    */
   public void set_level(int lvl) { level = lvl;}

   /** Returns the level set for this TDDTInducer.
    * @return This TDDTInducer's level setting.
    */
   public int get_level() {return level;}

   /** Sets the total weight of instances in the data set this inducer is currently
    * using.
    * @param wt	The weight that should be set.
    */
   protected void set_total_inst_weight(double wt){ totalInstWeight = wt;}

   /** Returns the total weight of instances in the data set this inducer is using.
    * @return The weight of the instances.
    */
   protected double get_total_inst_weight(){ return totalInstWeight;}

   /** Returns the maximum level which may be set for a TDDTInducer.
    * @return The maximum weight of instances.
    */
   public int get_max_level(){return tddtOptions.maxLevel;}

   /** Sets the maximum level for a TDDTInducer.
    * @param level The new maximum level.
    */
   public void set_max_level(int level){tddtOptions.maxLevel = level;}

   /** Sets the lower bound for minimum split weight.
    * @param val The new lower bound.
    */
   public void set_lower_bound_min_split_weight(double val)
      {  tddtOptions.lowerBoundMinSplitWeight = val; }

   /** Returns the lower bound for minimum split weight.
    * @return The lower bound for minimum split weight.
    */
   public double get_lower_bound_min_split_weight()
      {  return tddtOptions.lowerBoundMinSplitWeight; }

   /** Sets the upper bound for minimum split weight.
    * @param val The new upper bound.
    */
   public void set_upper_bound_min_split_weight(double val)
      {   tddtOptions.upperBoundMinSplitWeight = val; }

   /** Returns the upper bound for minimum split weight.
    * @return The upper bound for minimum split weight.
    */
   public double get_upper_bound_min_split_weight()
      {   return tddtOptions.upperBoundMinSplitWeight; }

   /** Sets a new percentage value for minimum split weight.
    * @param val The new percentage.
    */
   public void set_min_split_weight_percent(double val)
      {   tddtOptions.minSplitWeightPercent = val; }

   /** Returns the percentage value for minimum split weight.
    * @return The percentage value for minimum split weight.
    */
   public double get_min_split_weight_percent()
      {   return tddtOptions.minSplitWeightPercent; }

   /** Sets which lower bounds are used for nominal attributes. TRUE indicates
    * lowerBoundMinSplitWeight, upperBoundMinSplitWeight, and minSplitWeightPercent
    * are not used for setting minimum instances in a node for nominal attributes,
    * FALSE indicates they will be used.
    * @param val The value for the boolean option.
    */
   public void set_nominal_lbound_only(boolean val)
      { tddtOptions.nominalLBoundOnly = val; }

   /** Returns TRUE if lower bounds are to be used for nominal values, FALSE otherwise.
    * @return TRUE indicates lowerBoundMinSplitWeight, upperBoundMinSplitWeight, and
    * minSplitWeightPercent are not used for setting minimum instances in a node for
    * nominal attributes, FALSE indicates they will be used.
    */
   public boolean get_nominal_lbound_only() 
      { return tddtOptions.nominalLBoundOnly; }

   /** Sets whether unknown categories are allowable for edges if the decision tree.
    * @param val TRUE if unknown edges are allowable, FALSE otherwise.
    */
   public void set_unknown_edges(boolean val) {tddtOptions.unknownEdges = val;}

   /** Returns whether unknown edges are allowed.
    * @return TRUE if unknown edges are allowable, FALSE otherwise.
    */
   public boolean get_unknown_edges() { return tddtOptions.unknownEdges; }

   /** Return the criterion used for scoring.
    * @return The split score criterion.
    */
   public byte get_split_score_criterion() 
      {return tddtOptions.splitScoreCriterion; }

   /** Sets the criterion used for split scoring.
    * @param val The new split score criterion.
    */
   public void set_split_score_criterion(byte val)
      {tddtOptions.splitScoreCriterion = val; }

   /** Sets whether an empty node should have the parent's distribution.
    * @param b TRUE indicates an empty node should have the parent's distribution,
    * FALSE otherwise.
    */
   public void set_empty_node_parent_dist(boolean b)
      {tddtOptions.emptyNodeParentDist = b; }

   /** Returns whether an empty node should have the parent's distribution.
    * @return TRUE indicates an empty node should have the parent's distribution,
    * FALSE otherwise.
    */
   public boolean get_empty_node_parent_dist()
      {return tddtOptions.emptyNodeParentDist; }

   /** Set the tie breaking order for distribution ties.
    * @param b the new order for breaking distribution ties.
    */
   public void set_parent_tie_breaking(boolean b)
      {tddtOptions.parentTieBreaking = b; }

   /** Get the order for breaking distribution ties.
    * @return Order for breaking distribution ties.
    */
   public boolean get_parent_tie_breaking()
      {return tddtOptions.parentTieBreaking; }

    /** Sets the Pruning method to be used.
     * @param pM The Pruning method to be used. If the value is not NONE and pruning_factor is 0,
     * then a node will be made a leaf when its (potential) children do not improve
     * the error count.
     */
   public void set_pruning_method(byte pM)
      {tddtOptions.pruningMethod = pM; }

   /** Returns the Pruning method to be used.
    * @return The Pruning method used.
    */
   public byte get_pruning_method()
      {return tddtOptions.pruningMethod; }

   /** Sets whether pruning should allow replacing a node with its largest subtree.
    * @param b TRUE indicates pruning should allow replacing a node with its largest subtree,
    * FALSE otherwise.
    */
   public void set_pruning_branch_replacement(boolean b)
      {tddtOptions.pruningBranchReplacement = b; }

   /** Returns whether pruning should allow replacing a node with its largest subtree.
    * @return TRUE indicates pruning should allow replacing a node with its largest subtree,
    * FALSE otherwise.
    */
   public boolean get_pruning_branch_replacement() 
      {return tddtOptions.pruningBranchReplacement; }

   /** Sets whether threshold should be adjusted to equal instance values.
    * @param b TRUE indicates threshold should be adjusted to equal instance values, FALSE otherwise.
    */
   public void set_adjust_thresholds(boolean b)
      {tddtOptions.adjustThresholds = b; }

   /** Returns whether threshold should be adjusted to equal instance values.
    * @return TRUE indicates threshold should be adjusted to equal instance values, FALSE otherwise.
    */
   public boolean get_adjust_thresholds() 
      {return tddtOptions.adjustThresholds; }

   /** Sets the factor of how much pruning should be done.
    * @param val Factor of how much pruning should be done. High values indicate more pruning.
    */
   public void set_pruning_factor(double val)
      { tddtOptions.pruningFactor = val; }

   /** Returns the factor of how much pruning should be done.
    * @return Factor of how much pruning should be done. High values indicate more pruning.
    */
   public double get_pruning_factor() 
      { return tddtOptions.pruningFactor; }

   /** Returns the number of thresholds on either side to use for smoothing.
    * @return Number of thresholds on either side to use for smoothing; 0 for no smoothing.
    */
   public int get_smooth_inst() { return tddtOptions.smoothInst; }

   /** Sets the number of thresholds on either side to use for smoothing.
    * @param inst Number of thresholds on either side to use for smoothing; 0 for no smoothing.
    */
   public void set_smooth_inst(int inst) { tddtOptions.smoothInst = inst; }

   /** Returns the exponential factor for smoothing.
    * @return The exponential factor for smoothing.
    */
   public double get_smooth_factor() { return tddtOptions.smoothFactor; }

    /** Sets the exponential factor for smoothing.
     * @param factor The new exponential factor for smoothing.
     */
   public void set_smooth_factor(double factor) { tddtOptions.smoothFactor = factor; }
			   
   /** Sets whether the Minimum Description Length Adjustment for continuous attributes
    * should be applied to mutual info.
    * @param val TRUE if the Minimum Description Length Adjustment for continuous attributes should be applied to mutual info, FALSE otherwise.
    */
   public void set_cont_mdl_adjust(boolean val)
      { tddtOptions.contMDLAdjust = val; }

   /** Returns whether Minimum Description Length Adjustment for continuous attributes should be applied to mutual info.
    * @return TRUE if the Minimum Description Length Adjustment for continuous attributes should
    *     * be applied to mutual info, FALSE otherwise.
    */
   public boolean get_cont_mdl_adjust() 
      { return tddtOptions.contMDLAdjust; }

   /** Sets the type of distribution to build at leaves.
    * @param type The type of distribution to build at leaves.
    */
   public void set_leaf_dist_type(byte type)
      { tddtOptions.leafDistType = type; }

   /** Returns the type of distribution to build at leaves.
    * @return The type of distribution to build at leaves.
    */
   public byte get_leaf_dist_type() 
      { return tddtOptions.leafDistType; }

   /** Sets the m-estimate factor for laplace.
    * @param factor The new m-estimate factor for laplace.
    */
   public void set_m_estimate_factor(double factor)
      { tddtOptions.MEstimateFactor = factor; }

   /** Returns the m-estimate factor for laplace.
    * @return The m-estimate factor for laplace.
    */
   public double get_m_estimate_factor() { return tddtOptions.MEstimateFactor; }

   /** Sets the evidence correction factor.
    * @param factor The new evidence correction factor.
    */
   public void set_evidence_factor(double factor)
      { tddtOptions.evidenceFactor = factor; }

   /** Returns the evidence correction factor.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -