Changeset 2285 for trunk/tools/CedmaDatabaseMerger
- Timestamp:
- 08/13/09 17:28:07 (15 years ago)
- Location:
- trunk/tools/CedmaDatabaseMerger
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/CedmaDatabaseMerger/CedmaDatabaseMerger.csproj
r2277 r2285 30 30 <ErrorReport>prompt</ErrorReport> 31 31 <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> 32 48 </PropertyGroup> 33 49 <ItemGroup> -
trunk/tools/CedmaDatabaseMerger/MergerForm.cs
r2277 r2285 49 49 importButton.Enabled = false; 50 50 BackgroundWorker worker = new BackgroundWorker(); 51 worker.WorkerReportsProgress = true; 51 52 worker.DoWork += CreateDoWorkDelegate(worker, importFileName); 52 53 worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged); … … 70 71 DatabaseService sourceDatabase = new DatabaseService("Data Source=" + importFileName); 71 72 73 sourceDatabase.Connect(); 72 74 var models = sourceDatabase.GetAllModels(); 75 var sourceDataset = sourceDatabase.GetDataset(); 73 76 int importCount = 0; 74 77 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)); 76 81 model.TargetVariable = m.TargetVariable.Name; 77 model.Data = (IItem)PersistenceManager.RestoreFromGZip(sourceDatabase.GetModelData(m)); 78 model.Dataset = sourceDatabase.GetDataset(); 82 model.Dataset = sourceDataset; 79 83 model.TrainingSamplesStart = m.TrainingSamplesStart; 80 84 model.TrainingSamplesEnd = m.TrainingSamplesEnd; … … 83 87 model.TestSamplesStart = m.TestSamplesStart; 84 88 model.TestSamplesEnd = m.TestSamplesEnd; 89 model.Predictor.Predict(sourceDataset, 10, 20); 85 90 //get all double properties to save as modelResult 86 91 IEnumerable<PropertyInfo> modelResultInfos = model.GetType().GetProperties().Where( … … 88 93 var modelResults = sourceDatabase.GetModelResults(m); 89 94 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); 92 97 } 93 98 var inputVariableResults = sourceDatabase.GetInputVariableResults(m); 94 99 foreach (IInputVariableResult result in inputVariableResults) { 95 model.AddInputVariable s(result.Variable.Name);100 model.AddInputVariable(result.Variable.Name); 96 101 if (result.Result.Name == "VariableEvaluationImpact") { 97 102 model.SetVariableEvaluationImpact(result.Variable.Name, result.Value); … … 100 105 } else throw new FormatException(); 101 106 } 102 107 103 108 destiationDatabase.Persist(model, m.Algorithm.Name, m.Algorithm.Description); 104 109 worker.ReportProgress((++importCount * 100) / models.Count()); 105 110 } 111 sourceDatabase.Disconnect(); 106 112 }; 107 113 }
Note: See TracChangeset
for help on using the changeset viewer.