Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/16/17 12:15:11 (8 years ago)
Author:
mkommend
Message:

#2205: Worked on optimization networks for integrated machine learning.

Location:
branches/OptimizationNetworks
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/OptimizationNetworks/HeuristicLab.IntegratedMachineLearning.sln

    r14625 r14675  
    4242    HideSolutionNode = FALSE
    4343  EndGlobalSection
     44  GlobalSection(Performance) = preSolution
     45    HasPerformanceSessions = true
     46  EndGlobalSection
    4447EndGlobal
  • branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.MachineLearning/FeatureSelectionNetwork.cs

    r14635 r14675  
    6969
    7070      var regressionAlgorithm = CreateRegressionAlgorithm();
    71       //TODO set empty regression problem
    72 
    7371      RegressionAlgorithmNode = new OrchestratedAlgorithmNode("Regression");
    7472      RegressionAlgorithmNode.Algorithm = regressionAlgorithm;
     
    8179      var problem = new OrchestratedBinaryProblem(Orchestrator, 0, false);
    8280      problem.Encoding.SolutionCreator = new RandomBinaryVectorCreator() { TrueProbability = new DoubleValue(0.2) };
    83 
    8481
    8582      var osga = new OffspringSelectionGeneticAlgorithm();
     
    126123      var msg = FeatureSelectionAlgorithmNode.OrchestrationPort.PrepareMessage();
    127124      msg["OrchestrationMessage"] = new EnumValue<OrchestrationMessage>(OrchestrationMessage.Stop);
    128       FeatureSelectionAlgorithmNode.OrchestrationPort.ReceiveMessage(msg, new CancellationToken()); ;
     125      FeatureSelectionAlgorithmNode.OrchestrationPort.ReceiveMessage(msg, new CancellationToken());
     126      RegressionAlgorithmNode.Algorithm.Runs.Clear();
    129127    }
    130128  }
  • branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.MachineLearning/FeatureSelectionOrchestrator.cs

    r14631 r14675  
    9393
    9494    private void FeatureSelectionEvaluationPort_MessageReceived(IMessage evaluationMessage, CancellationToken token) {
     95      var problemData = (IRegressionProblemData)RegressionProblemData.Clone();
    9596      var binaryVector = (BinaryVector)evaluationMessage["BinaryVector"];
    96       var problemData = (IRegressionProblemData)RegressionProblemData.Clone();
     97      binaryVector.ElementNames = problemData.InputVariables.CheckedItems.Select(variable => variable.Value.Value);
    9798
    9899      var allowedVariables = problemData.InputVariables.CheckedItems.Zip(binaryVector,
    99100        (variable, allowed) => new { VariableName = variable.Value, Allowed = allowed });
     101
    100102      foreach (var allowedVariable in allowedVariables)
    101103        problemData.InputVariables.SetItemCheckedState(allowedVariable.VariableName, allowedVariable.Allowed);
     
    113115
    114116      var regressionSolution = results.Select(r => r.Value).OfType<IRegressionSolution>().First();
     117
     118      UpdatedResults(binaryVector, regressionSolution);
     119
     120
    115121      double quality = regressionSolution.TestMeanAbsoluteError;
    116122      evaluationMessage["Quality"] = new DoubleValue(quality);
     123    }
     124
     125    private void UpdatedResults(BinaryVector binaryVector, IRegressionSolution solution) {
     126      if (!Results.ContainsKey("Best Solution Vector")) {
     127        Results.Add(new Result("Best Solution Vector", typeof(BinaryVector)));
     128        //Results.Add(new Result("Best Solution Variables", typeof(DoubleArray)));
     129        Results.Add(new Result("Best Symbolic Solution", typeof(IRegressionSolution)));
     130      }
     131
     132      var previousBestVector = (BinaryVector)Results["Best Solution Vector"].Value;
     133
     134      //check if better vector has been found
     135      if (previousBestVector != null && binaryVector.SequenceEqual(previousBestVector))
     136        return;
     137
     138      Results["Best Solution Vector"].Value = binaryVector;
     139      Results["Best Symbolic Solution"].Value = solution;
     140
     141      //var variableNames = solution.ProblemData.AllowedInputVariables;
     142      //alglib.linearmodel lm = BuildModel(best, problemData);
     143
     144      //double[] coefficients = null;
     145      //int nFeatures = -1;
     146      //alglib.lrunpack(lm, out coefficients, out nFeatures);
     147
     148      //var doubleArray = new DoubleArray(coefficients.ToArray());
     149      //doubleArray.ElementNames = variableNames;
     150      //Results["Best Solution Variables"].Value = doubleArray;
     151
     152
    117153    }
    118154
  • branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.MachineLearning/HeuristicLab.Networks.IntegratedOptimization.MachineLearning-3.3.csproj

    r14628 r14675  
    3737  </PropertyGroup>
    3838  <ItemGroup>
     39    <Reference Include="ALGLIB-3.7.0, Version=3.7.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     40      <SpecificVersion>False</SpecificVersion>
     41      <HintPath>..\..\..\trunk\sources\bin\ALGLIB-3.7.0.dll</HintPath>
     42      <Private>False</Private>
     43    </Reference>
    3944    <Reference Include="HeuristicLab.Algorithms.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    4045      <SpecificVersion>False</SpecificVersion>
  • branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.MachineLearning/OrchestratedBinaryProblem.cs

    r14625 r14675  
    3030namespace HeuristicLab.Networks.IntegratedOptimization.MachineLearning {
    3131  [StorableClass]
     32  [Creatable("Optimization Networks")]
    3233  public sealed class OrchestratedBinaryProblem : SingleObjectiveBasicProblem<BinaryVectorEncoding> {
    3334
Note: See TracChangeset for help on using the changeset viewer.