Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2185


Ignore:
Timestamp:
07/28/09 12:54:28 (15 years ago)
Author:
mkommend
Message:

commit to synchronize with GK
CAUTION: this changeset does not build (ticket #712)

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  
    101101      <SubType>UserControl</SubType>
    102102    </Compile>
    103     <Compile Include="Problem.cs" />
    104     <Compile Include="DataSet.cs" />
    105103    <Compile Include="DataSetView.cs">
    106104      <SubType>UserControl</SubType>
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/DispatcherBase.cs

    r2153 r2185  
    3939namespace HeuristicLab.CEDMA.Server {
    4040  public abstract class DispatcherBase : IDispatcher {
    41     private IStore store;
     41    private IModelingDatabase database;
    4242    private DataSet dataset;
    4343    private List<int> allowedTargetVariables;
     
    6363    }
    6464
    65     public DispatcherBase(IStore store) {
    66       this.store = store;
     65    public DispatcherBase(IModelingDatabase database) {
     66      this.database = database;
    6767      allowedTargetVariables = new List<int>();
    6868      activeInputVariables = new Dictionary<int, List<int>>();
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/ExecuterBase.cs

    r2094 r2185  
    3939using System.Threading;
    4040using HeuristicLab.Modeling;
     41using HeuristicLab.Modeling.SQLServerCompactBackend;
    4142
    4243namespace HeuristicLab.CEDMA.Server {
     
    4748    protected IDispatcher Dispatcher {
    4849      get { return dispatcher; }
    49     }
    50     private IStore store;
     50    }   
     51    private IModelingDatabase databaseService;
    5152
    5253    private int maxActiveJobs;
     
    6061    }
    6162
    62     public ExecuterBase(IDispatcher dispatcher, IStore store) {
     63    public ExecuterBase(IDispatcher dispatcher, IModelingDatabase databaseService) {
    6364      maxActiveJobs = 10;
    6465      this.dispatcher = dispatcher;
    65       this.store = store;
     66      this.databaseService = databaseService;
    6667    }
    6768
     
    8586
    8687    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)));
    9395     
    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)));
    109111
    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);
    115117
    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           // ignore
    125         }
    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      //}
    127129
    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);
    131133    }
    132134
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/GridExecuter.cs

    r2153 r2185  
    3939using System.Threading;
    4040using HeuristicLab.Modeling;
     41using HeuristicLab.Modeling.SQLServerCompactBackend;
    4142
    4243namespace HeuristicLab.CEDMA.Server {
     
    5758    }
    5859
    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) {
    6162      this.jobManager = new JobManager(server);
    6263      activeAlgorithms = new Dictionary<AsyncGridResult, IAlgorithm>();
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/HeuristicLab.CEDMA.Server-3.3.csproj

    r2094 r2185  
    153153      <Name>HeuristicLab.Grid-3.2</Name>
    154154    </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>
    155159    <ProjectReference Include="..\..\HeuristicLab.Modeling\3.2\HeuristicLab.Modeling-3.2.csproj">
    156160      <Project>{80F7FADA-549D-4151-8856-79B620A50DBA}</Project>
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/Server.cs

    r2094 r2185  
    3333using HeuristicLab.Grid.HiveBridge;
    3434using HeuristicLab.Core;
     35using HeuristicLab.Modeling.SQLServerCompactBackend;
    3536
    3637namespace HeuristicLab.CEDMA.Server {
    3738  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;
    4341
    4442    private IDispatcher dispatcher;
     
    5351    }
    5452
    55     private string cedmaServiceUrl;
    56     public string CedmaServiceUrl {
    57       get { return cedmaServiceUrl; }
    58       set { cedmaServiceUrl = value; }
    59     }
    60 
    6153    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 entries
    64       // also if IPv6 protocol is installed we want to find an entry that is IPv4
    65       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       }
    9354    }
    9455
    9556    internal void Connect(string serverUrl) {
    96       dispatcher = new SimpleDispatcher(store);
     57      DatabaseService database = new DatabaseService(sqlServerCompactConnectionString)
     58      dispatcher = new SimpleDispatcher(database);
    9759      IGridServer gridServer = null;
    9860      if (serverUrl.Contains("ExecutionEngine")) {
     
    10264        gridServer = new GridServerProxy(serverUrl);
    10365      }
    104       executer = new GridExecuter(dispatcher, store, gridServer);
     66      executer = new GridExecuter(dispatcher, gridServer,database);
    10567      executer.Start();
    10668    }
     
    11072      return new ServerView(this);
    11173    }
    112 
    11374    #endregion
    11475  }
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Server/3.3/SimpleDispatcher.cs

    r2153 r2185  
    4545    }
    4646
    47     private Random random;
    48     private IStore store;
     47    private Random random;   
    4948    private Dictionary<int, List<AlgorithmConfiguration>> finishedAndDispatchedRuns;
    5049
    51     public SimpleDispatcher(IStore store)
    52       : base(store) {
    53       this.store = store;
     50    public SimpleDispatcher(IModelingDatabase database)
     51      : base(database) {     
    5452      random = new Random();
    5553      finishedAndDispatchedRuns = new Dictionary<int, List<AlgorithmConfiguration>>();
     
    103101
    104102    private void PopulateFinishedRuns() {
    105       Dictionary<Entity, Entity> processedModels = new Dictionary<Entity, Entity>();
    106       var datasetBindings = store
    107         .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 = store
    116           .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 = store
    132               .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      //}
    151149    }
    152150
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.DataAnalysis/3.2/Dataset.cs

    r2162 r2185  
    111111
    112112    private string[] variableNames;
     113    public IEnumerable<string> VariableNames {
     114      get { return variableNames; }
     115    }
    113116
    114117    public Dataset() {
     
    123126      fireChangeEvents = true;
    124127    }
     128
     129   
    125130
    126131    public string GetVariableName(int variableIndex) {
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLServerCompactBackend/3.2/DataObjects/Algorithm.cs

    r2184 r2185  
    4242      set { this.description = value; }
    4343    }
    44 
    45     public IEnumerable<Model> ModelsCreatedByThisAlgorithm {
    46       get {
    47         using (ModelingDataContext ctx = new ModelingDataContext()) {
    48           var x = from model in ctx.Models
    49                   where model.Algorithm == this
    50                   select model;
    51           return x.AsEnumerable();
    52         }
    53       }
    54     }
    5544  }
    5645}
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLServerCompactBackend/3.2/DataObjects/InputVariableResult.cs

    r2183 r2185  
    1212      this.variable = default(EntityRef<Variable>);
    1313      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;
    1422    }
    1523
     
    7078      get { return result.Entity; }
    7179    }
     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    }
    7287  }
    7388}
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLServerCompactBackend/3.2/DataObjects/Model.cs

    r2183 r2185  
    1414    }
    1515
    16     public Model(Variable targetVariable, Algorithm algorithm, object data)
     16    public Model(Variable targetVariable, Algorithm algorithm, byte[] model)
    1717      : this() {
    1818      this.TargetVariable = targetVariable;
    1919      this.Algorithm = algorithm;
    20       this.data = data;
     20      this.modelData = model;
    2121    }
    2222
     
    2828    }
    2929
    30     private object data;
    31     [Column(Storage = "data", DbType = "varbinary(8000)", CanBeNull = false)]
    32     public object Data {
    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; }
    3535    }
    3636
     
    9797    }
    9898
    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; }
    108104    }
    109105
    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; }
    122139    }
    123140  }
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLServerCompactBackend/3.2/DataObjects/Problem.cs

    r2183 r2185  
    2626
    2727    private Dataset dataset;
    28     [Column(Storage = "dataset", DbType = "varbinary(8000)", CanBeNull = false)]
     28    [Column(Storage = "dataset", DbType = "image", CanBeNull = false)]
    2929    public Dataset Dataset {
    3030      get { return this.dataset; }
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLServerCompactBackend/3.2/DataObjects/Result.cs

    r2183 r2185  
    3030      private set { this.name = value; }
    3131    }
    32 
    33     public Dictionary<Model, double> ModelResultValues {
    34       get {
    35         using (ModelingDataContext ctx = new ModelingDataContext()) {
    36           var x = (from modelResult in ctx.ModelResults
    37                    where modelResult.Result == this
    38                    select modelResult).ToDictionary(
    39                     mr => mr.Model,
    40                     mr => mr.Value);
    41           return x;
    42         }
    43       }
    44     }
    45 
    4632  }
    4733}
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLServerCompactBackend/3.2/DataObjects/Variable.cs

    r2183 r2185  
    3030      private set { this.name = value; }
    3131    }
    32 
    33     public IEnumerable<Model> ModelsPredictingThisVariable {
    34       get {
    35         using (ModelingDataContext ctx = new ModelingDataContext()) {
    36           var x = from model in ctx.Models
    37                   where model.TargetVariable == this
    38                   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.InputVariables
    48                   where inputVariable.Variable == this
    49                   select inputVariable.Model;
    50           return x.AsEnumerable();
    51         }
    52       }
    53     }
    5432  }
    5533}
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLServerCompactBackend/3.2/HeuristicLab.Modeling.SQLServerCompactBackend-3.2.csproj

    r2180 r2185  
    9595      <Name>HeuristicLab.DataAnalysis-3.2</Name>
    9696    </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>
    97109    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj">
    98110      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
     
    101113  </ItemGroup>
    102114  <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" />
    107120    <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" />
    110123    <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" />
    113126  </ItemGroup>
    114127  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLServerCompactBackend/3.2/ModelingDataContext.cs

    r2180 r2185  
    88namespace HeuristicLab.Modeling.SQLServerCompactBackend {
    99  public class ModelingDataContext : DataContext{
    10 
    11     public static string connectionString;
    12 
    13     public ModelingDataContext() : this(connectionString) {     
    14     }
    15 
    1610    public ModelingDataContext(string connection)
    1711      : base(connection) {
     
    3933    }
    4034
    41 
    4235    public Table<InputVariableResult> InputVariableResults {
    4336      get { return GetTable<InputVariableResult>(); }
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling/3.2/HeuristicLab.Modeling-3.2.csproj

    r2041 r2185  
    8383  <ItemGroup>
    8484    <Compile Include="ClassificationProblemInjector.cs" />
     85    <Compile Include="IModelingDatabase.cs" />
    8586    <Compile Include="VariableImpactCalculatorBase.cs" />
    8687    <Compile Include="VariableEvaluationImpactCalculator.cs" />
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling/3.2/IModel.cs

    r2041 r2185  
    3030    Dataset Dataset { get; }
    3131    string TargetVariable { get; }
     32    IEnumerable<string> InputVariables { get; }
    3233    double TrainingMeanSquaredError { get; }
    3334    double ValidationMeanSquaredError { get; }
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling/3.2/Model.cs

    r2045 r2185  
    4040      get { return targetVariable; }
    4141      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);
    4252    }
    4353
     
    122132    public double GetVariableQualityImpact(string variableName) {
    123133      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.");
    125135    }
    126136
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab/CopyAssemblies.cmd

    r2183 r2185  
    7575copy "%SolutionDir%\HeuristicLab.Modeling\3.2\%Outdir%\HeuristicLab.Modeling-3.2.dll" .\plugins
    7676copy "%SolutionDir%\HeuristicLab.Modeling\3.3\%Outdir%\HeuristicLab.Modeling-3.3.dll" .\plugins
     77copy "%SolutionDir%\HeuristicLab.Modeling.SQLServerCompactBackend\3.2\%Outdir%\HeuristicLab.Modeling.SQLServerCompactBackend-3.2.dll" .\plugins
    7778copy "%SolutionDir%\HeuristicLab.Operators\3.2\%Outdir%\HeuristicLab.Operators-3.2.dll" .\plugins
    7879copy "%SolutionDir%\HeuristicLab.Operators\3.3\%Outdir%\HeuristicLab.Operators-3.3.dll" .\plugins
Note: See TracChangeset for help on using the changeset viewer.