Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/13/17 11:33:55 (7 years ago)
Author:
bwerth
Message:

#2700 fixed parameter names

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/TSNE/TSNEAlgorithm.cs

    r15225 r15227  
    5858
    5959    #region parameter names
    60     private const string DistanceParameterName = "DistanceFunction";
     60    private const string DistanceFunctionParameterName = "DistanceFunction";
    6161    private const string PerplexityParameterName = "Perplexity";
    6262    private const string ThetaParameterName = "Theta";
     
    7070    private const string SetSeedRandomlyParameterName = "SetSeedRandomly";
    7171    private const string SeedParameterName = "Seed";
    72     private const string ClassesParameterName = "ClassNames";
     72    private const string ClassesNameParameterName = "ClassesName";
    7373    private const string NormalizationParameterName = "Normalization";
    7474    private const string UpdateIntervalParameterName = "UpdateInterval";
     
    9393      get { return Parameters[NewDimensionsParameterName] as IFixedValueParameter<IntValue>; }
    9494    }
    95     public IConstrainedValueParameter<IDistance<double[]>> DistanceParameter {
    96       get { return Parameters[DistanceParameterName] as IConstrainedValueParameter<IDistance<double[]>>; }
     95    public IConstrainedValueParameter<IDistance<double[]>> DistanceFunctionParameter {
     96      get { return Parameters[DistanceFunctionParameterName] as IConstrainedValueParameter<IDistance<double[]>>; }
    9797    }
    9898    public IFixedValueParameter<IntValue> MaxIterationsParameter {
     
    120120      get { return Parameters[SeedParameterName] as IFixedValueParameter<IntValue>; }
    121121    }
    122     public IConstrainedValueParameter<StringValue> ClassesParameter {
    123       get { return Parameters[ClassesParameterName] as IConstrainedValueParameter<StringValue>; }
     122    public IConstrainedValueParameter<StringValue> ClassesNameParameter {
     123      get { return Parameters[ClassesNameParameterName] as IConstrainedValueParameter<StringValue>; }
    124124    }
    125125    public IFixedValueParameter<BoolValue> NormalizationParameter {
     
    132132
    133133    #region  Properties
    134     public IDistance<double[]> Distance {
    135       get { return DistanceParameter.Value; }
     134    public IDistance<double[]> DistanceFunction {
     135      get { return DistanceFunctionParameter.Value; }
    136136    }
    137137    public double Perplexity {
     
    179179      set { SeedParameter.Value.Value = value; }
    180180    }
    181     public string Classes {
    182       get { return ClassesParameter.Value != null ? ClassesParameter.Value.Value : null; }
    183       set { ClassesParameter.Value.Value = value; }
     181    public string ClassesName {
     182      get { return ClassesNameParameter.Value != null ? ClassesNameParameter.Value.Value : null; }
     183      set { ClassesNameParameter.Value.Value = value; }
    184184    }
    185185    public bool Normalization {
     
    210210    public TSNEAlgorithm() {
    211211      var distances = new ItemSet<IDistance<double[]>>(ApplicationManager.Manager.GetInstances<IDistance<double[]>>());
    212       Parameters.Add(new ConstrainedValueParameter<IDistance<double[]>>(DistanceParameterName, "The distance function used to differentiate similar from non-similar points", distances, distances.OfType<EuclideanDistance>().FirstOrDefault()));
     212      Parameters.Add(new ConstrainedValueParameter<IDistance<double[]>>(DistanceFunctionParameterName, "The distance function used to differentiate similar from non-similar points", distances, distances.OfType<EuclideanDistance>().FirstOrDefault()));
    213213      Parameters.Add(new FixedValueParameter<DoubleValue>(PerplexityParameterName, "Perplexity-parameter of tSNE. Comparable to k in a k-nearest neighbour algorithm. Recommended value is floor(number of points /3) or lower", new DoubleValue(25)));
    214214      Parameters.Add(new FixedValueParameter<PercentValue>(ThetaParameterName, "Value describing how much appoximated " +
     
    229229
    230230      //Name of the column specifying the class lables of each data point.If the label column can not be found training/test is used as labels."
    231       Parameters.Add(new OptionalConstrainedValueParameter<StringValue>(ClassesParameterName, "Name of the column specifying the class lables of each data point."));
     231      Parameters.Add(new OptionalConstrainedValueParameter<StringValue>(ClassesNameParameterName, "Name of the column specifying the class lables of each data point."));
    232232      Parameters.Add(new FixedValueParameter<BoolValue>(NormalizationParameterName, "Whether the data should be zero centered and have variance of 1 for each variable, so different scalings are ignored.", new BoolValue(true)));
    233233      Parameters.Add(new FixedValueParameter<IntValue>(UpdateIntervalParameterName, "", new IntValue(50)));
     
    273273        if (Normalization) data = NormalizeData(data);
    274274
    275         state = TSNEStatic<double[]>.CreateState(data, Distance, random, NewDimensions, Perplexity, Theta,
     275        state = TSNEStatic<double[]>.CreateState(data, DistanceFunction, random, NewDimensions, Perplexity, Theta,
    276276          StopLyingIteration, MomentumSwitchIteration, InitialMomentum, FinalMomentum, Eta);
    277277
     
    305305    private void OnProblemDataChanged(object sender, EventArgs args) {
    306306      if (Problem == null || Problem.ProblemData == null) return;
    307       if (!Parameters.ContainsKey(ClassesParameterName)) return;
    308       ClassesParameter.ValidValues.Clear();
    309       foreach (var input in Problem.ProblemData.InputVariables) ClassesParameter.ValidValues.Add(input);
     307      if (!Parameters.ContainsKey(ClassesNameParameterName)) return;
     308      ClassesNameParameter.ValidValues.Clear();
     309      foreach (var input in Problem.ProblemData.InputVariables) ClassesNameParameter.ValidValues.Add(input);
    310310    }
    311311
     
    321321
    322322      //color datapoints acording to classes variable (be it double or string)
    323       if (problemData.Dataset.VariableNames.Contains(Classes)) {
    324         if ((problemData.Dataset as Dataset).VariableHasType<string>(Classes)) {
    325           var classes = problemData.Dataset.GetStringValues(Classes).ToArray();
     323      if (problemData.Dataset.VariableNames.Contains(ClassesName)) {
     324        if ((problemData.Dataset as Dataset).VariableHasType<string>(ClassesName)) {
     325          var classes = problemData.Dataset.GetStringValues(ClassesName).ToArray();
    326326          for (var i = 0; i < classes.Length; i++) {
    327327            if (!dataRowNames.ContainsKey(classes[i])) dataRowNames.Add(classes[i], new List<int>());
    328328            dataRowNames[classes[i]].Add(i);
    329329          }
    330         } else if ((problemData.Dataset as Dataset).VariableHasType<double>(Classes)) {
    331           var classValues = problemData.Dataset.GetDoubleValues(Classes).ToArray();
     330        } else if ((problemData.Dataset as Dataset).VariableHasType<double>(ClassesName)) {
     331          var classValues = problemData.Dataset.GetDoubleValues(ClassesName).ToArray();
    332332          var max = classValues.Max() + 0.1;
    333333          var min = classValues.Min() - 0.1;
Note: See TracChangeset for help on using the changeset viewer.