~ubuntu-branches/ubuntu/jaunty/speech-tools/jaunty

« back to all changes in this revision

Viewing changes to stats/wagon/wagon.cc

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Urlichs
  • Date: 2004-07-16 09:25:39 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040716092539-5p1tzif55b8j924e
Tags: 1:1.2.3-8
Added alaw processing code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
/*=======================================================================*/
44
44
 
45
45
#include <stdlib.h>
46
 
#include <iostream.h>
47
 
#include <fstream.h>
 
46
#include <iostream>
 
47
#include <fstream>
48
48
#include <string.h>
49
49
#include "EST_Token.h"
50
50
#include "EST_FMatrix.h"
57
57
WDataSet wgn_dataset;
58
58
WDataSet wgn_test_dataset;
59
59
EST_FMatrix wgn_DistMatrix;
 
60
EST_Track *wgn_UnitTracks = 0;
60
61
 
61
62
int wgn_min_cluster_size = 50;
62
63
int wgn_held_out = 0;
275
276
    for (p=dataset.head(); p != 0; p=next(p))
276
277
    {
277
278
        pnode = tree.predict_node((*dataset(p)));
278
 
        predict = pnode->get_impurity().value();
 
279
        predict = EST_String(pnode->get_impurity().value());
279
280
        if (wgn_count_field == -1)
280
281
            count = 1.0;
281
282
        else
417
418
    node.set_impurity(WImpurity(node.get_data()));
418
419
    q = find_best_question(node.get_data());
419
420
 
 
421
/*    printf("q.score() %f impurity %f\n",
 
422
           q.get_score(),
 
423
           node.get_impurity().measure()); */
 
424
 
420
425
    if ((q.get_score() < WGN_HUGE_VAL) &&
421
426
        (q.get_score() < node.get_impurity().measure()))
422
427
    {
746
751
        (n.samples() < min_cluster))
747
752
        return WGN_HUGE_VAL;
748
753
 
749
 
    return (y.measure() + n.measure());
 
754
    float ym,nm,bm;
 
755
    ym = y.measure();
 
756
    nm = n.measure();
 
757
    bm = ym + nm;
 
758
 
 
759
/*    cout << q << endl;
 
760
    printf("test question y %f n %f b %f\n",
 
761
    ym, nm, bm); */
 
762
 
 
763
    return bm/2.0;
750
764
}
751
765
 
752
766
float wgn_score_question(WQuestion &q, WVectorVector &ds)