/***************************************************************************** FILE : $Source: /projects/higgs1/SNNS/CVS/SNNS/kernel/sources/remap_f.c,v $ SHORTNAME : remap_f SNNS VERSION : 4.2 PURPOSE : pattern remapping functions NOTES : AUTHOR : Guenter Mamier DATE : CHANGED BY : RCS VERSION : $Revision: 2.8 $ LAST CHANGE : $Date: 1998/04/08 09:17:37 $ Copyright (c) 1990-1995 SNNS Group, IPVR, Univ. Stuttgart, FRG Copyright (c) 1996-1998 SNNS Group, WSI, Univ. Tuebingen, FRG ******************************************************************************/ #include #include #include "glob_typ.h" #include "remap_f.ph" /***************************************************************************** FUNCTION : REMAP_none PURPOSE : default pattern remapping function that does no remapping at all. NOTES : RETURNS : UPDATE : ******************************************************************************/ krui_err REMAP_none(float *pat_data, int pat_size, float *remap_params, int no_of_remap_params) { KernelErrorCode = KRERR_NO_ERROR; return(KernelErrorCode); } /***************************************************************************** FUNCTION : REMAP_binary PURPOSE : produces the patterns for a binary classifier. All patterns greater than 0.5 are mapped to one, all others to 0 NOTES : RETURNS : UPDATE : ******************************************************************************/ krui_err REMAP_binary(float *pat_data, int pat_size, float *remap_params, int no_of_remap_params) { register int i; for(i=0; i param2)? param2: *pat_data); pat_data++; } return(KRERR_NO_ERROR); } /***************************************************************************** FUNCTION : REMAP_norm PURPOSE : produces normalized patterns, i.e. the length of the pattern vector is 1 after calling this function. Some learning algorithms like DLVQ require the output patterns to be normalized. RETURNS : UPDATE : ******************************************************************************/ krui_err REMAP_norm(float *pat_data, int pat_size, float *remap_params, int no_of_remap_params) { register int i; double length = 0.0; for(i=0; i param2)? param4: param3); pat_data++; } } return(KRERR_NO_ERROR); } /***************************************************************************** FUNCTION : REMAP_linearscale PURPOSE : rescales the pattern outputs to a new range like out = a*orig_out + b NOTES : Parameter meanings: 0 - factor a 1 - addin b RETURNS : 0 or kernel error code KRERR_PARAMETERS UPDATE : ******************************************************************************/ krui_err REMAP_linearscale(float *pat_data, int pat_size, float *remap_params, int no_of_remap_params) { register float param1; register float param2; register int i; param1 = remap_params[0]; param2 = remap_params[1]; for(i=0; i