Changeset 7401 for trunk/MagicSoft/Mars/macros/optim
- Timestamp:
- 11/15/05 11:36:17 (19 years ago)
- Location:
- trunk/MagicSoft/Mars/macros/optim
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/macros/optim/optimdisp.C
r7153 r7401 1 /* More explanations at the end of the file */ 1 2 void optimdisp() 2 3 { 3 MJOptimizeDisp opt; 4 opt.SetDebug(2); 5 opt.SetOptimizer(MJOptimize::k Simplex);6 opt.EnableTestTrain(); 4 MJOptimizeDisp opt; // Initialize optimization class 5 opt.SetDebug(2); // Choose the level of output 6 opt.SetOptimizer(MJOptimize::kMigrad); // Choose the fit algorithm (see MJOptimize) 7 opt.EnableTestTrain(); // Split sample into test and train 7 8 8 9 // -------------------- Setup ---------------------------- 9 //opt.AddParameter("1-(MHillas.fWidth/MHillas.fLength)"); 10 opt.AddParameter("atan(1./(1-(MHillas.fWidth/MHillas.fLength)))"); 11 //opt.AddParameter("log10(MNewImagePar.fLeakage1+1)"); 10 opt.AddParameter("1-(MHillas.fWidth/MHillas.fLength)"); // M[0] 11 opt.AddParameter("log10(MNewImagePar.fLeakage1+1)"); // M[1] 12 12 13 opt. FixParameter(0, 0.743871, 0, 2); //0.56267614 opt. FixParameter(1, 0.329471, 0, 2); //0.31731515 opt. FixParameter(2, 1.500002, 0, 10); //1.5575413 opt.SetParameter(0, 1.30871); // Setup [0] 14 opt.SetParameter(1, 5.81119); // Setup [1] 15 opt.SetParameter(2, 0.763486); // Setup [2] 16 16 17 // Leakage==0: RMS = 0.030 18 // Leakage>0: RMS = 0.010 19 20 // all: 0.029 (0.605991, 0.332266, 1.50825) 21 22 //char *r = "([0]+(pow(M[1],[1])*[2]))/M[0]"; 23 //char *r = "([0]+(pow(M[1],[1])*[2]))*M[0]"; 24 //char *r = "[0]*M[0]"; 25 char *r = "[0]/M[0]"; 17 char *r = "([0]+([1]*pow(M[1], [2])))*M[0]"; // Rule to calc Disp 26 18 27 19 // -------------------- Run ---------------------------- … … 30 22 opt.SetDisplay(d); 31 23 32 opt.AddPreCut("MNewImagePar.fLeakage1<0.0001"); 24 /* 25 -------------------- Magic-Cuts ---------------------- 26 MFMagicCuts cuts; 27 cuts.SetHadronnessCut(MFMagicCuts::kArea); 28 cuts.SetThetaCut(MFMagicCuts::kOn); 29 30 TArrayD arr(10); 31 arr[0]= 1.3245; 32 arr[1]= 0.208700; 33 arr[2]= 0.229200; 34 arr[3]= 5.305200; 35 arr[4]= 0.098930; 36 arr[5]= -0.082950; 37 arr[6]= 8.2957; 38 arr[7]= 0.8677; 39 40 cuts.SetVariables(arr); 41 42 opt.AddPreCut(&cuts); 43 44 -------------------- Other cuts ---------------------- 45 opt.AddPreCut("MNewImagePar.fLeakage1<0.0001"); 46 */ 47 33 48 opt.RunDisp("ganymedmcpart.root", r); 34 49 } 50 51 /* ------------------ Good strategy ------------------- 52 1) first fix parameters: 53 opt.FixParameter(1, 0); 54 opt.FixParameter(2, 1); 55 and process only showers without leakage 56 opt.AddPreCut("MNewImagePar.fLeakage1<0.0001"); 57 2) release parameters 1 and 2 and fix 0 to the result of 1) 58 opt.FixParameter(0, 0.8362); 59 opt.SetParameter(1, 2.0); 60 opt.SetParameter(2, 0.8); 61 and process only showers with leakage 62 opt.AddPreCut("MNewImagePar.fLeakage1>0.0001"); 63 3) release all parameters and start with the result of 1) and 2) 64 opt.SetParameter(0, 0.8362); 65 opt.SetParameter(1, 5.84); 66 opt.SetParameter(2, 0.76); 67 and process all showers. (Comment out opt.PreCuts()) 68 */ -
trunk/MagicSoft/Mars/macros/optim/optimenergy.C
r7170 r7401 18 18 opt.SetDisplay(d); 19 19 20 //opt.AddPreCut("MNewImagePar.fLeakage1<0.0001"); 20 /* 21 -------------------- Magic-Cuts ---------------------- 22 MFMagicCuts cuts; 23 cuts.SetHadronnessCut(MFMagicCuts::kArea); 24 cuts.SetThetaCut(MFMagicCuts::kOn); 25 26 TArrayD arr(10); 27 arr[0]= 1.3245; 28 arr[1]= 0.208700; 29 arr[2]= 0.229200; 30 arr[3]= 5.305200; 31 arr[4]= 0.098930; 32 arr[5]= -0.082950; 33 arr[6]= 8.2957; 34 arr[7]= 0.8677; 35 36 cuts.SetVariables(arr); 37 38 opt.AddPreCut(&cuts); 39 40 -------------------- Other cuts ---------------------- 41 opt.AddPreCut("MPointingPos.fZd<7"); 42 */ 43 21 44 opt.RunEnergy("ganymedmcpart.root", r); 22 45 } -
trunk/MagicSoft/Mars/macros/optim/rfenergyest.C
r7396 r7401 1 1 void rfenergyest() 2 2 { 3 MSequence seqtst("~/Software/ Mars/mranforest/sequencemc-test.txt");4 MSequence seqtrn("~/Software/ Mars/mranforest/sequencemc-train.txt");3 MSequence seqtst("~/Software/mc/sequencemc-test.txt"); 4 MSequence seqtrn("~/Software/mc/sequencemc-train.txt"); 5 5 6 6 if (!seqtst.IsValid()) … … 22 22 23 23 MDirIter iter, iter2; 24 seqtrn.SetupDatRuns(iter, MSequence::kImages, "~/Software/mc ");25 seqtst.SetupDatRuns(iter2, MSequence::kImages, "~/Software/mc ");24 seqtrn.SetupDatRuns(iter, MSequence::kImages, "~/Software/mc/img-abs"); 25 seqtst.SetupDatRuns(iter2, MSequence::kImages, "~/Software/mc/img-abs"); 26 26 27 27 read.AddFiles(iter); … … 60 60 fill.SetReader(&read); 61 61 62 /* ---------- It doesn't seem to improve anything ---------- 63 MFMagicCuts cuts; 64 65 cuts.SetHadronnessCut(MFMagicCuts::kArea); 66 cuts.SetThetaCut(MFMagicCuts::kOn); 67 68 TArrayD arr(10); 69 arr[0]= 1.3245; 70 arr[1]= 0.208700; 71 arr[2]= 0.229200; 72 arr[3]= 5.305200; 73 arr[4]= 0.098930; 74 arr[5]= -0.082950; 75 arr[6]= 8.2957; 76 arr[7]= 0.8677; 77 78 cuts.SetVariables(arr); 79 80 fill.AddPreCut(&cuts); 81 82 --------------- Use the cuts also in test-loop ---------------- 83 */ 84 62 85 if (!fill.Process()) 63 86 return; … … 71 94 MBinning b(32, 10, 100000, "BinningEnergyEst", "log"); 72 95 /* 73 if (!rf.TrainMultiRF(train, b.GetEdgesD())) // classification 96 if (!rf.TrainMultiRF(train, b.GetEdgesD())) // classification with one tree per bin 74 97 return; 75 98 76 if (!rf.TrainSingleRF(train, b.GetEdgesD())) // classification 99 if (!rf.TrainSingleRF(train, b.GetEdgesD())) // classification into different bins 77 100 return; 78 101 */ 79 if (!rf.TrainSingleRF(train)) // regression 102 if (!rf.TrainSingleRF(train)) // regression (best choice) 80 103 return; 81 104 … … 90 113 91 114 MHEnergyEst hist; 115 //MContinue cont(&cuts); 116 //cont.SetInverted(); 92 117 MFillH fillh(&hist); 93 118 94 119 tlist.AddToList(&read2); 120 //tlist.AddToList(&cont); 95 121 tlist.AddToList(&rf); 96 122 tlist.AddToList(&fillh);
Note:
See TracChangeset
for help on using the changeset viewer.