2012-02-25 15 views
0

私は大きなデータセットを分類するためにMallet Naive Bayesアルゴリズムを使用しています。私の問題は、データセットを列車とテストチャンクに分割する方法です。 誰も私に列車試験のスプリットの最良の方法を教えてもらえますか? 私の文書は日付順にソートされています。 私は列車の試験のための分割この方法が見つかりました:トレインテストスプリット+テキスト分類+ Naive Bayes

public Trial testTrainSplit(InstanceList instances) { 

    int TRAINING = 0; 
    int TESTING = 1; 
    int VALIDATION = 2; 

    // Split the input list into training (90%) and testing (10%) lists.        
// The division takes place by creating a copy of the list,           
// randomly shuffling the copy, and then allocating            
// instances to each sub-list based on the provided proportions.         

    InstanceList[] instanceLists = 
     instances.split(new Randoms(), 
        new double[] {0.9, 0.1, 0.0}); 

// The third position is for the "validation" set,             
    // which is a set of instances not used directly             
    // for training, but available for determining              
    // when to stop training and for estimating optimal            
// settings of nuisance parameters.                
// Most Mallet ClassifierTrainers can not currently take advantage         
    // of validation sets.                    

Classifier classifier = trainClassifier(instanceLists[TRAINING]); 
    return new Trial(classifier, instanceLists[TESTING]); 
} 

を私はそれが文書が日付順にソートされている場合には適切ではないと思います。 誰か助けてくれますか?

答えて

関連する問題