nb
Class NaiveBayesInd

java.lang.Object
  |
  +--shared.BaseInducer
        |
        +--shared.Inducer
              |
              +--nb.NaiveBayesInd

public class NaiveBayesInd
extends Inducer


Field Summary
 java.lang.String endl
           
 java.lang.String EVIDENCE_FACTOR_HELP
           
 java.lang.String KL_THREHSOLD_HELP
           
 java.lang.String LAPLACE_HELP
           
 java.lang.String M_FACTOR_HELP
           
 java.lang.String UNKNOWN_IS_VALUE_HELP
           
static int unknownAuto
           
static int unknownNo
           
static int unknownYes
           
 java.lang.String USE_EVIDENCE_PROJECTION_HELP
           
 
Fields inherited from class shared.BaseInducer
AHA_IB_INDUCER, AM_INDUCER, BAGGING_INDUCER, BOOSTER_INDUCER, C45_INDUCER, C45AP_INDUCER, C45R_INDUCER, C50_INDUCER, CART_INDUCER, CatDT_INDUCER, CF_INDUCER, CLUSTER_INDUCER, CN2_INDUCER, CONST_INDUCER, COODG_INDUCER, DDT_INDUCER, DF_INDUCER, DISC_NB_INDUCER, DISC_SEARCH_INDUCER, DISC_TAB_INDUCER, ENTROPY_ODG_INDUCER, FCF_INDUCER, FSS_INDUCER, getEnv, HOODG_INDUCER, IB_INDUCER, ID3_INDUCER, LAZY_DT_INDUCER, LIST_HOODG_INDUCER, LIST_ODG_INDUCER, logOptions, NAIVE_BAYES_INDUCER, NULL_INDUCER, OC1_INDUCER, ODT_INDUCER, ONER_INDUCER, OODG_INDUCER, ORDER_FSS_INDUCER, PEBLS_INDUCER, PERCEPTRON_INDUCER, PERF_EST_INDUCER, PROJECT_INDUCER, RIPPER_INDUCER, SGI_DT_INDUCER, STACKING_INDUCER, T2_INDUCER, TABLE_CAS_INDUCER, TABLE_INDUCER, TDDT_INDUCER, TS, WEIGHT_SEARCH_INDUCER, WINNOW_INDUCER
 
Constructor Summary
NaiveBayesInd(NaiveBayesInd source)
          Description : Copy constructor.
NaiveBayesInd(java.lang.String description)
          Constructor with description String.
 
Method Summary
 int class_id()
          returns the Id of this inducer
 Inducer copy()
          Description : Returns the pointer to the copy of this.
 void display(java.io.BufferedWriter stream, DisplayPref dp)
          Description : Prints a readable representation of the Cat to the given stream.
 Categorizer get_categorizer()
          Description : Returns the categorizer that the inducer has generated.
 double get_m_estimate_factor()
           
 boolean get_use_evidence_projection()
           
 boolean get_use_laplace()
           
 int num_nontrivial_leaves()
          This method returns 0 because NaiveBayes is not a tree inducer.
 int num_nontrivial_nodes()
          This method returns 0 because NaiveBayes is not a tree inducer.
 Categorizer release_categorizer()
          Description : Gives ownership of the generated categorizer to the caller, reverting the Inducer to untrained state.
 void set_m_estimate_factor(double m)
          Description : set m value for L'aplace correction.
 void set_use_evidence_projection(boolean projection)
           
 void set_use_laplace(boolean laplace)
          Description : set whether to use L'aplace correction.
 void set_user_options(java.lang.String preFix)
          Description : Sets the options from environment variables.
 void train()
          Description : Trains Naive Bayes Categorizer.
 boolean was_trained(boolean fatal_on_false)
          Description : Return TRUE iff the class has a valid categorizer.
 
Methods inherited from class shared.Inducer
can_cast_to_inducer, cast_to_inducer, display_struct, display_struct, project_train_and_perf_files, project_train_and_perf_files, project_train_and_perf_files, project_train_and_perf_files, project_train_and_perf, project_train_and_test_files, project_train_and_test_files, project_train_and_test_files, project_train_and_test_files, project_train_and_test, supports_full_testing, train_and_perf, train_and_test
 
Methods inherited from class shared.BaseInducer
assign_data, can_cast_to_incr_inducer, cast_to_incr_inducer, description, get_log_level, get_log_options, get_log_stream, has_data, has_data, instance_list, normalize_weights, read_data, read_data, read_data, release_data, set_log_level, set_log_options, set_log_prefixes, set_log_stream, train_and_test_files, train_and_test_files, train_and_test_files, train_and_test_files
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

endl

public java.lang.String endl

LAPLACE_HELP

public final java.lang.String LAPLACE_HELP

M_FACTOR_HELP

public final java.lang.String M_FACTOR_HELP

UNKNOWN_IS_VALUE_HELP

public final java.lang.String UNKNOWN_IS_VALUE_HELP

KL_THREHSOLD_HELP

public final java.lang.String KL_THREHSOLD_HELP

USE_EVIDENCE_PROJECTION_HELP

public final java.lang.String USE_EVIDENCE_PROJECTION_HELP

EVIDENCE_FACTOR_HELP

public final java.lang.String EVIDENCE_FACTOR_HELP

unknownNo

public static final int unknownNo

unknownYes

public static final int unknownYes

unknownAuto

public static final int unknownAuto
Constructor Detail

NaiveBayesInd

public NaiveBayesInd(java.lang.String description)
Constructor with description String.

NaiveBayesInd

public NaiveBayesInd(NaiveBayesInd source)
Description : Copy constructor. Copy correction options. Comments :
Method Detail

class_id

public int class_id()
returns the Id of this inducer
Overrides:
class_id in class BaseInducer
Tags copied from class: BaseInducer
Returns:
Integer assigned to this inducer.

was_trained

public boolean was_trained(boolean fatal_on_false)
Description : Return TRUE iff the class has a valid categorizer. Comments :

get_categorizer

public Categorizer get_categorizer()
Description : Returns the categorizer that the inducer has generated. Comments :
Overrides:
get_categorizer in class Inducer
Tags copied from class: Inducer
Returns:
The Categorizer class storing a categorizer created by this induction algorithm.

release_categorizer

public Categorizer release_categorizer()
Description : Gives ownership of the generated categorizer to the caller, reverting the Inducer to untrained state. Comments :
Overrides:
release_categorizer in class Inducer
Tags copied from class: Inducer
Returns:
The Categorizer trained.

set_user_options

public void set_user_options(java.lang.String preFix)
Description : Sets the options from environment variables. Comments :

train

public void train()
Description : Trains Naive Bayes Categorizer. Descrete attributes can be handled by simply passing occurance counts in the BagCounter. Continuous attributes are fed into StatDatas to get mean, variance, and standard deviation. Comments : It is possible that some label is not in the training set, or it has unknown for a continous attribute. In this case, statData::size() = 0, and the loop below will not write any data into the NBNorm structure. Since the NBNorm structure is initialized to HasData = FALSE, doing nothing will correctly indicate that there is no data.
Overrides:
train in class Inducer

display

public void display(java.io.BufferedWriter stream,
                    DisplayPref dp)
             throws java.io.IOException
Description : Prints a readable representation of the Cat to the given stream. Comments :

copy

public Inducer copy()
Description : Returns the pointer to the copy of this. Comments :

set_use_laplace

public void set_use_laplace(boolean laplace)
Description : set whether to use L'aplace correction. Comments :

set_m_estimate_factor

public void set_m_estimate_factor(double m)
Description : set m value for L'aplace correction. Comments :

get_use_laplace

public boolean get_use_laplace()

get_m_estimate_factor

public double get_m_estimate_factor()

get_use_evidence_projection

public boolean get_use_evidence_projection()

set_use_evidence_projection

public void set_use_evidence_projection(boolean projection)

num_nontrivial_nodes

public int num_nontrivial_nodes()
This method returns 0 because NaiveBayes is not a tree inducer. There is no tree for which to count nodes.
Returns:
0;

num_nontrivial_leaves

public int num_nontrivial_leaves()
This method returns 0 because NaiveBayes is not a tree inducer. There is not tree for which to count leaves.
Returns:
0