- Timestamp:
- 08/07/09 16:50:07 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Server/3.3/SimpleDispatcher.cs
r2223 r2258 60 60 case LearningTask.Regression: { 61 61 var regressionAlgos = algos.Where(a => (a as IClassificationAlgorithm) == null && (a as ITimeSeriesAlgorithm) == null); 62 selectedAlgorithm = ChooseDeterministic(targetVariable, inputVariables, regressionAlgos) ?? ChooseStochastic(regressionAlgos);62 selectedAlgorithm = ChooseDeterministic(targetVariable, inputVariables, regressionAlgos); // ?? ChooseStochastic(regressionAlgos); 63 63 break; 64 64 } … … 99 99 100 100 private void PopulateFinishedRuns() { 101 //Dictionary<Entity, Entity> processedModels = new Dictionary<Entity, Entity>(); 102 //var datasetBindings = store 103 // .Query( 104 // "?Dataset <" + Ontology.InstanceOf + "> <" + Ontology.TypeDataSet + "> .", 0, 1) 105 // .Select(x => (Entity)x.Get("Dataset")); 106 107 //if (datasetBindings.Count() > 0) { 108 // var datasetEntity = datasetBindings.ElementAt(0); 109 110 // DataSet ds = new DataSet(store, datasetEntity); 111 // var result = store 112 // .Query( 113 // "?Model <" + Ontology.TargetVariable + "> ?TargetVariable ." + Environment.NewLine + 114 // "?Model <" + Ontology.Name + "> ?AlgoName .", 115 // 0, 1000) 116 // .Select(x => new Resource[] { (Literal)x.Get("TargetVariable"), (Literal)x.Get("AlgoName"), (Entity)x.Get("Model") }); 117 118 // foreach (Resource[] row in result) { 119 // Entity model = ((Entity)row[2]); 120 // if (!processedModels.ContainsKey(model)) { 121 // processedModels.Add(model, model); 122 123 // string targetVariable = (string)((Literal)row[0]).Value; 124 // string algoName = (string)((Literal)row[1]).Value; 125 // int targetVariableIndex = ds.Problem.Dataset.GetVariableIndex(targetVariable); 126 127 // var inputVariableLiterals = store 128 // .Query( 129 // "<" + model.Uri + "> <" + Ontology.HasInputVariable + "> ?InputVariable ." + Environment.NewLine + 130 // "?InputVariable <" + Ontology.Name + "> ?Name .", 131 // 0, 1000) 132 // .Select(x => (Literal)x.Get("Name")) 133 // .Select(l => (string)l.Value) 134 // .Distinct(); 135 136 // List<int> inputVariables = new List<int>(); 137 // foreach (string variableName in inputVariableLiterals) { 138 // int variableIndex = ds.Problem.Dataset.GetVariableIndex(variableName); 139 // inputVariables.Add(variableIndex); 140 // } 141 // if (!AlgorithmFinishedOrDispatched(targetVariableIndex, inputVariables.ToArray(), algoName)) { 142 // AddDispatchedRun(targetVariableIndex, inputVariables.ToArray(), algoName); 143 // } 144 // } 145 // } 146 //} 101 var dispatchedAlgos = from model in Database.GetAllModels() 102 select new { 103 TargetVariable = model.TargetVariable.Name, 104 Algorithm = model.Algorithm.Name, 105 Inputvariables = Database.GetInputVariableResults(model).Select(x => x.Variable.Name).Distinct() }; 106 foreach (var algo in dispatchedAlgos) { 107 AddDispatchedRun(algo.TargetVariable, algo.Inputvariables, algo.Algorithm); 108 } 147 109 } 148 110 … … 180 142 } 181 143 144 private void AddDispatchedRun(string targetVariable, IEnumerable<string> inputVariables, string algorithm) { 145 AddDispatchedRun( 146 Problem.Dataset.GetVariableIndex(targetVariable), 147 inputVariables.Select(x => Problem.Dataset.GetVariableIndex(x)).ToArray(), 148 algorithm); 149 } 150 182 151 private void AddDispatchedRun(int targetVariable, int[] inputVariables, string algoName) { 183 152 if (!finishedAndDispatchedRuns.ContainsKey(targetVariable)) {
Note: See TracChangeset
for help on using the changeset viewer.