public function train_with_context(array &$train_ctx, FeatureFactoryInterface $ff, TrainingSet $tset, $a_smoothing=1)
    {
        $this->countTrainingSet(
                                $ff,
                                $tset,
                                $train_ctx['termcount_per_class'],
                                $train_ctx['termcount'],
                                $train_ctx['ndocs_per_class'],
                                $train_ctx['voc'],
                                $train_ctx['ndocs']
                            );

        $voccount = count($train_ctx['voc']);

        $this->computeProbabilitiesFromCounts(
                                    $tset->getClassSet(),
                                    $train_ctx['termcount_per_class'],
                                    $train_ctx['termcount'],
                                    $train_ctx['ndocs_per_class'],
                                    $train_ctx['ndocs'],
                                    $voccount,
                                    $a_smoothing
                                );

        return $train_ctx;
    }
public function train_with_context(array &$train_ctx, FeatureFactoryInterface $ff, TrainingSet $tset, $a_smoothing=1)
    {
        $this->countTrainingSet(
                                $ff,
                                $tset,
                                $train_ctx['termcount_per_class'],
                                $train_ctx['termcount'],
                                $train_ctx['ndocs_per_class'],
                                $train_ctx['voc'],
                                $train_ctx['ndocs']
                            );

        $voccount = count($train_ctx['voc']);

        $this->computeProbabilitiesFromCounts(
                                    $tset->getClassSet(),
                                    $train_ctx['termcount_per_class'],
                                    $train_ctx['termcount'],
                                    $train_ctx['ndocs_per_class'],
                                    $train_ctx['ndocs'],
                                    $voccount,
                                    $a_smoothing
                                );

        return $train_ctx;
    }
public function train_with_context ( array & $ train_ctx , FeatureFactoryInterface $ ff , TrainingSet $ tset , $ a_smoothing = 1 ) { $ this -> countTrainingSet ( $ ff , $ tset , $ train_ctx [ 'termcount_per_class' ] , $ train_ctx [ 'termcount' ] , $ train_ctx [ 'ndocs_per_class' ] , $ train_ctx [ 'voc' ] , $ train_ctx [ 'ndocs' ] ) ; $ voccount = count ( $ train_ctx [ 'voc' ] ) ; $ this -> computeProbabilitiesFromCounts ( $ tset -> getClassSet ( ) , $ train_ctx [ 'termcount_per_class' ] , $ train_ctx [ 'termcount' ] , $ train_ctx [ 'ndocs_per_class' ] , $ train_ctx [ 'ndocs' ] , $ voccount , $ a_smoothing ) ; return $ train_ctx ; }
Train on the given set and fill the model's variables. Use the
training context provided to update the counts as if the training
set was appended to the previous one that provided the context.

It can be used for incremental training. It is not meant to be used
with the same training set twice.

@param array                   $train_ctx The previous training context
@param FeatureFactoryInterface $ff        A feature factory to compute features from a training document
@param TrainingSet The training set
@param  integer $a_smoothing The parameter for additive smoothing. Defaults to add-one smoothing.
@return array   Return a training context to be used for further incremental training,
although this is not necessary since the changes also happen in place
Train on the given set and fill the model s variables . Use the training context provided to update the counts as if the training set was appended to the previous one that provided the context .