| 1 |
/* Discriminant_PatternList_Categories.cpp |
| 2 |
* |
| 3 |
* Copyright (C) 2004-2019 David Weenink |
| 4 |
* |
| 5 |
* This code is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 2 of the License, or (at |
| 8 |
* your option) any later version. |
| 9 |
* |
| 10 |
* This code is distributed in the hope that it will be useful, but |
| 11 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
/* |
| 20 |
djmw 20040422 Initial version |
| 21 |
*/ |
| 22 |
|
| 23 |
#include "Discriminant_PatternList_Categories.h" |
| 24 |
#include "TableOfReal_and_Discriminant.h" |
| 25 |
#include "Matrix_Categories.h" |
| 26 |
|
| 27 |
autoDiscriminant PatternList_Categories_to_Discriminant (PatternList me, Categories thee) { |
| 28 |
try { |
| 29 |
autoTableOfReal t = Matrix_Categories_to_TableOfReal (me, thee); |
| 30 |
autoDiscriminant him = TableOfReal_to_Discriminant (t.get()); |
| 31 |
return him; |
| 32 |
} catch (MelderError) { |
| 33 |
Melder_throw (U"Discriminant not created from PatternList & Categories."); |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
autoCategories Discriminant_PatternList_to_Categories (Discriminant me, PatternList thee, int poolCovarianceMatrices, int useAprioriProbabilities) { |
| 38 |
try { |
| 39 |
autoTableOfReal t = Matrix_to_TableOfReal (thee); |
| 40 |
autoClassificationTable ct = Discriminant_TableOfReal_to_ClassificationTable (me, t.get(), poolCovarianceMatrices, useAprioriProbabilities); |
| 41 |
autoCategories him = ClassificationTable_to_Categories_maximumProbability (ct.get()); |
| 42 |
return him; |
| 43 |
} catch (MelderError) { |
| 44 |
Melder_throw (U"Categories not created from PatternList & Discriminant."); |
| 45 |
} |
| 46 |
} |
| 47 |
|
| 48 |
/* End of file Discriminant_PatternList_Categories.cpp */ |