00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 2012 Chiyuan Zhang 00008 * Copyright (C) 2012 Chiyuan Zhang 00009 */ 00010 00011 #include <shogun/mathematics/Math.h> 00012 #include <shogun/multiclass/ecoc/ECOCDecoder.h> 00013 00014 using namespace shogun; 00015 00016 SGVector<float64_t> CECOCDecoder::binarize(const SGVector<float64_t> query) 00017 { 00018 SGVector<float64_t> bquery(query.vlen); 00019 for (int32_t i=0; i < query.vlen; ++i) 00020 { 00021 if (query.vector[i] >= 0) 00022 bquery.vector[i] = +1.0; 00023 else 00024 bquery.vector[i] = -1.0; 00025 } 00026 00027 return bquery; 00028 } 00029