dice-group / vectograph

GNU General Public License v3.0
1 stars 2 forks source link

Error in KGEOnRelationalData.ipynb using Pyke Model: #2

Closed ghost closed 4 years ago

ghost commented 4 years ago
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-4-5f58e650ca91> in <module>
     17                  ])
     18 
---> 19 pipe.fit_transform(df)

~/.conda/envs/daikiri/lib/python3.6/site-packages/sklearn/pipeline.py in fit_transform(self, X, y, **fit_params)
    383         """
    384         last_step = self._final_estimator
--> 385         Xt, fit_params = self._fit(X, y, **fit_params)
    386         with _print_elapsed_time('Pipeline',
    387                                  self._log_message(len(self.steps) - 1)):

~/.conda/envs/daikiri/lib/python3.6/site-packages/sklearn/pipeline.py in _fit(self, X, y, **fit_params)
    313                 message_clsname='Pipeline',
    314                 message=self._log_message(step_idx),
--> 315                 **fit_params_steps[name])
    316             # Replace the transformer of the step with the fitted
    317             # transformer. This is necessary when loading the transformer

~/.conda/envs/daikiri/lib/python3.6/site-packages/joblib/memory.py in __call__(self, *args, **kwargs)
    350 
    351     def __call__(self, *args, **kwargs):
--> 352         return self.func(*args, **kwargs)
    353 
    354     def call_and_shelve(self, *args, **kwargs):

~/.conda/envs/daikiri/lib/python3.6/site-packages/sklearn/pipeline.py in _fit_transform_one(transformer, X, y, weight, message_clsname, message, **fit_params)
    726     with _print_elapsed_time(message_clsname, message):
    727         if hasattr(transformer, 'fit_transform'):
--> 728             res = transformer.fit_transform(X, y, **fit_params)
    729         else:
    730             res = transformer.fit(X, y, **fit_params).transform(X)

~/.conda/envs/daikiri/lib/python3.6/site-packages/sklearn/base.py in fit_transform(self, X, y, **fit_params)
    569         if y is None:
    570             # fit method of arity 1 (unsupervised transformation)
--> 571             return self.fit(X, **fit_params).transform(X)
    572         else:
    573             # fit method of arity 2 (supervised transformation)

~/src/Hamada/vectograph/transformers.py in transform(self, path_of_kg)
    320 
    321         if self.params['model'] == 'Pyke':
--> 322             return self.__run_pyke(path_of_kg)
    323         elif self.params['model'] in ['Distmult', 'Tucker', 'Conve', 'Complex']:
    324             return self.__run_link_prediction_base_models(path_of_kg)

~/src/Hamada/vectograph/transformers.py in __run_pyke(self, path_of_kg)
    286         self.logger.info('PYKE being executed.')
    287 
--> 288         parser = Parser(p_folder=self.params['storage_path'], k=self.params['K_for_PYKE'])
    289         parser.set_logger(self.logger)
    290         parser.set_similarity_measure(PPMI)

KeyError: 'K_for_PYKE'
Demirrr commented 4 years ago

Dear @hamadazahera,

As explicitly written in the tutorial, we apply DistMult, not PYKE.

ghost commented 4 years ago

DistMult works fine!. I tried to run the code with a different model (e.g PYKE). Is it possible with the same code, or do I need to call other functions, classes?

Demirrr commented 4 years ago

Hello Hamada,

We provide several examples to make the computation flow of Tabular to KG conversion visible. Consequently, none of the examples are for the production. Please use main.py

Demirrr commented 4 years ago

I reckon all is now well now. Consequently, I close this issue.