Example #1
0
 def load_data_set(data_set_type, classification_method):
     print("".join(["Loading ", data_set_type, " data set for ", classification_method, "..."]))
     try:
         data_set_file = classification_method + "_"
         if data_set_type == DatasetType.TRAINING:
             data_set_file += FilePath.TRAINING_DATA_SET_FILE_NAME
         else:
             data_set_file += FilePath.TEST_DATA_SET_FILE_NAME
         return pickle.load(open(os.path.join(FilePath.DATA_FOLDER, data_set_file), "rb"))
     except Exception as e:
         raise UnableToLoadDatasetException(
                 "".join(["Unable to load: ", classification_method, " data set with cause: ", e.message, "\n"]))
Example #2
0
    def load_dataset(self, csv_file, one_hot, validation_size):
        """ Load a data set.

        Args:
            csv_file: a CSV file containing ground truth and file names.
            one_hot: a boolean. It True, will load the data set labels as a one-hot vector e.g. [0, 1, 0].
                            If False, will load the data set labels as integers.
            validation_size: the specified user's validation data set size.

        Returns:
            A DataSet object containing training and validation set.
        """
        try:
            img_names, labels = self._read_labels(csv_file, one_hot)
            return self._create_datasets(img_names, labels, validation_size)

        except Exception as e:
            raise UnableToLoadDatasetException(
                "Unable to load galaxies data set with cause: " + str(e))
    def load_dataset(self, csv_file, one_hot, validation_size):
        """ Load a data set.

        Args:
            csv_file: a CSV file containing ground truth and file names.
            feature_vector: a boolean. It True, will load the data set from a feature vector.
                            If False, will load the data set required to extract song features.

        Returns:
            A DataSet object containing training and validation set.
        """

        try:
            features, labels = self._read_labels(csv_file, one_hot)
            return self._create_datasets(features, labels, validation_size)

        except Exception as e:
            raise UnableToLoadDatasetException(
                "Unable to load music data set with cause: " + str(e))
Example #4
0
    def load_dataset(self, csv_file, one_hot, validation_size):
        """ Load a data set.

        Args:
            csv_file: a CSV file containing ground truth and file names.
            one_hot: a boolean. It True, will load the data set labels as a one-hot vector e.g. [0, 1, 0].
                            If False, will load the data set labels as integers.
            validation_size: the specified user's validation data set size.

        Returns:
            A tuple containing the feature vectors and labels associated to these vectors.
        """
        try:
            features, labels = self._load_feature_vector(csv_file, one_hot)
            return self.create_datasets(features, labels, validation_size)

        except Exception as e:
            raise UnableToLoadDatasetException(
                "Unable to load galaxies data set with cause: " + str(e))
    def load_dataset(self, csv_file, one_hot, validation_size):
        """ Load a data set.

             Args:
                 csv_file: a CSV file containing ground truth and file names.
                 feature_vector: a boolean. It True, will load the data set from a feature vector.
                                 If False, will load the data set required to extract galaxy image features.

             Returns:
                 A tuple containing the feature vectors and labels associated to these vectors.
             """
        try:
            feature_vectors, labels = self._load_feature_vector(
                csv_file, one_hot)
            return self._create_datasets(feature_vectors, labels,
                                         validation_size)

        except Exception as e:
            raise UnableToLoadDatasetException(
                "Unable to load spam data set with cause: " + str(e))