public analizer(string analysisFolderName, List <List <double> > MainGrid, DB db, recordConfig rc) { this.analysisFolderName = analysisFolderName; this.MainGrid = MainGrid; this.db = db; this.rc = rc; }
public decicionTree(recordConfig rc, DB db, bool[] Dime2Take) { this.training_dt = db.training_dt; this.training_label = db.training_label; this.training_GridIndex_dt = db.DBtraining_GridIndex_dt; this.rc = rc; this.Dime2Take = Dime2Take; }
public GeoWave(int[][] BOX, int labelDim, recordConfig rc) { this.rc = rc; Init(rc.dim, labelDim); for (int i = 0; i < 2; i++) { for (int j = 0; j < rc.dim; j++) { boubdingBox[i][j] = BOX[i][j]; } } }
public GeoWave(int[][] BOX, int labelDim, recordConfig rc) { this.rc = rc; Init(rc.dim, labelDim); for (int i = 0; i < 2; i++) { for (int j = 0; j < rc.dim; j++) // YAIR only copy all the 'regular' variables, leave the PLS as is { boubdingBox[i][j] = BOX[i][j]; } } //Array.Copy(BOX, boubdingBox, BOX[0].Count() * 2); //boubdingBox = BOX.Select(s => s.ToArray()).ToArray(); //BOX.CopyTo(boubdingBox, 0); }
private bool[] getDim2Take(recordConfig rc, int Seed) { bool[] Dim2Take = new bool[rc.dim]; var ran = new Random(Seed); for (int i = 0; i < rc.NDimsinRF; i++) { //Dim2Take[dimArr[i]] = true; int index = ran.Next(0, rc.dim); if (Dim2Take[index] == true) { i--; } else { Dim2Take[index] = true; } } return(Dim2Take); }
private bool[] getDim2Take(recordConfig rc, int Seed) { bool[] Dim2Take = new bool[rc.dim]; var ran = new Random(Seed); //List<int> dimArr = Enumerable.Range(0, rc.dim).OrderBy(x => ran.Next()).ToList().GetRange(0, rc.dim); //List<int> dimArr = Enumerable.Range(0, rc.dim).OrderBy(x => ran.Next()).ToList().GetRange(0, rc.dim); for (int i = 0; i < rc.NDimsinRF; i++) { int index = ran.Next(0, rc.dim); if (Dim2Take[index] == true) { i--; } else { Dim2Take[index] = true; } } return(Dim2Take); }
private void Run() { //SET PARAMETERS rumPrallel = rumPrallelCB.Checked; //runProoning = runPrunningCB.Checked; runRFPrunning = runRFPrunningCB.Checked; runRf = runRfCB.Checked; string results_path = @ResultsTB.Text; string db_path = @DBTB.Text + "\\"; MainFolderName = results_path; if (!System.IO.Directory.Exists(MainFolderName)) { System.IO.Directory.CreateDirectory(MainFolderName); } //READ DATA DB db = new DB(); db.training_dt = db.getDataTable(db_path + "trainingData.txt"); db.testing_dt = db.getDataTable(db_path + "testingData.txt"); db.validation_dt = db.getDataTable(db_path + "ValidData.txt"); db.training_label = db.getDataTable(db_path + "trainingLabel.txt"); db.testing_label = db.getDataTable(db_path + "testingLabel.txt"); db.validation_label = db.getDataTable(db_path + "ValidLabel.txt"); //BOUNDING BOX AND GRID db.DBtraining_GridIndex_dt = new long[db.training_dt.Count()][]; for (int i = 0; i < db.training_dt.Count(); i++) { db.DBtraining_GridIndex_dt[i] = new long[db.training_dt[i].Count()]; } boundingBox = db.getboundingBox(db.training_dt); MainGrid = db.getMainGrid(db.training_dt, boundingBox, ref db.DBtraining_GridIndex_dt); bool useCrossValidation = croosValidCB.Checked; List <recordConfig> recArr = new List <recordConfig>(); int NCrossValidation = 1; if (useCrossValidation && !int.TryParse(croosValidTB.Text, out NCrossValidation)) { MessageBox.Show("Num of Cross validation folders wasn't provided"); } for (int j = 0; j < NCrossValidation; j++) { recordConfig rc = new recordConfig(); rc.dim = db.training_dt[0].Count(); rc.approxThresh = double.Parse(approxThreshTB.Text); rc.partitionErrType = int.Parse(partitionTypeTB.Text); rc.minWaveSize = int.Parse(minNodeSizeTB.Text); rc.rfBaggingPercent = double.Parse(bagginPercentTB.Text); // 0.6; rc.rfNum = int.Parse(NrfTB.Text); // k + 1;//10 + k*10;// 100 / (k + 46) * 2;// int.Parse(Math.Pow(10, k + 1).ToString()); rc.BoundLevel = int.Parse(boundLevelTB.Text); //1024; if (NfeaturesrfTB.Text == "all") { rc.NDimsinRF = db.training_dt[0].Count(); } else if (NfeaturesrfTB.Text == "sqrt") { rc.NDimsinRF = (int)Math.Ceiling((Convert.ToDouble(Math.Sqrt(rc.dim)))); } else if (NfeaturesrfTB.Text == "div") { rc.NDimsinRF = (int)Math.Ceiling((Convert.ToDouble(rc.dim / 3))); } else { rc.NDimsinRF = int.Parse(NfeaturesrfTB.Text); } rc.split_type = int.Parse(splitTypeTB.Text); //0 rc.NormLPTypeInEstimation = int.Parse(errTypeEstimationTB.Text); rc.boundDepthTree = int.Parse(boundDepthTB.Text); //1024; rc.CrossValidFold = j; recArr.Add(rc); } //CREATE DIRS for (int i = 0; i < recArr.Count; i++) { if (!System.IO.Directory.Exists(MainFolderName + "\\" + recArr[i].getShortName())) { System.IO.Directory.CreateDirectory(MainFolderName + "\\" + recArr[i].getShortName()); StreamWriter sw = new StreamWriter(MainFolderName + "\\" + recArr[i].getShortName() + "\\record_properties.txt", false); sw.WriteLine(recArr[i].getFullName()); sw.Close(); u_config.printConfig(MainFolderName + "\\config.txt", null); } } //SET ID ARRAY LIST List <int> trainingID = Enumerable.Range(0, db.training_dt.Count()).ToList(); List <int> testingID = Enumerable.Range(0, db.testing_dt.Count()).ToList(); List <List <int> > trainingFoldId = new List <List <int> >(); List <List <int> > testingFoldId = new List <List <int> >(); var ran = new Random(2); List <int> training_rand = trainingID.OrderBy(x => ran.Next()).ToList().GetRange(0, trainingID.Count); if (useCrossValidation) { createCrossValid(NCrossValidation, training_rand, trainingFoldId, testingFoldId); } //BOUNDING INTERVALS int[][] BB = new int[2][]; BB[0] = new int[boundingBox[0].Count()]; BB[1] = new int[boundingBox[0].Count()]; for (int i = 0; i < boundingBox[0].Count(); i++) { BB[1][i] = MainGrid[i].Count() - 1;//set last index in each dim } for (int i = 0; i < recArr.Count; i++) { analizer Analizer = new analizer(MainFolderName + "\\" + recArr[i].getShortName(), MainGrid, db, recArr[i]); if (!croosValidCB.Checked) { Analizer.analize(trainingID, testingID, BB); } else { Analizer.analize(trainingFoldId[recArr[i].CrossValidFold], testingFoldId[recArr[i].CrossValidFold], BB);//cross validation } } }
public void generateRecordConfigArr() { for (int i0 = 0; i0 < dim.Count; i0++) { for (int i1 = 0; i1 < approxThresh.Count; i1++) { for (int i2 = 0; i2 < partitionErrType.Count; i2++) { for (int i3 = 0; i3 < approxOrder.Count; i3++) { for (int i4 = 0; i4 < boostNum.Count; i4++) { for (int i5 = 0; i5 < boostlamda_0.Count; i5++) { for (int i6 = 0; i6 < boostNormTarget.Count; i6++) { for (int i7 = 0; i7 < boostNormsecond.Count; i7++) { for (int i8 = 0; i8 < boostTau.Count; i8++) { for (int i9 = 0; i9 < rfNum.Count; i9++) { for (int i10 = 0; i10 < rfBaggingPercent.Count; i10++) { for (int i11 = 0; i11 < NskipsinKfunc.Count; i11++) { for (int i12 = 0; i12 < minWaveSize.Count; i12++) { for (int i13 = 0; i13 < hopping_size.Count; i13++) { for (int i14 = 0; i14 < test_error_size.Count; i14++) { for (int i15 = 0; i15 < boostProoning_0.Count; i15++) { recordConfig rc = new recordConfig(dim[i0], approxThresh[i1], partitionErrType[i2], approxOrder[i3], boostNum[i4], boostlamda_0[i5], boostNormTarget[i6], boostNormsecond[i7], boostTau[i8], rfNum[i9], rfBaggingPercent[i10], NskipsinKfunc[i11], minWaveSize[i12], hopping_size[i13], test_error_size[i14], boostProoning_0[i15]); recArr.Add(rc); } } } } } } } } } } } } } } } } }
public GeoWave(int dataDim, int labelDim, recordConfig rc) { this.rc = rc; Init(dataDim, labelDim); }