Exemple #1
0
        validation_labels, validation_asins, validation_reviewerIDs = pre_work.GenerateLabelEncoding(
            USER, (num_of_reviews + num_of_rating) + idx, 1, itemObj, userObj)

        _batch_labels, _asins, _reviewerIDs = pre_work.GenerateBatchLabelCandidate(
            validation_labels, validation_asins, validation_reviewerIDs,
            batch_size)

        validate_batch_labels.append(_batch_labels)
        validate_asins.append(_asins)
        validate_reviewerIDs.append(_reviewerIDs)

#%% Generate training batches
if (trainOption or validationOption):
    # Get training asin batches
    training_batches = pre_work.GenerateTrainingBatches(
        USER, itemObj, num_of_reviews=num_of_reviews, batch_size=batch_size)

# %%
if (trainOption):
    Train(voc,
          selectTable,
          training_batches,
          candidate_asins,
          candidate_reviewerIDs,
          training_batch_labels,
          directory,
          TrainEpoch=trainingEpoch,
          isStoreModel=True,
          WriteTrainLoss=True,
          store_every=2,
          batch_size=batch_size)
Exemple #2
0
                validation_labels, validation_asins, validation_reviewerIDs,
                batch_size)

            validate_batch_labels.append(_batch_labels)
            validate_asins.append(_asins)
            validate_reviewerIDs.append(_reviewerIDs)
    else:
        validate_batch_labels = None
        validate_asins = None
        validate_reviewerIDs = None

    # Generate training batches
    if (trainOption):
        training_batches, training_asin_batches = pre_work.GenerateTrainingBatches(
            USER,
            itemObj,
            voc,
            num_of_reviews=num_of_reviews,
            batch_size=batch_size)

    if (trainOption):
        Train(voc,
              selectTable,
              training_batches,
              training_asin_batches,
              candidate_asins,
              candidate_reviewerIDs,
              training_batch_labels,
              validate_batch_labels,
              validate_asins,
              validate_reviewerIDs,
              directory,