SparseGenerativeModel (3.7)

Generative models for scalable text mining

Provides sparse matrix implementations for Multinomial Naive Bayes and Multinomial Kernel Density classifiers.Uses hash tables for training, inverted indices for classification.

Implements several options for smoothing, TF-IDF feature transforms, parameter pruning and model-based feedback.Default options smooth class-conditionals using Uniform Jelinek-Mercer and instance-conditionals with Pitman-Yor Process smoothing.

Restart Weka after package installation.

For preprocessing use Weka StringToWordVector with outputWordCounts=True.

Documentation website:

References:Puurula, A.

Scalable Text Classification with Sparse Generative Modeling.Proceedings of the 12th Pacific Rim International Conference on Artificial Intelligence.

2012.Puurula, A and Bifet, A.Ensembles of Sparse Multinomial Classifiers for Scalable Text Classification.ECML/PKDD PASCAL Workshop on Large-Scale Hierarchical Classification.2012.

Puurula, A and Myaeng, S.Integrated Instance- and Class-based Generative Modeling for Text Classification.Proceedings of the Australasian Document Computing Symposium.2013

(based on WEKA 3.7)

For further options, click the 'More' - button in the dialog.

All weka dialogs have a panel where you can specify classifier-specific parameters.


SparseGenerativeModel Options

prune_count_table: Log-count pruning value of conditional parameters after training.

prune_count_insert: Log-count pruning value of conditional parameters after each update. If used, typical values -6 to -10.

min_count: Minimum document frequency of term after training. 1 = no terms pruned.

length_scale: TF length normalization parameter. Higher values for stronger length normalization.

idf_lift: IDF normalization parameter. Higher values for weaker IDF normalization. -1 = Croft-Harper IDF, 0 = Robertson-Walker IDF.

feedback_weight: Feedback model interpolation weight for model-based feedback.

bg_unif_smooth: Uniform smoothing weight for background model.

jelinek_mercer: Jelinek-Mercer smoothing of class-conditionals with the background model.

dirichlet_prior: Dirichlet Prior smoothing of class-conditionals with the background model.

absolute_discount: Absolute Discount smoothing of class-conditionals with the background model.

powerlaw_discount: Powerlaw Discount smoothing of class-conditionals with the background model.

prior_scale: Scaling of prior probabilities. Equivalent to language model scaling in HMM speech recognition.

kernel_densities: Use Multinomial Kernel densities.

use_tfidf: Use TF-IDF: 0 = no feature transform 1 = TF-IDF 2 = TF 3 = IDF

kernel_jelinek_mercer: Jelinek-Mercer smoothing of instance-conditionals with the class-conditionals.

kernel_powerlaw_discount: Powerlaw Discount smoothing of instance-conditionals with the class-conditionals.

kernel_dirichlet_prior: Dirichlet Prior smoothing of instance-conditionals with the class-conditionals.

combination: Instance score combination: 1 = kernel density 0 = voting 1 = distance-weighted voting

top_k: Top k instances for inference with kernel densities.

Select target column
Choose the column that contains the target variable.
Preliminary Attribute Check

The Preliminary Attribute Check tests the underlying classifier against the DataTable specification at the inport of the node. Columns that are compatible with the classifier are marked with a green 'ok'. Columns which are potentially not compatible are assigned a red error message.

Important: If a column is marked as 'incompatible', it does not necessarily mean that the classifier cannot be executed! Sometimes, the error message 'Cannot handle String class' simply means that no nominal values are available (yet). This may change during execution of the predecessor nodes.

Capabilities: [Numeric attributes, Nominal class, Binary class, Missing class values] Dependencies: [] min # Instance: 1

Command line options

It shows the command line options according to the current classifier configuration and mainly serves to support the node's configuration via flow variables.

Additional Options

Select optional vector column
If the input table contains vector columns (e.g. double vector), the one to use can be selected here. This vector column will be used as attributes only and all other columns, except the target column, will be ignored.
Keep training instances
If checked, all training instances will be kept and stored with the classifier model. It is useful to calculate additional evaluation measures (see Weka Predictor) that make use of class prior probabilities. If no evaluation is performed or those measures are not required, it is advisable to NOT keep the training instances.

Input Ports

Training data

Output Ports

Trained model

Popular Predecessors

  • No recommendations found

Popular Successors

  • No recommendations found


Weka Node View
Each Weka node provides a summary view that provides information about the classification. If the test data contains a class column, an evaluation is generated.


  • No workflows found



You want to see the source code for this node? Click the following button and we’ll use our super-powers to find it for you.