Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2000


Ignore:
Timestamp:
06/04/09 15:18:29 (15 years ago)
Author:
gkronber
Message:

Refactoring: changed CEDMA backend to use a single data set per RDF results database. #656 (CEDMA server should handle only one data set (problem) at a time)

Location:
trunk/sources
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Core/3.3/Console.cs

    r1529 r2000  
    3737    }
    3838
    39     private DataSetList dataSetList;
    40     public DataSetList DataSetList {
    41       get { return dataSetList; }
     39    private DataSet dataSet;
     40    public DataSet DataSet {
     41      get { return dataSet; }
    4242    }
    4343
    4444    public Console()
    4545      : base() {
    46       dataSetList = new DataSetList();
     46      dataSet = new DataSet();
    4747    }
    4848
     
    7171
    7272    internal void Connect(string serverUri) {
    73       DataSetList.Store = new StoreProxy(serverUri);
     73      IStore store = new StoreProxy(serverUri);
     74      var variableBindings = store.Query("?Dataset <" + Ontology.PredicateInstanceOf + "> <" + Ontology.TypeDataSet + "> .", 0, 10).ToArray();
     75      if (variableBindings.Length > 0) {
     76        dataSet = new DataSet(store, (Entity)variableBindings[0].Get("Dataset"));
     77      } else {
     78        dataSet.Store = store;
     79      }
    7480    }
    7581  }
  • trunk/sources/HeuristicLab.CEDMA.Core/3.3/ConsoleEditor.cs

    r1529 r2000  
    4242      InitializeComponent();
    4343      this.console = console;
    44       serverPanel.Enabled = false;
    4544    }
    4645
     
    111110        serverPanel.Enabled = true;
    112111        serverPanel.Controls.Clear();
    113         Control dataSetListView = (Control)console.DataSetList.CreateView();
    114         dataSetListView.Dock = DockStyle.Fill;
    115         serverPanel.Controls.Add(dataSetListView);
     112        Control dataSetView = (Control)console.DataSet.CreateView();
     113        dataSetView.Dock = DockStyle.Fill;
     114        serverPanel.Controls.Add(dataSetView);
    116115      } catch(CommunicationException ex) {
    117116        MessageBox.Show("Exception while trying to connect to " + uriTextBox.Text + "\n" + ex.Message);
  • trunk/sources/HeuristicLab.CEDMA.Core/3.3/DataSet.cs

    r1529 r2000  
    6161    }
    6262
     63    private bool activated;
     64    public bool Activated {
     65      get { return activated; }
     66    }
     67
    6368    public DataSet()
    6469      : base() {
    6570      guid = Guid.NewGuid();
    6671      name = "Data set";
     72      activated = false;
    6773    }
    6874
     
    7278      guid = new Guid(dataSetEntity.Uri.Remove(0, Ontology.CedmaNameSpace.Length));
    7379      name = guid.ToString();
     80      activated = true;
    7481    }
    7582
     
    7986      Store.Add(new Statement(myEntity, Ontology.PredicateSerializedData, new Literal(Convert.ToBase64String(PersistenceManager.SaveToGZip(problem)))));
    8087      Store.Add(new Statement(myEntity, Ontology.PredicateName, new Literal(name)));
     88      activated = true;
    8189    }
    8290
     
    8795    internal Results GetResults() {
    8896      Results results = new Results(Store);
    89       results.FilterDataSet(new Entity(Ontology.CedmaNameSpace + Guid));
    9097      return results;
    9198    }
  • trunk/sources/HeuristicLab.CEDMA.Core/3.3/DataSetView.cs

    r1529 r2000  
    5858      PopulateViewComboBox();
    5959      resultsButton.Enabled = viewComboBox.SelectedItem != null;
     60      if (dataSet.Activated) {
     61        activateButton.Enabled = false;
     62        editorGroupBox.Enabled = false;
     63        viewComboBox.Enabled = true;
     64        resultsButton.Enabled = true;
     65        progressBar.Enabled = true;
     66      } else {
     67        activateButton.Enabled = true;
     68        editorGroupBox.Enabled = true;
     69        viewComboBox.Enabled = false;
     70        resultsButton.Enabled = false;
     71        progressBar.Enabled = false;
     72      }
    6073    }
    6174
  • trunk/sources/HeuristicLab.CEDMA.Core/3.3/HeuristicLab.CEDMA.Core-3.3.csproj

    r1534 r2000  
    103103    <Compile Include="Problem.cs" />
    104104    <Compile Include="DataSet.cs" />
    105     <Compile Include="DataSetList.cs" />
    106     <Compile Include="DataSetListView.cs">
    107       <SubType>UserControl</SubType>
    108     </Compile>
    109     <Compile Include="DataSetListView.Designer.cs">
    110       <DependentUpon>DataSetListView.cs</DependentUpon>
    111     </Compile>
    112105    <Compile Include="DataSetView.cs">
    113106      <SubType>UserControl</SubType>
     
    163156      <SubType>Designer</SubType>
    164157    </EmbeddedResource>
    165     <EmbeddedResource Include="DataSetListView.resx">
    166       <DependentUpon>DataSetListView.cs</DependentUpon>
    167     </EmbeddedResource>
    168158    <EmbeddedResource Include="DataSetView.resx">
    169159      <DependentUpon>DataSetView.cs</DependentUpon>
  • trunk/sources/HeuristicLab.CEDMA.Core/3.3/Problem.cs

    r1529 r2000  
    4545  /// </summary>
    4646  public class Problem : ItemBase {
    47     private string name;
    48     public string Name {
    49       get { return name; }
    50     }
    5147    private HeuristicLab.DataAnalysis.Dataset dataset;
    52     public HeuristicLab.DataAnalysis.Dataset DataSet {
     48    public HeuristicLab.DataAnalysis.Dataset Dataset {
    5349      get { return dataset; }
    5450    }
  • trunk/sources/HeuristicLab.CEDMA.Core/3.3/ProblemView.cs

    r1529 r2000  
    4444    protected override void UpdateControls() {
    4545      base.UpdateControls();
    46       datasetView.Dataset = problem.DataSet;
     46      datasetView.Dataset = problem.Dataset;
    4747      trainingSamplesStartTextBox.Text = problem.TrainingSamplesStart.ToString();
    4848      trainingSamplesEndTextBox.Text = problem.TrainingSamplesEnd.ToString();
     
    6161      targetsListBox.Items.Clear();
    6262      inputsListBox.Items.Clear();
    63       for (int i = 0; i < problem.DataSet.Columns; i++) {
    64         targetsListBox.Items.Add(problem.DataSet.GetVariableName(i), problem.AllowedTargetVariables.Contains(i));
    65         inputsListBox.Items.Add(problem.DataSet.GetVariableName(i), problem.AllowedInputVariables.Contains(i));
     63      for (int i = 0; i < problem.Dataset.Columns; i++) {
     64        targetsListBox.Items.Add(problem.Dataset.GetVariableName(i), problem.AllowedTargetVariables.Contains(i));
     65        inputsListBox.Items.Add(problem.Dataset.GetVariableName(i), problem.AllowedInputVariables.Contains(i));
    6666      }
    6767    }
     
    8989        }
    9090        if (success) {
    91           Dataset dataset = (Dataset)problem.DataSet;
     91          Dataset dataset = (Dataset)problem.Dataset;
    9292          dataset.Rows = parser.Rows;
    9393          dataset.Columns = parser.Columns;
     
    9898          dataset.Samples = new double[dataset.Rows * dataset.Columns];
    9999          Array.Copy(parser.Samples, dataset.Samples, dataset.Columns * dataset.Rows);
    100           datasetView.Dataset = problem.DataSet;
     100          datasetView.Dataset = problem.Dataset;
    101101
    102102          problem.TrainingSamplesStart = parser.TrainingSamplesStart;
     
    116116        }
    117117      }
    118 
    119118    }
    120119
     
    146145        int testEnd = int.Parse(testSamplesEndTextBox.Text);
    147146        if (trainingStart < 0 || validationStart < 0 || testStart < 0 ||
    148           trainingEnd >= problem.DataSet.Rows || validationEnd >= problem.DataSet.Rows || testEnd >= problem.DataSet.Rows ||
     147          trainingEnd >= problem.Dataset.Rows || validationEnd >= problem.Dataset.Rows || testEnd >= problem.Dataset.Rows ||
    149148          trainingStart >= trainingEnd ||
    150149          validationStart >= validationEnd ||
  • trunk/sources/HeuristicLab.CEDMA.Core/3.3/Results.cs

    r1529 r2000  
    6868    private Dictionary<string, Dictionary<object, double>> categoricalValueIndices = new Dictionary<string, Dictionary<object, double>>();
    6969
    70     private Entity dataSetEntity;
    71 
    7270    public Results(IStore store) {
    7371      this.store = store;
    74     }
    75 
    76     internal void FilterDataSet(Entity entity) {
    77       this.dataSetEntity = entity;
    7872    }
    7973
     
    9387      entries = new List<ResultsEntry>();
    9488      do {
    95         var allBindings = store.Query("<" + dataSetEntity + "> <" + Ontology.PredicateHasModel + "> ?Model ." + Environment.NewLine +
     89        var allBindings = store.Query("?Dataset <" + Ontology.PredicateHasModel + "> ?Model ." + Environment.NewLine +
    9690          "?Model ?Attribute ?Value .", page, PAGE_SIZE);
    9791        var allModelBindings = allBindings.GroupBy(x => (Entity)x.Get("Model"));
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/DispatcherBase.cs

    r1922 r2000  
    6565      string targetVariableName = dataSet.Problem.GetVariableName(targetVariable);
    6666
    67 
    6867      if (selectedAlgorithm != null) {
    6968        SetProblemParameters(selectedAlgorithm, dataSet.Problem, targetVariable);
     
    7776
    7877    private void SetProblemParameters(IAlgorithm algo, Problem problem, int targetVariable) {
    79       algo.Dataset = problem.DataSet;
     78      algo.Dataset = problem.Dataset;
    8079      algo.TargetVariable = targetVariable;
    8180      algo.ProblemInjector.GetVariable("TrainingSamplesStart").GetValue<IntData>().Data = problem.TrainingSamplesStart;
     
    9493      } else if (problem.LearningTask == LearningTask.Classification) {
    9594        ItemList<DoubleData> classValues = algo.ProblemInjector.GetVariable("TargetClassValues").GetValue<ItemList<DoubleData>>();
    96         foreach (double classValue in GetDifferentClassValues(problem.DataSet, targetVariable)) classValues.Add(new DoubleData(classValue));
     95        foreach (double classValue in GetDifferentClassValues(problem.Dataset, targetVariable)) classValues.Add(new DoubleData(classValue));
    9796      }
    9897    }
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/ExecuterBase.cs

    r1922 r2000  
    7171    protected void StoreResults(IAlgorithm finishedAlgorithm) {
    7272      Entity modelEntity = new Entity(Ontology.CedmaNameSpace + Guid.NewGuid());
    73       // TODO (gkronber 27052009)
    7473      // store.Add(new Statement(finishedAlgorithm.DataSetEntity, Ontology.PredicateHasModel, modelEntity));
    7574      StoreModelAttribute(modelEntity, Ontology.TargetVariable, finishedAlgorithm.Model.TargetVariable);
Note: See TracChangeset for help on using the changeset viewer.