Untitled

mail@pastecode.io avatar
unknown
plain_text
6 months ago
2.6 kB
2
Indexable
Never
COde -

def load_models(self):
        print("loading models Matrix ................")
        with open(self.model_folder_name + self.model_tfidf, 'rb') as tfidf_file:
            tfidf_matrix = tfidf_file.read()
        with open(self.model_folder_name + self.model_tf_count, 'rb') as tf_count_file:
            tf_count_matrix = tf_count_file.read()

        print("loading model Config................")
        with open(self.model_folder_name + self.model_tfidf_vector, 'rb') as tfidf_vector_file:
            tfidf_vector = tfidf_vector_file.read()
        with open(self.model_folder_name + self.model_tf_count_vector, 'rb') as tf_count_vector_file:
            count_vector = tf_count_vector_file.read()

        print("loading Actual Data...................")
        with open(self.model_folder_name + self.raw_data, 'rb') as raw_data_file:
            df_act = pd.read_hdf(raw_data_file, 'data')

        print("loading unique noun in train data with vector value for context search ................")
        with open(self.model_folder_name + self.model_matching_data_train, 'rb') as matching_data_file:
            Matching_data = pd.read_hdf(matching_data_file, 'data')

        print("loading Glove vector dictionary ................")
        with open(self.model_folder_name + self.glove_vector_dict, 'rb') as glove_vector_dict_file:
            glove_vector_dict = pd.read_hdf(glove_vector_dict_file, 'data')

        print("loading context data ................")
        with open(self.model_folder_name + self.main_data_context, 'rb') as act_context_file:
            act_context = pd.read_hdf(act_context_file, 'data')

        return tfidf_matrix,tf_count_matrix,tfidf_vector,count_vector,df_act,Matching_data,glove_vector_dict,act_context

Error-

Traceback (most recent call last):
  File "user_recommendation.py", line 28, in <module>
    tfidf_matrix,tf_count_matrix,tfidf_vector,count_vector,df_act,Matching_data,embedding_dict,df_act_context = models.load_models()
  File "/CAPE_AIML/CAPE_USER_RECOMMENDATION/Code_H5PY/model_loading.py", line 56, in load_models
    df_act = pd.read_hdf(raw_data_file, 'data')
  File "/CAPE_AIML/venv/CAPEANALYTICS/lib/python3.6/site-packages/pandas/io/pytables.py", line 377, in read_hdf
    "Support for generic buffers has not been implemented."
NotImplementedError: Support for generic buffers has not been implemented.


when we checked documentation, pd.read_hdf()  is not supported for tabular data .. only for strings.

Can we have any alternative for it.


Leave a Comment