constructor()

in frontend/webapp/src/containers/TrainModelPage/TrainModelPage.js [27:470]


  constructor(props) {
    super(props);

    this.state = {
      fileToUpload: null,
      trainingDataS3Name: null,
      isUploading: false,

      // Tabs
      activeTab: TRAINING_TYPES.HPO,

      // ### HPO Parameters
      isLoadingHPO: false,
      hpoParameters: [
        {
          name: 'target',
          type: FIELD_TYPES.TEXT,
          text: 'Target Column Name',
          val: 'Target',
          placeholder: 'string',
          updateFunction: this.updateHPOParameter,
        },
        {
          name: 'batchNormalization',
          type: FIELD_TYPES.SELECT,
          label: 'Batch Normalization',
          options: [
            {
              key: 'true',
              text: 'Yes',
            },
            {
              key: 'false',
              text: 'No',
            }
          ],
          val: 'false',
          updateFunction: this.updateHPOParameter,
        },
        {
          name: 'includeDropout',
          type: FIELD_TYPES.SELECT,
          label: 'Include Dropout',
          options: [
            {
              key: 'true',
              text: 'Yes',
            },
            {
              key: 'false',
              text: 'No',
            }
          ],
          val: 'false',
          updateFunction: this.updateHPOParameter,
        },
        {
          name: 'dropout',
          conditionField: 'includeDropout',
          conditionFieldVal: 'true',
          type: FIELD_TYPES.ARRAY_NUMBER,
          label: 'Possible Dropout',
          arrayLength: 2,
          arrayValues: [0.2, 0.5],
          placeholder: 'valid values = integer',
          updateFunction: this.updateHPOParameter,
        },
        {
          name: 'lossMetric',
          type: FIELD_TYPES.SELECT,
          label: 'Loss Metric',
          options: [
            {
              key: 'mae',
              text: 'mae',
            },
            {
              key: 'mse',
              text: 'mse',
            }
          ],
          val: 'mae',
          updateFunction: this.updateHPOParameter,
        },
        {
          name: 'monitorMetric',
          type: FIELD_TYPES.SELECT,
          label: 'Monitor Metric',
          options: [
            {
              key: 'val_mean_absolute_error',
              text: 'val_mean_absolute_error',
            },
            {
              key: 'val_mean_squared_error',
              text: 'val_mean_squared_error',
            },
            {
              key: 'val_loss',
              text: 'val_loss',
            },
            {
              key: 'mean_absolute_error',
              text: 'mean_absolute_error',
            },
            {
              key: 'mean_squared_error',
              text: 'mean_squared_error',
            },
            {
              key: 'loss',
              text: 'loss',
            }
          ],
          val: 'val_mean_absolute_error',
          updateFunction: this.updateHPOParameter,
        },
        {
          name: 'lrUpdatePatience',
          type: FIELD_TYPES.NUMBER,
          text: 'Learning Rate Update Patience',
          val: 7,
          placeholder: 'valid values = integer',
          updateFunction: this.updateHPOParameter,
        },
        {
          name: 'earlyStoppingPatience',
          type: FIELD_TYPES.NUMBER,
          text: 'Early Stopping Patience',
          val: 15,
          placeholder: 'valid values = integer',
          updateFunction: this.updateHPOParameter,
        },
        {
          name: 'numLayersLow',
          type: FIELD_TYPES.NUMBER,
          text: 'Number of Layers (Minimum)',
          val: 6,
          placeholder: 'valid values = integer',
          updateFunction: this.updateHPOParameter,
        },
        {
          name: 'numLayersHigh',
          type: FIELD_TYPES.NUMBER,
          text: 'Number of Layers (Maximum)',
          val: 9,
          placeholder: 'valid values = integer',
          updateFunction: this.updateHPOParameter,
        },
        {
          name: 'choiceOfNodeNumbers',
          type: FIELD_TYPES.ARRAY_NUMBER,
          label: 'Possible Node Numbers',
          arrayLength: 8,
          arrayValues: [16, 32, 64, 128, 256, 512, 1024, 2048],
          placeholder: 'valid values = integer',
          updateFunction: this.updateHPOParameter,
        },
        {
          name: 'batchSize',
          type: FIELD_TYPES.ARRAY_NUMBER,
          label: 'Possible Batch Size',
          arrayLength: 4,
          arrayValues: [16, 32, 64, 128],
          placeholder: 'valid values = integer',
          updateFunction: this.updateHPOParameter,
        },
        {
          name: 'usedDataPercentage',
          type: FIELD_TYPES.NUMBER,
          text: 'Used Data Percentage',
          val: 10,
          placeholder: 'valid values = integer 1-100',
          updateFunction: this.updateHPOParameter,
        },
        {
          name: 'trainValidationSplit',
          type: FIELD_TYPES.NUMBER,
          text: 'Training/Validation Data Split',
          val: 0.15,
          placeholder: 'valid values = float 0.01-0.99',
          updateFunction: this.updateHPOParameter,
        },
        {
          name: 'maxEval',
          type: FIELD_TYPES.NUMBER,
          text: 'Max Evals',
          val: 3,
          placeholder: 'valid values = integer 1-10',
          updateFunction: this.updateHPOParameter,
        },
        {
          name: 'randomState',
          type: FIELD_TYPES.NUMBER,
          text: 'Random State',
          val: 50,
          placeholder: 'valid values = integer 1-100',
          updateFunction: this.updateHPOParameter,
        },
        {
          name: 'nbEpochs',
          type: FIELD_TYPES.NUMBER,
          text: 'Epochs',
          val: 5,
          placeholder: 'valid values = integer 1-3 (Higher values could take very long time to complete)',
          updateFunction: this.updateHPOParameter,
        },
        {
          name: 'optimizers',
          type: FIELD_TYPES.CHECKBOX,
          label: 'Optimizer',
          checkboxes: [
            {
              key: OPTIMIZERS.ADAM,
              text: OPTIMIZERS.ADAM,
              isChecked: true,
            },
            {
              key: OPTIMIZERS.SGD,
              text: OPTIMIZERS.SGD,
              isChecked: false,
            }
          ],
          updateFunction: this.updateHPOParameter,
        },
        {
          name: 'activationFunctions',
          type: FIELD_TYPES.CHECKBOX,
          label: 'Activation Functions',
          checkboxes: [
            {
              key: ACTIVATION_FUNCTIONS.TANH,
              text: ACTIVATION_FUNCTIONS.TANH,
              isChecked: true,
            },
            {
              key: ACTIVATION_FUNCTIONS.LINEAR,
              text: ACTIVATION_FUNCTIONS.LINEAR,
              isChecked: false,
            }
          ],
          updateFunction: this.updateHPOParameter,
        },
      ],

      // ### Hyperparameters
      hyperparameters: [
        {
          name: 'modelName',
          type: FIELD_TYPES.TEXT,
          text: 'Model Name',
          val: 'model-' + this.getCurrentTimeInStr(),
          placeholder: 'string',
          updateFunction: this.updateHyperparameter,
        },
        // Common parameters (same as HPO)
        {
          name: 'target',
          type: FIELD_TYPES.TEXT,
          text: 'Target Column Name',
          val: 'Target',
          placeholder: 'string',
          updateFunction: this.updateHyperparameter,
        },
        {
          name: 'batchNormalization',
          type: FIELD_TYPES.SELECT,
          label: 'Batch Normalization',
          options: [
            {
              key: 'true',
              text: 'Yes',
            },
            {
              key: 'false',
              text: 'No',
            }
          ],
          val: 'false',
          updateFunction: this.updateHyperparameter,
        },
        {
          name: 'includeDropout',
          type: FIELD_TYPES.SELECT,
          label: 'Include Dropout',
          options: [
            {
              key: 'true',
              text: 'Yes',
            },
            {
              key: 'false',
              text: 'No',
            }
          ],
          val: 'false',
          updateFunction: this.updateHyperparameter,
        },
        {
          name: 'dropoutF',
          conditionField: 'includeDropout',
          conditionFieldVal: 'true',
          type: FIELD_TYPES.NUMBER,
          text: 'Dropout',
          val: 0.2,
          placeholder: 'valid values = float (0.01-0.99)',
          updateFunction: this.updateHyperparameter,
        },
        {
          name: 'lossMetric',
          type: FIELD_TYPES.SELECT,
          label: 'Loss Metric',
          options: [
            {
              key: 'mae',
              text: 'mae',
            },
            {
              key: 'mse',
              text: 'mse',
            }
          ],
          val: 'mae',
          updateFunction: this.updateHyperparameter,
        },
        {
          name: 'monitorMetric',
          type: FIELD_TYPES.SELECT,
          label: 'Monitor Metric',
          options: [
            {
              key: 'val_mean_absolute_error',
              text: 'val_mean_absolute_error',
            },
            {
              key: 'val_mean_squared_error',
              text: 'val_mean_squared_error',
            },
            {
              key: 'val_loss',
              text: 'val_loss',
            },
            {
              key: 'mean_absolute_error',
              text: 'mean_absolute_error',
            },
            {
              key: 'mean_squared_error',
              text: 'mean_squared_error',
            },
            {
              key: 'loss',
              text: 'loss',
            }
          ],
          val: 'val_mean_absolute_error',
          updateFunction: this.updateHyperparameter,
        },
        {
          name: 'lrUpdatePatience',
          type: FIELD_TYPES.NUMBER,
          text: 'Learning Rate Update Patience',
          val: 7,
          placeholder: 'valid values = integer',
          updateFunction: this.updateHyperparameter,
        },
        {
          name: 'earlyStoppingPatience',
          type: FIELD_TYPES.NUMBER,
          text: 'Early Stopping Patience',
          val: 15,
          placeholder: 'valid values = integer',
          updateFunction: this.updateHyperparameter,
        },
        // Parameters specific to Training a model
        {
          name: 'nbEpochsF',
          type: FIELD_TYPES.NUMBER,
          text: 'Epochs',
          val: 5,
          placeholder: 'valid values = integer 1-10',
          updateFunction: this.updateHyperparameter,
        },
        {
          name: 'batchSizeF',
          type: FIELD_TYPES.NUMBER,
          text: 'Batch Size',
          val: 64,
          // val: 1,
          placeholder: 'valid values = integer 1-128',
          updateFunction: this.updateHyperparameter,
        },
        {
          name: 'optimizerF',
          type: FIELD_TYPES.SELECT,
          label: 'Optimizer',
          options: [
            {
              key: OPTIMIZERS.ADAM,
              text: OPTIMIZERS.ADAM,
            },
            {
              key: OPTIMIZERS.SGD,
              text: OPTIMIZERS.SGD,
            }
          ],
          val: OPTIMIZERS.ADAM,
          updateFunction: this.updateHyperparameter,
        },
        {
          name: 'lastActivationF',
          type: FIELD_TYPES.SELECT,
          label: 'Last Activation Function',
          options: [
            {
              key: ACTIVATION_FUNCTIONS.LINEAR,
              text: ACTIVATION_FUNCTIONS.LINEAR,
            },
            {
              key: ACTIVATION_FUNCTIONS.TANH,
              text: ACTIVATION_FUNCTIONS.TANH,
            }
          ],
          val: ACTIVATION_FUNCTIONS.TANH,
          updateFunction: this.updateHyperparameter,
        },
        {
          name: 'nodes',
          type: FIELD_TYPES.ARRAY_NUMBER,
          label: 'Number of layers',
          arrayLength: 8,
          // arrayLength: 2,
          arrayValues: [1024, 524, 256, 128, 64, 32, 16, 1],
          // arrayValues: [1, 1],
          placeholder: 'valid values = integer',
          updateFunction: this.updateHyperparameter,
        },
      ],

      // Training a model
      isLoadingTraining: false,

    };
  }