Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/13/09 17:28:07 (15 years ago)
Author:
gkronber
Message:

Worked on #722 (IModel should provide a Predict() method to get predicted values for an input vector).
At the same time removed parameter PunishmentFactor from GP algorithms (this parameter is internal to TreeEvaluators now).

Location:
trunk/tools/CedmaDatabaseMerger
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/CedmaDatabaseMerger/CedmaDatabaseMerger.csproj

    r2277 r2285  
    3030    <ErrorReport>prompt</ErrorReport>
    3131    <WarningLevel>4</WarningLevel>
     32  </PropertyGroup>
     33  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
     34    <DebugSymbols>true</DebugSymbols>
     35    <OutputPath>bin\x86\Debug\</OutputPath>
     36    <DefineConstants>DEBUG;TRACE</DefineConstants>
     37    <DebugType>full</DebugType>
     38    <PlatformTarget>x86</PlatformTarget>
     39    <ErrorReport>prompt</ErrorReport>
     40  </PropertyGroup>
     41  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
     42    <OutputPath>bin\x86\Release\</OutputPath>
     43    <DefineConstants>TRACE</DefineConstants>
     44    <Optimize>true</Optimize>
     45    <DebugType>pdbonly</DebugType>
     46    <PlatformTarget>x86</PlatformTarget>
     47    <ErrorReport>prompt</ErrorReport>
    3248  </PropertyGroup>
    3349  <ItemGroup>
  • trunk/tools/CedmaDatabaseMerger/MergerForm.cs

    r2277 r2285  
    4949        importButton.Enabled = false;
    5050        BackgroundWorker worker = new BackgroundWorker();
     51        worker.WorkerReportsProgress = true;
    5152        worker.DoWork += CreateDoWorkDelegate(worker, importFileName);
    5253        worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged);
     
    7071        DatabaseService sourceDatabase = new DatabaseService("Data Source=" + importFileName);
    7172
     73        sourceDatabase.Connect();
    7274        var models = sourceDatabase.GetAllModels();
     75        var sourceDataset = sourceDatabase.GetDataset();
    7376        int importCount = 0;
    7477        foreach (HeuristicLab.Modeling.Database.IModel m in models) {
    75           HeuristicLab.Modeling.Model model = new HeuristicLab.Modeling.Model();
     78
     79          HeuristicLab.Modeling.IAnalyzerModel model = new AnalyzerModel();
     80          model.Predictor = (HeuristicLab.Modeling.IPredictor)PersistenceManager.RestoreFromGZip(sourceDatabase.GetModelData(m));
    7681          model.TargetVariable = m.TargetVariable.Name;
    77           model.Data = (IItem)PersistenceManager.RestoreFromGZip(sourceDatabase.GetModelData(m));
    78           model.Dataset = sourceDatabase.GetDataset();
     82          model.Dataset = sourceDataset;
    7983          model.TrainingSamplesStart = m.TrainingSamplesStart;
    8084          model.TrainingSamplesEnd = m.TrainingSamplesEnd;
     
    8387          model.TestSamplesStart = m.TestSamplesStart;
    8488          model.TestSamplesEnd = m.TestSamplesEnd;
     89          model.Predictor.Predict(sourceDataset, 10, 20);
    8590          //get all double properties to save as modelResult
    8691          IEnumerable<PropertyInfo> modelResultInfos = model.GetType().GetProperties().Where(
     
    8893          var modelResults = sourceDatabase.GetModelResults(m);
    8994          foreach (IModelResult result in modelResults) {
    90             PropertyInfo matchingPropInfo = modelResultInfos.First(x=>x.Name == result.Result.Name);
    91             if(matchingPropInfo!=null) matchingPropInfo.SetValue(model, result.Value, null);
     95            PropertyInfo matchingPropInfo = modelResultInfos.First(x => x.Name == result.Result.Name);
     96            if (matchingPropInfo != null) matchingPropInfo.SetValue(model, result.Value, null);
    9297          }
    9398          var inputVariableResults = sourceDatabase.GetInputVariableResults(m);
    9499          foreach (IInputVariableResult result in inputVariableResults) {
    95             model.AddInputVariables(result.Variable.Name);
     100            model.AddInputVariable(result.Variable.Name);
    96101            if (result.Result.Name == "VariableEvaluationImpact") {
    97102              model.SetVariableEvaluationImpact(result.Variable.Name, result.Value);
     
    100105            } else throw new FormatException();
    101106          }
    102          
     107
    103108          destiationDatabase.Persist(model, m.Algorithm.Name, m.Algorithm.Description);
    104109          worker.ReportProgress((++importCount * 100) / models.Count());
    105110        }
     111        sourceDatabase.Disconnect();
    106112      };
    107113    }
Note: See TracChangeset for help on using the changeset viewer.