00001 // -*- C++ -*- 00002 00003 // Copyright (C) 2004 Université de Montréal 00004 // 00005 // Redistribution and use in source and binary forms, with or without 00006 // modification, are permitted provided that the following conditions are met: 00007 // 00008 // 1. Redistributions of source code must retain the above copyright 00009 // notice, this list of conditions and the following disclaimer. 00010 // 00011 // 2. Redistributions in binary form must reproduce the above copyright 00012 // notice, this list of conditions and the following disclaimer in the 00013 // documentation and/or other materials provided with the distribution. 00014 // 00015 // 3. The name of the authors may not be used to endorse or promote 00016 // products derived from this software without specific prior written 00017 // permission. 00018 // 00019 // THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 00020 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00021 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 00022 // NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00023 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 00024 // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00025 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00026 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00027 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00028 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00029 // 00030 // This file is part of the PLearn library. For more information on the PLearn 00031 // library, go to the PLearn Web site at www.plearn.org 00032 00033 /* ******************************************************* 00034 * $Id: FieldConvertCommand.h,v 1.19 2004/07/21 16:30:49 chrish42 Exp $ 00035 ******************************************************* */ 00036 00037 #ifndef FieldConvertCommand_INC 00038 #define FieldConvertCommand_INC 00039 00040 #include "PLearnCommand.h" 00041 #include "PLearnCommandRegistry.h" 00042 #include <plearn/math/pl_math.h> 00043 00044 namespace PLearn { 00045 using namespace std; 00046 00047 class FieldConvertCommand: public PLearnCommand 00048 { 00049 public: 00050 00052 FieldConvertCommand(); 00053 00055 enum FieldType { 00056 binary, 00057 constant, 00058 continuous, 00059 discrete_corr, 00060 discrete_uncorr, 00061 skip, 00062 unknown //< Default value before the decision on the field type is made. 00063 }; 00064 00065 virtual void run(const vector<string>& args); 00066 00067 protected: 00068 00069 // Convert a string into our enum type. 00070 FieldType stringToFieldType(string s); 00071 00072 static PLearnCommandRegistry reg_; 00073 00074 real DISCRETE_TOLERANCE; 00075 real UNIQUE_NMISSING_FRACTION_TO_ASSUME_CONTINUOUS; 00076 real PVALUE_THRESHOLD; 00077 real FRAC_MISSING_TO_SKIP; 00078 real FRAC_ENOUGH; 00079 string source_fn, desti_fn,force_fn,report_fn; 00080 string precompute; 00081 int target; 00082 FieldType type; 00083 }; 00084 00085 00086 } // end of namespace PLearn 00087 00088 #endif 00089