Example #1
0
    def save_variables(self, data_path="dataset", prefix=""):
        paths = self.get_file_paths(data_path, prefix)

        numpy.save(paths["selected_data_matrix"], self.selected_data_matrix)
        numpy.save(paths["selected_alphas_label_matrix"], self.selected_alphas_label_matrix)

        # notice, I save the dict.items(), since json will automatically convert the key to string.
        other_variables = {
            "b": self.b,
            "arg_exp": self.arg_exp,
            "transfer_hash": self.transfer_hash.items(),
            "svm_count": self.svm_count,
            "last_test_info": self.last_test_info,
        }
        # other_variables.pp()
        json_helper.save_nicely(paths["other_variables"], other_variables)
        return True
 def save_variables(self, data_path):
     file_path = os.path.join(data_path, self.variables_file_name)
     json_helper.save_nicely(file_path, self.classifying_hash.keys())
     return True