Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/11/20 13:39:48 (4 years ago)
Author:
pfleck
Message:

#3040 First draft of different-vector-length strategies (cut, fill, resample, cycle, ...)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/TensorFlowConstantOptimizationEvaluator.cs

    r17502 r17721  
    5656    private static readonly TF_DataType DataType = tf.float32;
    5757
    58 #region Parameter Properties
     58    #region Parameter Properties
    5959    public IFixedValueParameter<IntValue> ConstantOptimizationIterationsParameter {
    6060      get { return (IFixedValueParameter<IntValue>)Parameters[MaximumIterationsName]; }
     
    6363      get { return (IFixedValueParameter<DoubleValue>)Parameters[LearningRateName]; }
    6464    }
    65 #endregion
    66 
    67 #region Properties
     65    #endregion
     66
     67    #region Properties
    6868    public int ConstantOptimizationIterations {
    6969      get { return ConstantOptimizationIterationsParameter.Value.Value; }
     
    7272      get { return LearningRateParameter.Value.Value; }
    7373    }
    74 #endregion
     74    #endregion
    7575
    7676    public TensorFlowConstantOptimizationEvaluator()
     
    125125      var target = tf.placeholder(DataType, new TensorShape(numRows), name: problemData.TargetVariable);
    126126      // MSE
    127       var cost = tf.reduce_mean(tf.square(prediction - target));
     127      var cost = tf.reduce_mean(tf.square(target - prediction));
    128128
    129129      var optimizer = tf.train.AdamOptimizer((float)learningRate);
     
    144144        if (problemData.Dataset.VariableHasType<double>(variableName)) {
    145145          var data = problemData.Dataset.GetDoubleValues(variableName, rows).Select(x => (float)x).ToArray();
    146           variablesFeed.Add(variable, np.array(data, copy: false).reshape(numRows, 1));
     146          variablesFeed.Add(variable, np.array(data).reshape(numRows, 1));
    147147        } else if (problemData.Dataset.VariableHasType<DoubleVector>(variableName)) {
    148148          var data = problemData.Dataset.GetDoubleVectorValues(variableName, rows).Select(x => x.Select(y => (float)y).ToArray()).ToArray();
     
    152152      }
    153153      var targetData = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows).Select(x => (float)x).ToArray();
    154       variablesFeed.Add(target, np.array(targetData, copy: false));
     154      variablesFeed.Add(target, np.array(targetData));
    155155
    156156
Note: See TracChangeset for help on using the changeset viewer.