private static void StartTrainingCycle() { // erzeugt die RequestListener CRFToolApp.Build.Do(); CRFBase.Build.Do(); CRFGraphVis.Build.Do(); // starting of TrainingCycle: var trainingCycle = new TrainingEvaluationCycleZellner(); var parameters = new TrainingEvaluationCycleInputParameters(); // take OLM variants we want to test List <OLMVariant> variants = new List <OLMVariant> { //OLMVariant.Ising //OLMVariant.IsingII OLMVariant.IsingIII //OLMVariant.Default }; Log.Post("Training variant: " + variants[0]); // setting of transition probabilities to create observation from reference labeling double[,] transition = SetTransitionProbabilities(); #region modify graphs // do this for all graphs (currently saved in form of pdbfiles) List <GWGraph <CRFNodeData, CRFEdgeData, CRFGraphData> > crfGraphList = new List <GWGraph <CRFNodeData, CRFEdgeData, CRFGraphData> >(); var id = 0; foreach (String file in File.ReadLines(fileNames)) { RandomlySelectedPDBFile = fileFolder + "/" + file; RandomlySelectedPDBFileName = file.Substring(0, 4); var pdbFile = PDBExt.Parse(RandomlySelectedPDBFile); pdbFile.Name = RandomlySelectedPDBFileName; // set IsCore nodes, cuz we only need the interface nodes (the core nodes cannot interact) var proteinGraph = SetIsCore(pdbFile); // trim graph -> remove isCore nodes var trimmedGraph = TrimGraph(pdbFile, proteinGraph); // set real reference label of the graph var crfGraph = SetReferenceLabel(trimmedGraph); SetEdgeMaxDiffValues(crfGraph); crfGraph.Id = id++; crfGraphList.Add(crfGraph); } #endregion // set parameters for the training cycle parameters = new TrainingEvaluationCycleInputParameters(crfGraphList, crfGraphList.Count, variants, IsingConformityParameter, PottsConformityParameters, IsingCorrelationParameter, PottsCorrelationParameters, NumberOfIntervals, transition, NumberOfLabels, BufferSizeViterbi, amplifierControlParameter, Threshold); // running the cycle trainingCycle.RunCycle(parameters); }
private static void startTrainingCycle() { // erzeugt die RequestListener Build.Do(); // calculation of the termination condition for the seeding method double[] averageRatioItoS = calculateTerminationConditionForSeeding(); // starting of TrainingCycle: var trainingCycle = new TrainingEvaluationCycle(); var parameters = new TrainingEvaluationCycleInputParameters(); // take OLM variants we want to test, ISING and OLM_III (Default) List <OLMVariant> variants = new List <OLMVariant>(); variants.Add(OLMVariant.Ising); variants.Add(OLMVariant.Default); // setting of transition probabilities //var a = 0.5 + 0.15 * rdm.NextDouble(); var a = 0.85; var b = 0.85; double[,] transition = new double[2, 2] { { a, 1 - a }, { 1 - b, b } }; #region modify graph var pdbFile = PDBExt.Parse(RandomlySelectedPDBFile); pdbFile.Name = RandomlySelectedPDBFileName; // setzen der IsCore var rasaRequest = new RequestRasa(pdbFile); rasaRequest.RequestInDefaultContext(); foreach (var rasa in rasaRequest.Rasavalues) { rasa.Key.IsCore = rasa.Value <= 0.15; } var proteinGraph = CreateProteinGraph.Do(pdbFile, 7.0, ResidueNodeCenterDefinition.CAlpha).Values.First(); // graph trimmen var trimmedGraph = trimGraph(pdbFile, proteinGraph); // set real reference label of the graph var nameWithChain = RandomlySelectedPDBFile.Substring(fileFolder.Length + 1, 6); var interfacesList = new List <string>(); using (var reader = new StreamReader(InterfaceDefLocation)) { var line = ""; while ((line = reader.ReadLine()) != null) { var nuss = nameWithChain; if (line.StartsWith(nameWithChain)) { interfacesList.Add(line.Substring(8)); } } } foreach (var interfaceEntry in interfacesList) { var node = trimmedGraph.Nodes.FirstOrDefault(n => n.Data.Residue.Id.Equals(interfaceEntry)); if (node != null) { node.Data.ReferenceLabel = 1; } } #endregion //test if (GraphVisualization) { var graph3D = trimmedGraph.Wrap3D(nd => new Node3DWrap <ResidueNodeData>(nd.Data) { ReferenceLabel = nd.Data.ReferenceLabel, X = nd.Data.X, Y = nd.Data.Y, Z = nd.Data.Z }); new ShowGraph3D(graph3D).Request(RequestRunType.Background); Thread.Sleep(120000); } var crfGraph = trimmedGraph.Convert <ResidueNodeData, CRFNodeData, SimpleEdgeData, CRFEdgeData, ProteinGraphData, CRFGraphData>(nd => new CRFNodeData(nd.Data.Residue.Id) { X = nd.Data.X, Y = nd.Data.Y, Z = nd.Data.Z }, ed => new CRFEdgeData(), gd => new CRFGraphData()); crfGraph.SaveAsJSON("testGraph.txt"); // setting the MaximumTotalPatchSize based on the ratio calculated with the hermann data int min = (int)(crfGraph.NodeCounter * averageRatioItoS[1]); int max = (int)(crfGraph.NodeCounter * averageRatioItoS[2]); int av = (int)(crfGraph.NodeCounter * averageRatioItoS[0]); int MaximumTotalPatchSize = rdm.Next(min, max); // set parameters for the training cycle parameters = new TrainingEvaluationCycleInputParameters(crfGraph, NumberOfGraphInstances, NumberOfSeedsForPatchCreation, MaximumTotalPatchSize, variants, IsingConformityParameter, IsingCorrelationParameter, transition, NumberOfLabels, BufferSizeViterbi); // running the cycle trainingCycle.RunCycle(parameters); }