private void doTraining(CreatePredictorVM vm, IEnumerable <PDBFile> trainingFiles, IDictionary <string, IDictionary <Residue, bool> > referenceInterface, IDictionary <string, IDictionary <string, ProteinGraph> > graphs) { var Feature = new AverageHydrophobicityFeature(); var values = new LinkedList <AgO <double, ResidueNode> >(); foreach (var trainingFile in trainingFiles) { var req = new RequestRasa(trainingFile); req.RequestInDefaultContext(); var rasa = req.Rasavalues; foreach (var entry in graphs[trainingFile.Name]) { Feature.Compute(entry.Value); //values.AddRange(entry.Value.Nodes.Select(node => new AgO<double, ResidueNode>(Feature.ValueOf(node.Data.Residue) * rasa[node.Data.Residue], node.D //))); } } Max = values.Max(v => v.Data1); //var intervals = values.DivideByScoreAequidistant(val => val.Data1, vm.DivisionIntervals); //var pts = new LinkedList<AgO<double, double>>(); //for (int i = 0; i < intervals.Length; i++) //{ // var interval = intervals[i]; // var pt = new AgO<double, double>(); // pt.Data1 = ((double)i + 1) / intervals.Length; // var iface = (interval.Sum(val => referenceInterface[val.Data2.Residue.PDB.Name][val.Data2.Residue] ? 1.0 : 0.0)); // pt.Data2 = iface / interval.Count(); // pts.Add(pt); //} //ValueFunction = new StepFunction(pts); }
private void doTraining(CreatePredictorVM vm, IEnumerable <PDBFile> trainingFiles, IDictionary <string, IDictionary <Residue, bool> > referenceInterface, IDictionary <string, IDictionary <string, ProteinGraph> > graphs) { var Feature = new AverageHydrophobicityFeature(); var values = new LinkedList <AgO <double, ResidueNode> >(); foreach (var trainingFile in trainingFiles) { var req = new RequestRasa(trainingFile); req.RequestInDefaultContext(); var rasa = req.Rasavalues; foreach (var entry in graphs[trainingFile.Name]) { Feature.Compute(entry.Value); //values.AddRange(entry.Value.Nodes.Select(node => new AgO<double, ResidueNode>(Feature.ValueOf(node.Data.Residue) * rasa[node.Data.Residue], node))); } } Max = values.Max(v => v.Data1); }
public RasaAverageHydrophobicityPredictor(CreatePredictorVM vm) { Threshold = vm.Threshold; logic = new PredictionLogic(doPrediction, doTraining); this.Name(vm.Name); }
public static void Train(this IHas <IPredictionLogic> logicHolder, CreatePredictorVM vm, IEnumerable <PDBFile> trainingFiles, IDictionary <string, IDictionary <Residue, bool> > referenceInterface, IDictionary <string, IDictionary <string, ProteinGraph> > graphs) { logicHolder.Logic.Train(vm, trainingFiles, referenceInterface, graphs); }
public void Train(CreatePredictorVM vm, IEnumerable <PDBFile> trainingFiles, IDictionary <string, IDictionary <Residue, bool> > referenceInterface, IDictionary <string, IDictionary <string, ProteinGraph> > graphs) { TrainingAction(vm, trainingFiles, referenceInterface, graphs); TrainingPDBs.AddRange(trainingFiles.Select(file => file.Name)); }
public CreatePredictor(CreatePredictorVM vm) { ViewModel = vm; }