Changeset 2185
- Timestamp:
- 07/28/09 12:54:28 (15 years ago)
- Location:
- branches/HeuristicLab.Modeling Database Backend/sources
- Files:
-
- 3 added
- 2 deleted
- 14 edited
- 8 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Core/3.3/HeuristicLab.CEDMA.Core-3.3.csproj
r2000 r2185 101 101 <SubType>UserControl</SubType> 102 102 </Compile> 103 <Compile Include="Problem.cs" />104 <Compile Include="DataSet.cs" />105 103 <Compile Include="DataSetView.cs"> 106 104 <SubType>UserControl</SubType> -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/DispatcherBase.cs
r2153 r2185 39 39 namespace HeuristicLab.CEDMA.Server { 40 40 public abstract class DispatcherBase : IDispatcher { 41 private I Store store;41 private IModelingDatabase database; 42 42 private DataSet dataset; 43 43 private List<int> allowedTargetVariables; … … 63 63 } 64 64 65 public DispatcherBase(I Store store) {66 this. store = store;65 public DispatcherBase(IModelingDatabase database) { 66 this.database = database; 67 67 allowedTargetVariables = new List<int>(); 68 68 activeInputVariables = new Dictionary<int, List<int>>(); -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/ExecuterBase.cs
r2094 r2185 39 39 using System.Threading; 40 40 using HeuristicLab.Modeling; 41 using HeuristicLab.Modeling.SQLServerCompactBackend; 41 42 42 43 namespace HeuristicLab.CEDMA.Server { … … 47 48 protected IDispatcher Dispatcher { 48 49 get { return dispatcher; } 49 } 50 private I Store store;50 } 51 private IModelingDatabase databaseService; 51 52 52 53 private int maxActiveJobs; … … 60 61 } 61 62 62 public ExecuterBase(IDispatcher dispatcher, I Store store) {63 public ExecuterBase(IDispatcher dispatcher, IModelingDatabase databaseService) { 63 64 maxActiveJobs = 10; 64 65 this.dispatcher = dispatcher; 65 this. store = store;66 this.databaseService = databaseService; 66 67 } 67 68 … … 85 86 86 87 protected void StoreResults(IAlgorithm finishedAlgorithm) { 87 Entity modelEntity = new Entity(Ontology.CedmaNameSpace + Guid.NewGuid()); 88 IModel model = finishedAlgorithm.Model; 89 List<Statement> statements = new List<Statement>(); 90 statements.Add(new Statement(modelEntity, Ontology.InstanceOf, Ontology.TypeModel)); 91 statements.Add(new Statement(modelEntity, Ontology.TargetVariable, new Literal(model.TargetVariable))); 92 statements.Add(new Statement(modelEntity, Ontology.Name, new Literal(finishedAlgorithm.Name))); 88 databaseService.Persist(finishedAlgorithm); 89 //Entity modelEntity = new Entity(Ontology.CedmaNameSpace + Guid.NewGuid()); 90 //IModel model = finishedAlgorithm.Model; 91 //List<Statement> statements = new List<Statement>(); 92 //statements.Add(new Statement(modelEntity, Ontology.InstanceOf, Ontology.TypeModel)); 93 //statements.Add(new Statement(modelEntity, Ontology.TargetVariable, new Literal(model.TargetVariable))); 94 //statements.Add(new Statement(modelEntity, Ontology.Name, new Literal(finishedAlgorithm.Name))); 93 95 94 statements.Add(new Statement(modelEntity, Ontology.TrainingMeanSquaredError, new Literal(model.TrainingMeanSquaredError)));95 statements.Add(new Statement(modelEntity, Ontology.ValidationMeanSquaredError, new Literal(model.ValidationMeanSquaredError)));96 statements.Add(new Statement(modelEntity, Ontology.TestMeanSquaredError, new Literal(model.TestMeanSquaredError)));97 statements.Add(new Statement(modelEntity, Ontology.TrainingCoefficientOfDetermination, new Literal(model.TrainingCoefficientOfDetermination)));98 statements.Add(new Statement(modelEntity, Ontology.ValidationCoefficientOfDetermination, new Literal(model.ValidationCoefficientOfDetermination)));99 statements.Add(new Statement(modelEntity, Ontology.TestCoefficientOfDetermination, new Literal(model.TestCoefficientOfDetermination)));100 statements.Add(new Statement(modelEntity, Ontology.TrainingVarianceAccountedFor, new Literal(model.TrainingVarianceAccountedFor)));101 statements.Add(new Statement(modelEntity, Ontology.ValidationVarianceAccountedFor, new Literal(model.ValidationVarianceAccountedFor)));102 statements.Add(new Statement(modelEntity, Ontology.TestVarianceAccountedFor, new Literal(model.TestVarianceAccountedFor)));103 statements.Add(new Statement(modelEntity, Ontology.TrainingMeanAbsolutePercentageError, new Literal(model.TrainingMeanAbsolutePercentageError)));104 statements.Add(new Statement(modelEntity, Ontology.ValidationMeanAbsolutePercentageError, new Literal(model.ValidationMeanAbsolutePercentageError)));105 statements.Add(new Statement(modelEntity, Ontology.TestMeanAbsolutePercentageError, new Literal(model.TestMeanAbsolutePercentageError)));106 statements.Add(new Statement(modelEntity, Ontology.TrainingMeanAbsolutePercentageOfRangeError, new Literal(model.TrainingMeanAbsolutePercentageOfRangeError)));107 statements.Add(new Statement(modelEntity, Ontology.ValidationMeanAbsolutePercentageOfRangeError, new Literal(model.ValidationMeanAbsolutePercentageOfRangeError)));108 statements.Add(new Statement(modelEntity, Ontology.TestMeanAbsolutePercentageOfRangeError, new Literal(model.TestMeanAbsolutePercentageOfRangeError)));96 //statements.Add(new Statement(modelEntity, Ontology.TrainingMeanSquaredError, new Literal(model.TrainingMeanSquaredError))); 97 //statements.Add(new Statement(modelEntity, Ontology.ValidationMeanSquaredError, new Literal(model.ValidationMeanSquaredError))); 98 //statements.Add(new Statement(modelEntity, Ontology.TestMeanSquaredError, new Literal(model.TestMeanSquaredError))); 99 //statements.Add(new Statement(modelEntity, Ontology.TrainingCoefficientOfDetermination, new Literal(model.TrainingCoefficientOfDetermination))); 100 //statements.Add(new Statement(modelEntity, Ontology.ValidationCoefficientOfDetermination, new Literal(model.ValidationCoefficientOfDetermination))); 101 //statements.Add(new Statement(modelEntity, Ontology.TestCoefficientOfDetermination, new Literal(model.TestCoefficientOfDetermination))); 102 //statements.Add(new Statement(modelEntity, Ontology.TrainingVarianceAccountedFor, new Literal(model.TrainingVarianceAccountedFor))); 103 //statements.Add(new Statement(modelEntity, Ontology.ValidationVarianceAccountedFor, new Literal(model.ValidationVarianceAccountedFor))); 104 //statements.Add(new Statement(modelEntity, Ontology.TestVarianceAccountedFor, new Literal(model.TestVarianceAccountedFor))); 105 //statements.Add(new Statement(modelEntity, Ontology.TrainingMeanAbsolutePercentageError, new Literal(model.TrainingMeanAbsolutePercentageError))); 106 //statements.Add(new Statement(modelEntity, Ontology.ValidationMeanAbsolutePercentageError, new Literal(model.ValidationMeanAbsolutePercentageError))); 107 //statements.Add(new Statement(modelEntity, Ontology.TestMeanAbsolutePercentageError, new Literal(model.TestMeanAbsolutePercentageError))); 108 //statements.Add(new Statement(modelEntity, Ontology.TrainingMeanAbsolutePercentageOfRangeError, new Literal(model.TrainingMeanAbsolutePercentageOfRangeError))); 109 //statements.Add(new Statement(modelEntity, Ontology.ValidationMeanAbsolutePercentageOfRangeError, new Literal(model.ValidationMeanAbsolutePercentageOfRangeError))); 110 //statements.Add(new Statement(modelEntity, Ontology.TestMeanAbsolutePercentageOfRangeError, new Literal(model.TestMeanAbsolutePercentageOfRangeError))); 109 111 110 for (int i = 0; i < finishedAlgorithm.Dataset.Columns; i++) {111 try {112 string variableName = finishedAlgorithm.Dataset.GetVariableName(i);113 double qualImpact = model.GetVariableQualityImpact(variableName);114 double evalImpact = model.GetVariableEvaluationImpact(variableName);112 //for (int i = 0; i < finishedAlgorithm.Dataset.Columns; i++) { 113 // try { 114 // string variableName = finishedAlgorithm.Dataset.GetVariableName(i); 115 // double qualImpact = model.GetVariableQualityImpact(variableName); 116 // double evalImpact = model.GetVariableEvaluationImpact(variableName); 115 117 116 Entity inputVariableEntity = new Entity(Ontology.CedmaNameSpace + Guid.NewGuid());117 statements.Add(new Statement(inputVariableEntity, Ontology.InstanceOf, Ontology.TypeVariableImpact));118 statements.Add(new Statement(modelEntity, Ontology.HasInputVariable, inputVariableEntity));119 statements.Add(new Statement(inputVariableEntity, Ontology.EvaluationImpact, new Literal(evalImpact)));120 statements.Add(new Statement(inputVariableEntity, Ontology.QualityImpact, new Literal(qualImpact)));121 statements.Add(new Statement(inputVariableEntity, Ontology.Name, new Literal(variableName)));122 }123 catch (ArgumentException) {124 // ignore125 }126 }118 // Entity inputVariableEntity = new Entity(Ontology.CedmaNameSpace + Guid.NewGuid()); 119 // statements.Add(new Statement(inputVariableEntity, Ontology.InstanceOf, Ontology.TypeVariableImpact)); 120 // statements.Add(new Statement(modelEntity, Ontology.HasInputVariable, inputVariableEntity)); 121 // statements.Add(new Statement(inputVariableEntity, Ontology.EvaluationImpact, new Literal(evalImpact))); 122 // statements.Add(new Statement(inputVariableEntity, Ontology.QualityImpact, new Literal(qualImpact))); 123 // statements.Add(new Statement(inputVariableEntity, Ontology.Name, new Literal(variableName))); 124 // } 125 // catch (ArgumentException) { 126 // // ignore 127 // } 128 //} 127 129 128 byte[] serializedModel = PersistenceManager.SaveToGZip(model.Data);129 statements.Add(new Statement(modelEntity, Ontology.SerializedData, new Literal(Convert.ToBase64String(serializedModel))));130 store.AddRange(statements);130 //byte[] serializedModel = PersistenceManager.SaveToGZip(model.Data); 131 //statements.Add(new Statement(modelEntity, Ontology.SerializedData, new Literal(Convert.ToBase64String(serializedModel)))); 132 //store.AddRange(statements); 131 133 } 132 134 -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/GridExecuter.cs
r2153 r2185 39 39 using System.Threading; 40 40 using HeuristicLab.Modeling; 41 using HeuristicLab.Modeling.SQLServerCompactBackend; 41 42 42 43 namespace HeuristicLab.CEDMA.Server { … … 57 58 } 58 59 59 public GridExecuter(IDispatcher dispatcher, IStore store, IGridServer server)60 : base(dispatcher, store ) {60 public GridExecuter(IDispatcher dispatcher, IGridServer server, IModelingDatabase databaseService) 61 : base(dispatcher, store, databaseService) { 61 62 this.jobManager = new JobManager(server); 62 63 activeAlgorithms = new Dictionary<AsyncGridResult, IAlgorithm>(); -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/HeuristicLab.CEDMA.Server-3.3.csproj
r2094 r2185 153 153 <Name>HeuristicLab.Grid-3.2</Name> 154 154 </ProjectReference> 155 <ProjectReference Include="..\..\HeuristicLab.Modeling.SQLServerCompactBackend\3.2\HeuristicLab.Modeling.SQLServerCompactBackend-3.2.csproj"> 156 <Project>{9B4F7D05-CCE1-45BB-81D1-5D4925851901}</Project> 157 <Name>HeuristicLab.Modeling.SQLServerCompactBackend-3.2</Name> 158 </ProjectReference> 155 159 <ProjectReference Include="..\..\HeuristicLab.Modeling\3.2\HeuristicLab.Modeling-3.2.csproj"> 156 160 <Project>{80F7FADA-549D-4151-8856-79B620A50DBA}</Project> -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/Server.cs
r2094 r2185 33 33 using HeuristicLab.Grid.HiveBridge; 34 34 using HeuristicLab.Core; 35 using HeuristicLab.Modeling.SQLServerCompactBackend; 35 36 36 37 namespace HeuristicLab.CEDMA.Server { 37 38 public class Server : IViewable { 38 private static readonly string rdfFile = AppDomain.CurrentDomain.BaseDirectory + "rdf_store.db3"; 39 private static readonly string rdfConnectionString = "sqlite:rdf:Data Source=\"" + rdfFile + "\""; 40 41 private ServiceHost host; 42 private Store store; 39 private static readonly string sqlServerCompactFile = AppDomain.CurrentDomain.BaseDirectory + "HeuristicLab.Modeling.database"; 40 private static readonly string sqlServerCompactConnectionString = @"Data Source=" + sqlServerCompactFile; 43 41 44 42 private IDispatcher dispatcher; … … 53 51 } 54 52 55 private string cedmaServiceUrl;56 public string CedmaServiceUrl {57 get { return cedmaServiceUrl; }58 set { cedmaServiceUrl = value; }59 }60 61 53 public Server() { 62 IPAddress[] addresses = Dns.GetHostAddresses(Dns.GetHostName());63 // windows XP returns the external ip on index 0 while windows vista returns the external ip as one of the last entries64 // also if IPv6 protocol is installed we want to find an entry that is IPv465 int index = 0;66 if (System.Environment.OSVersion.Version.Major >= 6) {67 for (index = addresses.Length - 1; index >= 0; index--)68 if (addresses[index].AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)69 break;70 }71 cedmaServiceUrl = "net.tcp://" + addresses[index] + ":8002/CEDMA";72 store = new Store(rdfConnectionString);73 }74 75 public void Start() {76 host = new ServiceHost(store, new Uri(cedmaServiceUrl));77 ServiceThrottlingBehavior throttlingBehavior = new ServiceThrottlingBehavior();78 throttlingBehavior.MaxConcurrentSessions = 20;79 host.Description.Behaviors.Add(throttlingBehavior);80 try {81 NetTcpBinding binding = new NetTcpBinding();82 binding.SendTimeout = new TimeSpan(10, 0, 0);83 binding.MaxReceivedMessageSize = int.MaxValue;84 binding.ReaderQuotas.MaxStringContentLength = int.MaxValue;85 binding.ReaderQuotas.MaxArrayLength = int.MaxValue;86 host.AddServiceEndpoint(typeof(IStore), binding, cedmaServiceUrl);87 host.Open();88 }89 catch (CommunicationException ex) {90 MessageBox.Show("An exception occurred: " + ex.Message);91 host.Abort();92 }93 54 } 94 55 95 56 internal void Connect(string serverUrl) { 96 dispatcher = new SimpleDispatcher(store); 57 DatabaseService database = new DatabaseService(sqlServerCompactConnectionString) 58 dispatcher = new SimpleDispatcher(database); 97 59 IGridServer gridServer = null; 98 60 if (serverUrl.Contains("ExecutionEngine")) { … … 102 64 gridServer = new GridServerProxy(serverUrl); 103 65 } 104 executer = new GridExecuter(dispatcher, store, gridServer);66 executer = new GridExecuter(dispatcher, gridServer,database); 105 67 executer.Start(); 106 68 } … … 110 72 return new ServerView(this); 111 73 } 112 113 74 #endregion 114 75 } -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/SimpleDispatcher.cs
r2153 r2185 45 45 } 46 46 47 private Random random; 48 private IStore store; 47 private Random random; 49 48 private Dictionary<int, List<AlgorithmConfiguration>> finishedAndDispatchedRuns; 50 49 51 public SimpleDispatcher(IStore store) 52 : base(store) { 53 this.store = store; 50 public SimpleDispatcher(IModelingDatabase database) 51 : base(database) { 54 52 random = new Random(); 55 53 finishedAndDispatchedRuns = new Dictionary<int, List<AlgorithmConfiguration>>(); … … 103 101 104 102 private void PopulateFinishedRuns() { 105 Dictionary<Entity, Entity> processedModels = new Dictionary<Entity, Entity>();106 var datasetBindings = store107 .Query(108 "?Dataset <" + Ontology.InstanceOf + "> <" + Ontology.TypeDataSet + "> .", 0, 1)109 .Select(x => (Entity)x.Get("Dataset"));110 111 if (datasetBindings.Count() > 0) {112 var datasetEntity = datasetBindings.ElementAt(0);113 114 DataSet ds = new DataSet(store, datasetEntity);115 var result = store116 .Query(117 "?Model <" + Ontology.TargetVariable + "> ?TargetVariable ." + Environment.NewLine +118 "?Model <" + Ontology.Name + "> ?AlgoName .",119 0, 1000)120 .Select(x => new Resource[] { (Literal)x.Get("TargetVariable"), (Literal)x.Get("AlgoName"), (Entity)x.Get("Model") });121 122 foreach (Resource[] row in result) {123 Entity model = ((Entity)row[2]);124 if (!processedModels.ContainsKey(model)) {125 processedModels.Add(model, model);126 127 string targetVariable = (string)((Literal)row[0]).Value;128 string algoName = (string)((Literal)row[1]).Value;129 int targetVariableIndex = ds.Problem.Dataset.GetVariableIndex(targetVariable);130 131 var inputVariableLiterals = store132 .Query(133 "<" + model.Uri + "> <" + Ontology.HasInputVariable + "> ?InputVariable ." + Environment.NewLine +134 "?InputVariable <" + Ontology.Name + "> ?Name .",135 0, 1000)136 .Select(x => (Literal)x.Get("Name"))137 .Select(l => (string)l.Value)138 .Distinct();139 140 List<int> inputVariables = new List<int>();141 foreach (string variableName in inputVariableLiterals) {142 int variableIndex = ds.Problem.Dataset.GetVariableIndex(variableName);143 inputVariables.Add(variableIndex);144 }145 if (!AlgorithmFinishedOrDispatched(targetVariableIndex, inputVariables.ToArray(), algoName)) {146 AddDispatchedRun(targetVariableIndex, inputVariables.ToArray(), algoName);147 }148 }149 }150 }103 //Dictionary<Entity, Entity> processedModels = new Dictionary<Entity, Entity>(); 104 //var datasetBindings = store 105 // .Query( 106 // "?Dataset <" + Ontology.InstanceOf + "> <" + Ontology.TypeDataSet + "> .", 0, 1) 107 // .Select(x => (Entity)x.Get("Dataset")); 108 109 //if (datasetBindings.Count() > 0) { 110 // var datasetEntity = datasetBindings.ElementAt(0); 111 112 // DataSet ds = new DataSet(store, datasetEntity); 113 // var result = store 114 // .Query( 115 // "?Model <" + Ontology.TargetVariable + "> ?TargetVariable ." + Environment.NewLine + 116 // "?Model <" + Ontology.Name + "> ?AlgoName .", 117 // 0, 1000) 118 // .Select(x => new Resource[] { (Literal)x.Get("TargetVariable"), (Literal)x.Get("AlgoName"), (Entity)x.Get("Model") }); 119 120 // foreach (Resource[] row in result) { 121 // Entity model = ((Entity)row[2]); 122 // if (!processedModels.ContainsKey(model)) { 123 // processedModels.Add(model, model); 124 125 // string targetVariable = (string)((Literal)row[0]).Value; 126 // string algoName = (string)((Literal)row[1]).Value; 127 // int targetVariableIndex = ds.Problem.Dataset.GetVariableIndex(targetVariable); 128 129 // var inputVariableLiterals = store 130 // .Query( 131 // "<" + model.Uri + "> <" + Ontology.HasInputVariable + "> ?InputVariable ." + Environment.NewLine + 132 // "?InputVariable <" + Ontology.Name + "> ?Name .", 133 // 0, 1000) 134 // .Select(x => (Literal)x.Get("Name")) 135 // .Select(l => (string)l.Value) 136 // .Distinct(); 137 138 // List<int> inputVariables = new List<int>(); 139 // foreach (string variableName in inputVariableLiterals) { 140 // int variableIndex = ds.Problem.Dataset.GetVariableIndex(variableName); 141 // inputVariables.Add(variableIndex); 142 // } 143 // if (!AlgorithmFinishedOrDispatched(targetVariableIndex, inputVariables.ToArray(), algoName)) { 144 // AddDispatchedRun(targetVariableIndex, inputVariables.ToArray(), algoName); 145 // } 146 // } 147 // } 148 //} 151 149 } 152 150 -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.DataAnalysis/3.2/Dataset.cs
r2162 r2185 111 111 112 112 private string[] variableNames; 113 public IEnumerable<string> VariableNames { 114 get { return variableNames; } 115 } 113 116 114 117 public Dataset() { … … 123 126 fireChangeEvents = true; 124 127 } 128 129 125 130 126 131 public string GetVariableName(int variableIndex) { -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLServerCompactBackend/3.2/DataObjects/Algorithm.cs
r2184 r2185 42 42 set { this.description = value; } 43 43 } 44 45 public IEnumerable<Model> ModelsCreatedByThisAlgorithm {46 get {47 using (ModelingDataContext ctx = new ModelingDataContext()) {48 var x = from model in ctx.Models49 where model.Algorithm == this50 select model;51 return x.AsEnumerable();52 }53 }54 }55 44 } 56 45 } -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLServerCompactBackend/3.2/DataObjects/InputVariableResult.cs
r2183 r2185 12 12 this.variable = default(EntityRef<Variable>); 13 13 this.result = default(EntityRef<Result>); 14 } 15 16 public InputVariableResult(InputVariable inputVariable, Result result, double value) 17 : this() { 18 this.variable.Entity = inputVariable.Variable; 19 this.model.Entity = inputVariable.Model; 20 this.result.Entity = result; 21 this.value = value; 14 22 } 15 23 … … 70 78 get { return result.Entity; } 71 79 } 80 81 private double value; 82 [Column(Storage = "value", CanBeNull = false)] 83 public double Value { 84 get { return this.value; } 85 set { this.value = value; } 86 } 72 87 } 73 88 } -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLServerCompactBackend/3.2/DataObjects/Model.cs
r2183 r2185 14 14 } 15 15 16 public Model(Variable targetVariable, Algorithm algorithm, object data)16 public Model(Variable targetVariable, Algorithm algorithm, byte[] model) 17 17 : this() { 18 18 this.TargetVariable = targetVariable; 19 19 this.Algorithm = algorithm; 20 this. data = data;20 this.modelData = model; 21 21 } 22 22 … … 28 28 } 29 29 30 private object data;31 [Column(Storage = " data", DbType = "varbinary(8000)", CanBeNull = false)]32 public objectData {33 get { return this. data; }34 set { this. data = value; }30 private byte[] modelData; 31 [Column(Storage = "model", DbType = "image", CanBeNull = false)] 32 public byte[] ModelData { 33 get { return this.modelData; } 34 set { this.modelData = value; } 35 35 } 36 36 … … 97 97 } 98 98 99 public IEnumerable<Variable> InputVariables { 100 get { 101 using (ModelingDataContext ctx = new ModelingDataContext()) { 102 var x = from inputVariable in ctx.InputVariables 103 where inputVariable.Model == this 104 select inputVariable.Variable; 105 return x.AsEnumerable(); 106 } 107 } 99 private int trainingSamplesStart; 100 [Column(Storage = "trainingSamplesStart", CanBeNull = false)] 101 public int TrainingSamplesStart { 102 get { return this.trainingSamplesStart; } 103 set { this.trainingSamplesStart = value; } 108 104 } 109 105 110 public Dictionary<string, double> ResultValues { 111 get { 112 using (ModelingDataContext ctx = new ModelingDataContext()) { 113 var x = (from modelResult in ctx.ModelResults 114 where modelResult.Model == this 115 select modelResult) 116 .ToDictionary( 117 modelResult => modelResult.Result.Name, 118 modelResult => modelResult.Value); 119 return x; 120 } 121 } 106 private int trainingSamplesEnd; 107 [Column(Storage = "trainingSamplesEnd", CanBeNull = false)] 108 public int TrainingSamplesEnd { 109 get { return this.trainingSamplesEnd; } 110 set { this.trainingSamplesEnd = value; } 111 } 112 113 private int validationSamplesStart; 114 [Column(Storage = "validationSamplesStart", CanBeNull = false)] 115 public int ValidationSamplesStart { 116 get { return this.validationSamplesStart; } 117 set { this.validationSamplesStart = value; } 118 } 119 120 private int validationSamplesEnd; 121 [Column(Storage = "validationSamplesEnd", CanBeNull = false)] 122 public int ValidationSamplesEnd { 123 get { return this.validationSamplesEnd; } 124 set { this.validationSamplesEnd = value; } 125 } 126 127 private int testSamplesStart; 128 [Column(Storage = "testSamplesStart", CanBeNull = false)] 129 public int TestSamplesStart { 130 get { return this.testSamplesStart; } 131 set { this.testSamplesStart = value; } 132 } 133 134 private int testSamplesEnd; 135 [Column(Storage = "testSamplesEnd", CanBeNull = false)] 136 public int TestSamplesEnd { 137 get { return this.testSamplesEnd; } 138 set { this.testSamplesEnd = value; } 122 139 } 123 140 } -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLServerCompactBackend/3.2/DataObjects/Problem.cs
r2183 r2185 26 26 27 27 private Dataset dataset; 28 [Column(Storage = "dataset", DbType = " varbinary(8000)", CanBeNull = false)]28 [Column(Storage = "dataset", DbType = "image", CanBeNull = false)] 29 29 public Dataset Dataset { 30 30 get { return this.dataset; } -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLServerCompactBackend/3.2/DataObjects/Result.cs
r2183 r2185 30 30 private set { this.name = value; } 31 31 } 32 33 public Dictionary<Model, double> ModelResultValues {34 get {35 using (ModelingDataContext ctx = new ModelingDataContext()) {36 var x = (from modelResult in ctx.ModelResults37 where modelResult.Result == this38 select modelResult).ToDictionary(39 mr => mr.Model,40 mr => mr.Value);41 return x;42 }43 }44 }45 46 32 } 47 33 } -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLServerCompactBackend/3.2/DataObjects/Variable.cs
r2183 r2185 30 30 private set { this.name = value; } 31 31 } 32 33 public IEnumerable<Model> ModelsPredictingThisVariable {34 get {35 using (ModelingDataContext ctx = new ModelingDataContext()) {36 var x = from model in ctx.Models37 where model.TargetVariable == this38 select model;39 return x.AsEnumerable();40 }41 }42 }43 44 public IEnumerable<Model> ModelsUsingThisVariable {45 get {46 using (ModelingDataContext ctx = new ModelingDataContext()) {47 var x = from inputVariable in ctx.InputVariables48 where inputVariable.Variable == this49 select inputVariable.Model;50 return x.AsEnumerable();51 }52 }53 }54 32 } 55 33 } -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLServerCompactBackend/3.2/HeuristicLab.Modeling.SQLServerCompactBackend-3.2.csproj
r2180 r2185 95 95 <Name>HeuristicLab.DataAnalysis-3.2</Name> 96 96 </ProjectReference> 97 <ProjectReference Include="..\..\HeuristicLab.Data\3.2\HeuristicLab.Data-3.2.csproj"> 98 <Project>{F473D9AF-3F09-4296-9F28-3C65118DAFFA}</Project> 99 <Name>HeuristicLab.Data-3.2</Name> 100 </ProjectReference> 101 <ProjectReference Include="..\..\HeuristicLab.GP.StructureIdentification\3.3\HeuristicLab.GP.StructureIdentification-3.3.csproj"> 102 <Project>{74223A32-C726-4978-BE78-37113A18373C}</Project> 103 <Name>HeuristicLab.GP.StructureIdentification-3.3</Name> 104 </ProjectReference> 105 <ProjectReference Include="..\..\HeuristicLab.Modeling\3.2\HeuristicLab.Modeling-3.2.csproj"> 106 <Project>{80F7FADA-549D-4151-8856-79B620A50DBA}</Project> 107 <Name>HeuristicLab.Modeling-3.2</Name> 108 </ProjectReference> 97 109 <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj"> 98 110 <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project> … … 101 113 </ItemGroup> 102 114 <ItemGroup> 103 <Compile Include="Algorithm.cs" /> 104 <Compile Include="InputVariable.cs" /> 105 <Compile Include="InputVariableResult.cs" /> 106 <Compile Include="Model.cs" /> 115 <Compile Include="DatabaseService.cs" /> 116 <Compile Include="DataObjects\Algorithm.cs" /> 117 <Compile Include="DataObjects\InputVariable.cs" /> 118 <Compile Include="DataObjects\InputVariableResult.cs" /> 119 <Compile Include="DataObjects\Model.cs" /> 107 120 <Compile Include="ModelingDataContext.cs" /> 108 <Compile Include=" ModelResult.cs" />109 <Compile Include=" Problem.cs" />121 <Compile Include="DataObjects\ModelResult.cs" /> 122 <Compile Include="DataObjects\Problem.cs" /> 110 123 <Compile Include="Properties\AssemblyInfo.cs" /> 111 <Compile Include=" Result.cs" />112 <Compile Include=" Variable.cs" />124 <Compile Include="DataObjects\Result.cs" /> 125 <Compile Include="DataObjects\Variable.cs" /> 113 126 </ItemGroup> 114 127 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLServerCompactBackend/3.2/ModelingDataContext.cs
r2180 r2185 8 8 namespace HeuristicLab.Modeling.SQLServerCompactBackend { 9 9 public class ModelingDataContext : DataContext{ 10 11 public static string connectionString;12 13 public ModelingDataContext() : this(connectionString) {14 }15 16 10 public ModelingDataContext(string connection) 17 11 : base(connection) { … … 39 33 } 40 34 41 42 35 public Table<InputVariableResult> InputVariableResults { 43 36 get { return GetTable<InputVariableResult>(); } -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling/3.2/HeuristicLab.Modeling-3.2.csproj
r2041 r2185 83 83 <ItemGroup> 84 84 <Compile Include="ClassificationProblemInjector.cs" /> 85 <Compile Include="IModelingDatabase.cs" /> 85 86 <Compile Include="VariableImpactCalculatorBase.cs" /> 86 87 <Compile Include="VariableEvaluationImpactCalculator.cs" /> -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling/3.2/IModel.cs
r2041 r2185 30 30 Dataset Dataset { get; } 31 31 string TargetVariable { get; } 32 IEnumerable<string> InputVariables { get; } 32 33 double TrainingMeanSquaredError { get; } 33 34 double ValidationMeanSquaredError { get; } -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling/3.2/Model.cs
r2045 r2185 40 40 get { return targetVariable; } 41 41 set { targetVariable = value; } 42 } 43 44 private List<string> inputVariables = new List<string>(); 45 public IEnumerable<string> InputVariables { 46 get { return inputVariables; } 47 } 48 49 public void AddInputVariables(string variableName) { 50 if (!inputVariables.Contains(variableName)) 51 inputVariables.Add(variableName); 42 52 } 43 53 … … 122 132 public double GetVariableQualityImpact(string variableName) { 123 133 if (variableQualityImpacts.ContainsKey(variableName)) return variableQualityImpacts[variableName]; 124 else throw new ArgumentException("Impact of variable " +variableName+" is not available.");134 else throw new ArgumentException("Impact of variable " + variableName + " is not available."); 125 135 } 126 136 -
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab/CopyAssemblies.cmd
r2183 r2185 75 75 copy "%SolutionDir%\HeuristicLab.Modeling\3.2\%Outdir%\HeuristicLab.Modeling-3.2.dll" .\plugins 76 76 copy "%SolutionDir%\HeuristicLab.Modeling\3.3\%Outdir%\HeuristicLab.Modeling-3.3.dll" .\plugins 77 copy "%SolutionDir%\HeuristicLab.Modeling.SQLServerCompactBackend\3.2\%Outdir%\HeuristicLab.Modeling.SQLServerCompactBackend-3.2.dll" .\plugins 77 78 copy "%SolutionDir%\HeuristicLab.Operators\3.2\%Outdir%\HeuristicLab.Operators-3.2.dll" .\plugins 78 79 copy "%SolutionDir%\HeuristicLab.Operators\3.3\%Outdir%\HeuristicLab.Operators-3.3.dll" .\plugins
Note: See TracChangeset
for help on using the changeset viewer.