Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15675


Ignore:
Timestamp:
01/30/18 15:06:28 (7 years ago)
Author:
fholzing
Message:

#2883: Changed from Boolean to Enum

Location:
branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesAlgorithm.cs

    r15583 r15675  
    2323using System.Linq;
    2424using System.Threading;
     25using HeuristicLab.Algorithms.DataAnalysis.GradientBoostedTrees;
    2526using HeuristicLab.Analysis;
    2627using HeuristicLab.Common;
     
    5253
    5354    #region ParameterProperties
    54     public IFixedValueParameter<IntValue> IterationsParameter {
     55    public IFixedValueParameter<IntValue> IterationsParameter
     56    {
    5557      get { return (IFixedValueParameter<IntValue>)Parameters[IterationsParameterName]; }
    5658    }
    57     public IFixedValueParameter<IntValue> MaxSizeParameter {
     59    public IFixedValueParameter<IntValue> MaxSizeParameter
     60    {
    5861      get { return (IFixedValueParameter<IntValue>)Parameters[MaxSizeParameterName]; }
    5962    }
    60     public IFixedValueParameter<DoubleValue> NuParameter {
     63    public IFixedValueParameter<DoubleValue> NuParameter
     64    {
    6165      get { return (IFixedValueParameter<DoubleValue>)Parameters[NuParameterName]; }
    6266    }
    63     public IFixedValueParameter<DoubleValue> RParameter {
     67    public IFixedValueParameter<DoubleValue> RParameter
     68    {
    6469      get { return (IFixedValueParameter<DoubleValue>)Parameters[RParameterName]; }
    6570    }
    66     public IFixedValueParameter<DoubleValue> MParameter {
     71    public IFixedValueParameter<DoubleValue> MParameter
     72    {
    6773      get { return (IFixedValueParameter<DoubleValue>)Parameters[MParameterName]; }
    6874    }
    69     public IFixedValueParameter<IntValue> SeedParameter {
     75    public IFixedValueParameter<IntValue> SeedParameter
     76    {
    7077      get { return (IFixedValueParameter<IntValue>)Parameters[SeedParameterName]; }
    7178    }
    72     public FixedValueParameter<BoolValue> SetSeedRandomlyParameter {
     79    public FixedValueParameter<BoolValue> SetSeedRandomlyParameter
     80    {
    7381      get { return (FixedValueParameter<BoolValue>)Parameters[SetSeedRandomlyParameterName]; }
    7482    }
    75     public IConstrainedValueParameter<ILossFunction> LossFunctionParameter {
     83    public IConstrainedValueParameter<ILossFunction> LossFunctionParameter
     84    {
    7685      get { return (IConstrainedValueParameter<ILossFunction>)Parameters[LossFunctionParameterName]; }
    7786    }
    78     public IFixedValueParameter<IntValue> UpdateIntervalParameter {
     87    public IFixedValueParameter<IntValue> UpdateIntervalParameter
     88    {
    7989      get { return (IFixedValueParameter<IntValue>)Parameters[UpdateIntervalParameterName]; }
    8090    }
    81     public IFixedValueParameter<BoolValue> CreateSolutionParameter {
    82       get { return (IFixedValueParameter<BoolValue>)Parameters[CreateSolutionParameterName]; }
     91    private IFixedValueParameter<EnumValue<ModelStorage>> CreateSolutionParameter
     92    {
     93      get { return (IFixedValueParameter<EnumValue<ModelStorage>>)Parameters[CreateSolutionParameterName]; }
    8394    }
    8495    #endregion
    8596
    8697    #region Properties
    87     public int Iterations {
     98    public int Iterations
     99    {
    88100      get { return IterationsParameter.Value.Value; }
    89101      set { IterationsParameter.Value.Value = value; }
    90102    }
    91     public int Seed {
     103    public int Seed
     104    {
    92105      get { return SeedParameter.Value.Value; }
    93106      set { SeedParameter.Value.Value = value; }
    94107    }
    95     public bool SetSeedRandomly {
     108    public bool SetSeedRandomly
     109    {
    96110      get { return SetSeedRandomlyParameter.Value.Value; }
    97111      set { SetSeedRandomlyParameter.Value.Value = value; }
    98112    }
    99     public int MaxSize {
     113    public int MaxSize
     114    {
    100115      get { return MaxSizeParameter.Value.Value; }
    101116      set { MaxSizeParameter.Value.Value = value; }
    102117    }
    103     public double Nu {
     118    public double Nu
     119    {
    104120      get { return NuParameter.Value.Value; }
    105121      set { NuParameter.Value.Value = value; }
    106122    }
    107     public double R {
     123    public double R
     124    {
    108125      get { return RParameter.Value.Value; }
    109126      set { RParameter.Value.Value = value; }
    110127    }
    111     public double M {
     128    public double M
     129    {
    112130      get { return MParameter.Value.Value; }
    113131      set { MParameter.Value.Value = value; }
    114132    }
    115     public bool CreateSolution {
     133    public ModelStorage CreateSolution
     134    {
    116135      get { return CreateSolutionParameter.Value.Value; }
    117136      set { CreateSolutionParameter.Value.Value = value; }
     
    120139
    121140    #region ResultsProperties
    122     private double ResultsBestQuality {
     141    private double ResultsBestQuality
     142    {
    123143      get { return ((DoubleValue)Results["Best Quality"].Value).Value; }
    124144      set { ((DoubleValue)Results["Best Quality"].Value).Value = value; }
    125145    }
    126     private DataTable ResultsQualities {
     146    private DataTable ResultsQualities
     147    {
    127148      get { return ((DataTable)Results["Qualities"].Value); }
    128149    }
     
    152173      Parameters.Add(new FixedValueParameter<IntValue>(UpdateIntervalParameterName, "", new IntValue(100)));
    153174      Parameters[UpdateIntervalParameterName].Hidden = true;
    154       Parameters.Add(new FixedValueParameter<BoolValue>(CreateSolutionParameterName, "Flag that indicates if a solution should be produced at the end of the run", new BoolValue(true)));
     175      Parameters.Add(new FixedValueParameter<EnumValue<ModelStorage>>(CreateSolutionParameterName, "Flag that indicates what kind of solution should be produced at the end of the run", new EnumValue<ModelStorage>(ModelStorage.Parameter)));
    155176      Parameters[CreateSolutionParameterName].Hidden = true;
    156177
     
    164185      // BackwardsCompatibility3.4
    165186      #region Backwards compatible code, remove with 3.5
     187
     188      #region LossFunction
    166189      // parameter type has been changed
    167190      var lossFunctionParam = Parameters[LossFunctionParameterName] as ConstrainedValueParameter<StringValue>;
     
    182205      }
    183206      #endregion
     207
     208      #region CreateSolution
     209      // parameter type has been changed
     210      var createSolutionParam = Parameters[CreateSolutionParameterName] as FixedValueParameter<BoolValue>;
     211      if (createSolutionParam != null) {
     212        Parameters.Remove(CreateSolutionParameterName);
     213
     214        ModelStorage value = createSolutionParam.Value.Value ? ModelStorage.Parameter : ModelStorage.Quality;
     215        Parameters.Add(new FixedValueParameter<EnumValue<ModelStorage>>(CreateSolutionParameterName, "Flag that indicates what kind of solution should be produced at the end of the run", new EnumValue<ModelStorage>(value)));
     216        Parameters[CreateSolutionParameterName].Hidden = true;
     217      }
     218      #endregion
     219      #endregion
    184220    }
    185221
     
    248284
    249285      // produce solution
    250       if (CreateSolution) {
     286      if (CreateSolution == ModelStorage.Parameter) {
    251287        var model = state.GetModel();
    252288
  • branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj

    r15670 r15675  
    308308    <Compile Include="GradientBoostedTrees\LossFunctions\SquaredErrorLoss.cs" />
    309309    <Compile Include="GradientBoostedTrees\GradientBoostedTreesSolution.cs" />
     310    <Compile Include="GradientBoostedTrees\ModelStorage.cs" />
    310311    <Compile Include="GradientBoostedTrees\RegressionTreeBuilder.cs" />
    311312    <Compile Include="GradientBoostedTrees\RegressionTreeModel.cs" />
  • branches/2883_GBTModelStorage/HeuristicLab.Algorithms.DataAnalysis/3.4/Plugin.cs

    r15670 r15675  
    2626  /// Plugin class for HeuristicLab.Algorithms.DataAnalysis plugin.
    2727  /// </summary>
    28   [Plugin("HeuristicLab.Algorithms.DataAnalysis", "Provides wrappers for data analysis algorithms implemented in external libraries (linear regression, linear discriminant analysis, k-means clustering, support vector classification and regression)", "3.4.11.15589")]
     28  [Plugin("HeuristicLab.Algorithms.DataAnalysis", "Provides wrappers for data analysis algorithms implemented in external libraries (linear regression, linear discriminant analysis, k-means clustering, support vector classification and regression)", "3.4.11.15670")]
    2929  [PluginFile("HeuristicLab.Algorithms.DataAnalysis-3.4.dll", PluginFileType.Assembly)]
    3030  [PluginDependency("HeuristicLab.ALGLIB", "3.7.0")]
Note: See TracChangeset for help on using the changeset viewer.