コード例 #1
0
        /// <summary>
        /// selects top IG features above 0 weight, then saves serialized data to a file.
        /// </summary>
        /// <param name="topIGFeatures"></param>
        /// <param name="data"></param>
        public static void selectIGSerialize(ref Instances data)
        {
            //run ig and get top 1000 or up to 1000 bigger than zero, from tr4
            WekaTrainingMethods.useLowLevelInformationGainFeatureSelection(data);
            GuiPreferences.Instance.setLog(Preferences.Instance.attsel.selectedAttributes().Length.ToString() + " features above zero value selected (including the Class feature)");

            //serialize (save) ALL 204k indices to file.

            //serialize (save) TOP ig indices to file.
            XMLSerializer.serializeArrayToFile <int[]>(GuiPreferences.Instance.WorkDirectory + "TrainSet_" + GuiPreferences.Instance.NudClassifyUsingTR.ToString() + "th_vectors_scaledCS_filteredIG_indices.xml", Preferences.Instance.attsel.selectedAttributes());
            GuiPreferences.Instance.setLog("saved top + All IG indices to TWO XML files (in the same order as IG gave it)");
            //int [] _trainTopIGFeatures_loaded = DeserializeArrayToFile(GuiPreferences.Instance.WorkDirectory + "TrainSet_" + GuiPreferences.Instance.NudClassifyUsingTR.ToString() + "th_vectors_scaledCS_filteredIG_indices.xml");
        }
コード例 #2
0
        public static void saveConfigFile()
        {
            Preferences.Instance.configFile = new Dictionary <string, string>();

            Preferences.Instance.configFile.Add("WorkDirectory", GuiPreferences.Instance.WorkDirectory);
            Preferences.Instance.configFile.Add("ProtocolFile", GuiPreferences.Instance.ProtocolFile);
            Preferences.Instance.configFile.Add("dirList", string.Join(",", Preferences.Instance.dirList.Select(u => u)));
            Preferences.Instance.configFile.Add("dataType.rawValue", GuiPreferences.Instance.FileType.ToString());
            Preferences.Instance.configFile.Add("NudThreshold", GuiPreferences.Instance.NudThreshold.ToString());                         //400
            Preferences.Instance.configFile.Add("NudExtractFromTR", GuiPreferences.Instance.NudExtractFromTR.ToString());                 // = 3;
            Preferences.Instance.configFile.Add("NudExtractToTR", GuiPreferences.Instance.NudExtractToTR.ToString());                     // = 4;
            Preferences.Instance.configFile.Add("NudClassifyUsingTR", GuiPreferences.Instance.NudClassifyUsingTR.ToString());             // = 4;
            Preferences.Instance.configFile.Add("NudIGThreshold", GuiPreferences.Instance.NudIGThreshold.ToString());                     // = 0.15M; //0.15 dona, keren 0.10
            Preferences.Instance.configFile.Add("NudIGVoxelAmount", GuiPreferences.Instance.NudIGVoxelAmount.ToString());                 // = 0.15M; //0.15 dona, keren 0.10
            Preferences.Instance.configFile.Add("NudFilterEyeSlices", GuiPreferences.Instance.NudFilterEyeSlices.ToString());             // = 13; // 13 dona, keren 10
            Preferences.Instance.configFile.Add("NudEyeSliceFirstLines", GuiPreferences.Instance.NudEyeSliceFirstLines.ToString());       // = 80;
            Preferences.Instance.configFile.Add("CbPeekHigherTRsIGChecked", GuiPreferences.Instance.CbPeekHigherTRsIGChecked.ToString()); // = false;
            Preferences.Instance.configFile.Add("NormalizationType", GuiPreferences.Instance.NormalizedType.ToString());                  //formula
            Preferences.Instance.configFile.Add("IgSelectionType", GuiPreferences.Instance.IgSelectionType.ToString());                   //ig type, threshold or voxel amount
            Preferences.Instance.configFile.Add("NudMovingWindow", GuiPreferences.Instance.NudMovingWindow.ToString());                   //window
            XMLSerializer.serializeArrayToFile <Dictionary <string, string> >(GuiPreferences.Instance.WorkDirectory + "config.xml", Preferences.Instance.configFile);
        }
コード例 #3
0
        /// <summary>
        /// copying files to finalData, processing, creating config files/minmax/etc and converting to arff.
        /// </summary>
        /// <param name="_trialProblem"></param>
        /// <returns></returns>
        public static void WekaProcessingPipelineForMultiRuns(List <string> directoryList)
        {
            //create a dir that holds the final DS in C:\
            //GuiPreferences.Instance.WorkDirectory = @"C:\FinalData_" + DateTime.Now.ToLongTimeString().Replace(':', '-');
            GuiPreferences.Instance.WorkDirectory = @"C:\FinalData_" +
                                                    "TR" + GuiPreferences.Instance.NudClassifyUsingTR.ToString() + "_" +
                                                    GuiPreferences.Instance.NormalizedType.ToString() +
                                                    GuiPreferences.Instance.NudMovingWindow.ToString() + "_";

            if (GuiPreferences.Instance.IgSelectionType == IGType.Threshold)
            {
                GuiPreferences.Instance.WorkDirectory = GuiPreferences.Instance.WorkDirectory + "IG_Thr" + GuiPreferences.Instance.NudIGThreshold.ToString() + "_";
            }
            else if (GuiPreferences.Instance.IgSelectionType == IGType.Voxels)
            {
                GuiPreferences.Instance.WorkDirectory = GuiPreferences.Instance.WorkDirectory + "IG_Vox" + GuiPreferences.Instance.NudIGVoxelAmount.ToString() + "_";
            }

            //GuiPreferences.Instance.ProtocolFile + "_" +
            GuiPreferences.Instance.WorkDirectory = GuiPreferences.Instance.WorkDirectory + Preferences.Instance.events.EventListLastTr.ToString();

            if (GuiPreferences.Instance.CbPeekHigherTRsIGChecked == true)
            {
                GuiPreferences.Instance.WorkDirectory = GuiPreferences.Instance.WorkDirectory + "_Peeking";
            }
            GuiPreferences.Instance.setLog(@"Creating Final Directory in: " + GuiPreferences.Instance.WorkDirectory);
            FileDirectoryOperations.CreateDirectory(GuiPreferences.Instance.WorkDirectory);
            GuiPreferences.Instance.WorkDirectory += @"\";

            ConcatenateLibsvmVectorizedPerTR(directoryList);

            //NOTE: min/max values are taken from the param files of each run. which means that you get N max values and N min values.
            //if a median is needed, we have to go over all columns for each feature and concat all values to a huge list that contains all N files and only then do the median.
            //the median code here is not conceptually not right. as we take median out of 4 max values or min values. its a bad way to calculate a median.
            //median code should be done in the normalization class and the code here should reflect the concept behind it.

            //NOTE2: this code goes over N max and min values from each param file and get the MAX(maxes) and MIN(mins).
            //these max and mins are saved to be used as the initial min/max values for the testing stage.
            double[][] feature_max = new double[directoryList.Count][];
            double[][] feature_min = new double[directoryList.Count][];
            int        i           = 0;
            int        max_index   = -1;

            foreach (string directory in directoryList)
            {
                TrainingTesting_SharedVariables._svmscaleTraining.getConfigFileMinMaxValues(
                    //use previous tr min/maxes for median consideration
                    //directory + "TrainSet_" + (GuiPreferences.Instance.NudClassifyUsingTR - 1).ToString() + "th_vectors_scale_paramCS.libsvm",

                    //use current tr for min/max median
                    directory + "TrainSet_" + (GuiPreferences.Instance.NudClassifyUsingTR).ToString() + "th_vectors_scale_paramCS.libsvm",

                    ref feature_max[i], ref feature_min[i], ref max_index);
                i++;
            }


            //calculate Mean + save new min/max param to C:\
            double[] finalFeature_max       = new double[feature_max[0].Length];
            double[] finalFeature_min       = new double[feature_max[0].Length];
            double[] finalFeature_medianMax = new double[feature_max[0].Length];
            double[] finalFeature_medianMin = new double[feature_max[0].Length];

            //create a TEMP list with enough values for the runs, in order to calculate the MIN/MAX median
            var values_max       = new List <double>(feature_max.Length);
            var values_min       = new List <double>(feature_max.Length);
            var values_medianMax = new List <double>(feature_max.Length);
            var values_medianMin = new List <double>(feature_max.Length);

            for (int k = 0; k < feature_max.Length; k++)
            {
                //init zeros
                values_max.Add(0);
                values_min.Add(0);
                values_medianMax.Add(0);
                values_medianMin.Add(0);
            }

            for (int j = 0; j < feature_max[0].Length; j++)
            {
                for (int k = 0; k < feature_max.Length; k++)
                {
                    // for each feature group all run-based values together
                    values_max[k] = feature_max[k][j];
                    values_min[k] = feature_min[k][j];
                }

                //get median of maxes/mins optional here

                /*finalFeature_max[j] = GetMedian(values_max);
                 * finalFeature_min[j] = GetMedian(values_min); */

                //get Max and Min here.
                finalFeature_max[j] = values_max.Max();
                finalFeature_min[j] = values_min.Min();
            }
            //save max/median param file
            TrainingTesting_SharedVariables._svmscaleTraining.saveConfigMinMax_CSharp(
                GuiPreferences.Instance.WorkDirectory + "TrainSet_" + GuiPreferences.Instance.NudClassifyUsingTR.ToString() + "th_vectors_scale_paramCS.libsvm",
                finalFeature_min, finalFeature_max, 204801, 0.0f, 1.0f);

            int lowRangeMinus  = 0;
            int highRangeMinus = 0;

            //calculate median ranges. from baseline.
            for (int j = 1; j < feature_max[0].Length - 1; j++)
            {
                for (int k = 0; k < feature_max.Length; k++)
                {
                    //min = test baseline median - 2nd smallest (training baseline median - training min)
                    //max = test baseline median + 2nd smallest ( training max - training baseline median)
                    values_medianMax[k] = feature_max[k][j] - Preferences.Instance.TrainingBaselineMedians[k].median[j - 1];
                    values_medianMin[k] = Preferences.Instance.TrainingBaselineMedians[k].median[j - 1] - feature_min[k][j];
                }

                double chosenLowRange;
                double chosenHighRange;

                chosenLowRange  = getSecondLowest(values_medianMin);
                chosenHighRange = getSecondLowest(values_medianMax);

                //chosenLowRange = getSecondHighest(values_medianMin);
                //chosenHighRange = getSecondHighest(values_medianMax);

                //chosenLowRange  = StatisticsFeatures.GetMedian(values_medianMin);
                //chosenHighRange = StatisticsFeatures.GetMedian(values_medianMax);


                finalFeature_medianMin[j] = chosenLowRange;
                finalFeature_medianMax[j] = chosenHighRange;

                if (chosenLowRange <= 0)
                {
                    lowRangeMinus++;
                }

                if (chosenHighRange <= 0)
                {
                    highRangeMinus++;
                }
            }
            //////////////////////////////////////////////////////////
            //for verification save ranges (this file it not to be used!)

            TrainingTesting_SharedVariables._svmscaleTraining.saveConfigMinMax_CSharp(
                GuiPreferences.Instance.WorkDirectory + "TrainSet_" + GuiPreferences.Instance.NudClassifyUsingTR.ToString() +
                "th_vectors_scale_MedianRangeFromBaseline.params.txt", finalFeature_medianMin, finalFeature_medianMax, 204801, 0.0f, 1.0f);

            Preferences.Instance.medianRange = new MinMax(finalFeature_medianMin, finalFeature_medianMax);

            XMLSerializer.serializeArrayToFile <MinMax>(GuiPreferences.Instance.WorkDirectory + "TrainSet_" +
                                                        GuiPreferences.Instance.NudClassifyUsingTR.ToString() + "th_vectors_MedianRangeFromBaseline.xml", Preferences.Instance.medianRange);

            GuiPreferences.Instance.setLog("out of 204K features, low range <= 0: " + lowRangeMinus.ToString() + " && high range <= 0: " + highRangeMinus.ToString());
        }
コード例 #4
0
        public static Instances WekaPipeline_Unprocessed(libSVM_ExtendedProblem _trialProblem)
        {
            //export to libsvm file
            if (_trialProblem.samples == null)
            {
                GuiPreferences.Instance.setLog("Export Failed: Problem has no samples!");
                return(null);
            }

            string trainFileName = GuiPreferences.Instance.WorkDirectory /*+ GuiPreferences.Instance.FileName*/ + "TrainSet";


            //todo add proper named to saved files, check if null is logical at all.
            if ((_trialProblem.samples != null))
            {
                _trialProblem.Save(trainFileName + ".libsvm");
                GuiPreferences.Instance.setLog("saved Original Problem LibSVM file: " + trainFileName + ".libsvm");
            }

            //separate DS to 3rd and 4th TR
            ////example: ExecuteSelectKthVectorScript(@"TrainSet", @"H:\My_Dropbox\VERE\MRI_data\Tirosh\20120508.Rapid+NullClass.day2\4\rtp\");
            KthExtractionManager.ExecuteSelectKthVectorScript(/*GuiPreferences.Instance.FileName +*/ "TrainSet", GuiPreferences.Instance.WorkDirectory);
            GuiPreferences.Instance.setLog("Created TR3 & TR4 files");

            //normalize 3rd and 4th TR files.
            NormalizationManager.ScaleTrFiles(GuiPreferences.Instance.WorkDirectory);
            GuiPreferences.Instance.setLog("Normalized TR3 & TR4 files");

            //convert tr4 and tr3 to arff + REMOVE 204801 FAKE FEATURE, THAT WAS PLACES TO MAKE SURE WE GET 204800 FEATURES IN THE ARFF FILE.
            if (WekaCommonFileOperation.ConvertLIBSVM2ARFF(GuiPreferences.Instance.WorkDirectory + "TrainSet_3th_vectors_scaledCS.libsvm", 204800))
            {
                GuiPreferences.Instance.setLog("Converted to ARFF: TrainSet_3th_vectors_scaledCS.libsvm");
            }
            if (WekaCommonFileOperation.ConvertLIBSVM2ARFF(GuiPreferences.Instance.WorkDirectory + "TrainSet_4th_vectors_scaledCS.libsvm", 204800))
            {
                GuiPreferences.Instance.setLog("Converted to ARFF: TrainSet_4th_vectors_scaledCS.libsvm");
            }

            //---------------------------------- filter tr3 based on top 1000 from tr4 (the trick) -----------------------------
            //load TR4
            ConverterUtils.DataSource source = new ConverterUtils.DataSource(GuiPreferences.Instance.WorkDirectory + "TrainSet_4th_vectors_scaledCS.libsvm.arff");
            Instances data = source.getDataSet();

            //assign last as index.
            if (data.classIndex() == -1)
            {
                data.setClassIndex(data.numAttributes() - 1);
            }

            //if class not nominal, convert to
            if (!data.classAttribute().isNominal())
            {
                var filter = new weka.filters.unsupervised.attribute.NumericToNominal();

                filter.setOptions(weka.core.Utils.splitOptions("-R last"));
                //filter.setAttributeIndices("last");
                filter.setInputFormat(data);
                data = Filter.useFilter(data, filter);
            }

            //run ig and get top 1000 or up to 1000 bigger than zero, from tr4
            WekaTrainingMethods.useLowLevelInformationGainFeatureSelection(data);

            TrainingTesting_SharedVariables._trainTopIGFeatures = Preferences.Instance.attsel.selectedAttributes();

            //this should be done ONCE
            Preferences.Instance.fastvector = RealTimeProcessing.CreateFastVector(TrainingTesting_SharedVariables._trainTopIGFeatures.Length);
            GuiPreferences.Instance.setLog("created fast vector of length " + TrainingTesting_SharedVariables._trainTopIGFeatures.Length.ToString());

            //serialize (save) topIG indices to file.
            XMLSerializer.serializeArrayToFile(GuiPreferences.Instance.WorkDirectory + "TrainSet_" + GuiPreferences.Instance.NudClassifyUsingTR.ToString() + "th_vectors_scaledCS_filteredIG_indices.xml", TrainingTesting_SharedVariables._trainTopIGFeatures);
            GuiPreferences.Instance.setLog("saved IG indices to a file (in the same order as IG gave it)");
            //int [] _trainTopIGFeatures_loaded = DeserializeArrayToFile(GuiPreferences.Instance.WorkDirectory + "TrainSet_3th_vectors_scaledCS_filteredIG_indices.xml");

            GuiPreferences.Instance.setLog(TrainingTesting_SharedVariables._trainTopIGFeatures.Length.ToString() + " features above zero value selected (including the Class feature)");

            //load tr3
            source = new ConverterUtils.DataSource(GuiPreferences.Instance.WorkDirectory + "TrainSet_" + GuiPreferences.Instance.NudClassifyUsingTR.ToString() + "th_vectors_scaledCS.libsvm.arff");
            data   = source.getDataSet();

            //filter top IG
            data = WekaTrainingMethods.useRemoveFilter(data, TrainingTesting_SharedVariables._trainTopIGFeatures, true);

            //after filtering last feature needs to be the class
            if (data.classIndex() == -1)
            {
                data.setClassIndex(data.numAttributes() - 1);
            }

            //save filtered to a file
            WekaCommonFileOperation.SaveLIBSVM(data, GuiPreferences.Instance.WorkDirectory + "TrainSet_" + GuiPreferences.Instance.NudClassifyUsingTR.ToString() + "th_vectors_scaledCS_filteredIG");

            return(data);
        }
コード例 #5
0
        public static void loadConfigFile()
        {
            Preferences.Instance.configFile = XMLSerializer.DeserializeFile <Dictionary <string, string> >(GuiPreferences.Instance.WorkDirectory + "config.xml");
            //GuiPreferences.Instance.WorkDirectory = Preferences.Instance.configFile["WorkDirectory"];


            //same protocol safety check
            ProtocolSafetyCheck();

            try
            {
                Preferences.Instance.dirList =
                    new List <string>(Preferences.Instance.configFile["dirList"].Split(new[] { ',' }));
            }
            catch (Exception e)
            {
                GuiPreferences.Instance.setLog("WARNING: dirList missing must be an old version of config.xml, rerun this model");
            }

            try
            {
                GuiPreferences.Instance.NormalizedType  = (NormalizationType)Enum.Parse(typeof(NormalizationType), Preferences.Instance.configFile["NormalizationType"]);
                GuiPreferences.Instance.NudMovingWindow = Convert.ToDecimal(Preferences.Instance.configFile["NudMovingWindow"]);
            }
            catch (Exception e)
            {
                GuiPreferences.Instance.NormalizedType = NormalizationType.MinMax;
                GuiPreferences.Instance.setLog("WARNING: NormalizationType missing must be an old version of config.xml, rerun this model, defaulting to minmax");
            }

            try
            {
                GuiPreferences.Instance.IgSelectionType  = (IGType)Enum.Parse(typeof(IGType), Preferences.Instance.configFile["IgSelectionType"]);
                GuiPreferences.Instance.NudIGVoxelAmount = Convert.ToInt32(Preferences.Instance.configFile["NudIGVoxelAmount"]);
                GuiPreferences.Instance.NudIGThreshold   = Convert.ToDecimal(Preferences.Instance.configFile["NudIGThreshold"]);

                if (GuiPreferences.Instance.IgSelectionType == IGType.Threshold)
                {
                    GuiPreferences.Instance.setLog("Filtering using IG threshold: " + GuiPreferences.Instance.NudIGThreshold.ToString());
                }
                else if (GuiPreferences.Instance.IgSelectionType == IGType.Voxels)
                {
                    GuiPreferences.Instance.setLog("Filtering using IG Voxel Amount of: " + GuiPreferences.Instance.NudIGVoxelAmount.ToString());
                }
            }
            catch (Exception e)
            {
                GuiPreferences.Instance.IgSelectionType  = IGType.Threshold;
                GuiPreferences.Instance.NudIGThreshold   = Convert.ToDecimal(Preferences.Instance.configFile["NudIGThreshold"]);
                GuiPreferences.Instance.NudIGVoxelAmount = 100; // default value
                GuiPreferences.Instance.setLog("WARNING: IG SELECTION TYPE is missing must be an old version of config.xml, rerun this model, defaulting to Threshold selection + correct threshold figure");
            }


            GuiPreferences.Instance.FileType                 = (DataType)Enum.Parse(typeof(DataType), Preferences.Instance.configFile["dataType.rawValue"]);
            GuiPreferences.Instance.NudThreshold             = Convert.ToDecimal(Preferences.Instance.configFile["NudThreshold"]);
            GuiPreferences.Instance.NudExtractFromTR         = Convert.ToDecimal(Preferences.Instance.configFile["NudExtractFromTR"]);
            GuiPreferences.Instance.NudExtractToTR           = Convert.ToDecimal(Preferences.Instance.configFile["NudExtractToTR"]);
            GuiPreferences.Instance.NudClassifyUsingTR       = Convert.ToDecimal(Preferences.Instance.configFile["NudClassifyUsingTR"]);
            GuiPreferences.Instance.NudFilterEyeSlices       = Convert.ToDecimal(Preferences.Instance.configFile["NudFilterEyeSlices"]);
            GuiPreferences.Instance.NudEyeSliceFirstLines    = Convert.ToDecimal(Preferences.Instance.configFile["NudEyeSliceFirstLines"]);
            GuiPreferences.Instance.CbPeekHigherTRsIGChecked = Convert.ToBoolean(Preferences.Instance.configFile["CbPeekHigherTRsIGChecked"]);
        }
コード例 #6
0
        /// <summary>
        /// quick tests udp classification via weka's SMO
        /// </summary>
        /// <returns></returns>
        public bool testUdpWekaSMO()
        {
            if (UDPListenActive)
            {
                TrainingTesting_SharedVariables.binary.shouldStop = true;
                GuiPreferences.Instance.setLog("Stopping UDP");
            }
            else
            {
                GuiPreferences.Instance.setLog("Starting UDP");
                TrainingTesting_SharedVariables.binary.shouldStop = false;


                //GuiPreferences.Instance.WorkDirectory = @"H:\My_Dropbox\VERE\MRI_data\Tirosh\20113110.short.5th.exp.hands.legs.zscore.thought\6\rtp\";
                //GuiPreferences.Instance.FileName = "tirosh-";
                //GuiPreferences.Instance.FileType = OriBrainLearnerCore.dataType.rawValue;
                //GuiPreferences.Instance.ProtocolFile = @"H:\My_Dropbox\VERE\MRI_data\Tirosh\20113110.short.5th.exp.hands.legs.zscore.thought_LRF.prt";

                // tirosh null movement processed for 204800 features + 1 class = 204801.

                /*GuiPreferences.Instance.WorkDirectory = @"H:\My_Dropbox\VERE\MRI_data\Tirosh\20120508.Rapid+NullClass.day2\1\rtp\";
                 * GuiPreferences.Instance.FileName = "tirosh-";
                 * GuiPreferences.Instance.FileType = OriBrainLearnerCore.dataType.rawValue;
                 * GuiPreferences.Instance.ProtocolFile = @"H:\My_Dropbox\VERE\MRI_data\Tirosh\20120705.NullClass1_zbaseline.prt";
                 */

                // magali classification

                /*GuiPreferences.Instance.WorkDirectory = @"H:\My_Dropbox\VERE\Experiment1\Kozin_Magali\20121231.movement.3.imagery.1\18-classification.movement\rtp\";
                 * GuiPreferences.Instance.FileName = "tirosh-";
                 * GuiPreferences.Instance.FileType = OriBrainLearnerCore.dataType.rawValue;
                 * GuiPreferences.Instance.ProtocolFile = @"H:\My_Dropbox\VERE\MRI_data\Tirosh\20113110.short.5th.exp.hands.legs.zscore.thought_LRF.prt";*/


                /// moshe sherf classification, 4 aggregated to test on 1.
                GuiPreferences.Instance.WorkDirectory = @"H:\My_Dropbox\VERE\Experiment1\Sherf_Moshe\20121010.movement.1\15_classification\rtp\";
                GuiPreferences.Instance.FileName      = "tirosh-";
                GuiPreferences.Instance.FileType      = OriBrainLearnerCore.DataType.rawValue;
                GuiPreferences.Instance.ProtocolFile  = @"H:\My_Dropbox\VERE\MRI_data\Tirosh\20113110.short.5th.exp.hands.legs.zscore.thought_LRF.prt";

                //read prot file
                Preferences.Instance.prot = new ProtocolManager();

                //get all files in the path with this extention
                GuiManager.getFilePaths("*.vdat");

                //update certain info
                GuiManager.updateFilePaths();

                //assigned after we know what to assign from the protocol
                //PublicMethods.setClassesLabels();
                GuiPreferences.Instance.CmbClass1Selected = 1; //left
                GuiPreferences.Instance.CmbClass2Selected = 2; //right

                //NEED TO ADD A VARIABLE FOR EVERY OPTION IN THE GUI. RAW VALUES. UNPROCESSED. MULTI CLASS. CROSS VALD, GRID, FOLDS, ETC...
                //and for every button a function!

                /*PublicMethods.clearProblem() ;
                 * PublicMethods.clearSVM();
                 * PublicMethods.clearJob();
                 * GC.Collect();*/

                //load a model for testing
                GuiPreferences.Instance.TrainType = TrainingType.Weka;
                GuiPreferences.Instance.setLog("Deserializing Model");
                WekaTrainingMethods.loadModel();

                double[][] rankedArray = XMLSerializer.DeserializeFile <double[][]>(GuiPreferences.Instance.WorkDirectory + "TrainSet_" + GuiPreferences.Instance.NudClassifyUsingTR.ToString() + "th_vectors_scaledCS_filteredIG_indices.xml");
                for (int a = 0; a < rankedArray.Length; a++)
                {
                    TrainingTesting_SharedVariables._trainTopIGFeatures[a] = Convert.ToInt32(rankedArray[a][0]);
                }

                //this should be done ONCE - move elsewhere.
                Preferences.Instance.fastvector = RealTimeProcessing.CreateFastVector(TrainingTesting_SharedVariables._trainTopIGFeatures.Length);

                //GuiPreferences.Instance.FromTR = from;// 264;
                //GuiPreferences.Instance.ToTR = 100;// 264;
                Preferences.Instance.currentUDPVector = 0;
                Preferences.Instance.udp.RegisterCallBack(TrainingTesting_SharedVariables.binary.loadRawDataUsing_UDP);

                //finally load
                //PublicMethods.binary.loadRawData();

                /*
                 *  //register this function that deals with loading of the filenames
                 *  //BUT ONLY ONCE!
                 *  Preferences.Instance.pipeServer.registerEvent(PublicMethods.binary.loadRawDataUsingPipes_ReceiveData);
                 *
                 *  //PublicMethods.binary.loadRawDataUsingPipes_SendData();
                 *
                 *  //* to automatically send data ever 2s as a simulation and to test the classes.
                 *  PublicMethods.binary.loadRawDataUsingPipes_SendDataTimer();
                 */
            }

            UDPListenActive = !UDPListenActive;
            return(true);
        }