sknetwork-team / scikit-network

Graph Algorithms
Other
602 stars 67 forks source link

Verbose argument not expected in regression.Dirichlet fit_transform method though in description #531

Closed armand33 closed 2 years ago

armand33 commented 2 years ago

Description

import numpy as np
from sknetwork.regression import Dirichlet
from sknetwork.data import house

dirichlet = Dirichlet()
adjacency = house()
seeds = {0: 1, 2: 0}
values = dirichlet.fit_transform(adjacency, seeds, verbose=True)
np.round(values, 2)

outputs

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [5], in <cell line: 11>()
      7 adjacency = house()
      9 seeds = {0: 1, 2: 0}
---> 11 values = dirichlet.fit_transform(adjacency, seeds, verbose=True)
     13 np.round(values, 2)

File ~/miniconda3/envs/diffusion/lib/python3.9/site-packages/sknetwork/regression/base.py:37, in BaseRegressor.fit_transform(self, *args, **kwargs)
     29 def fit_transform(self, *args, **kwargs) -> np.ndarray:
     30     """Fit algorithm to data and return the scores. Same parameters as the ``fit`` method.
     31 
     32     Returns
   (...)
     35         Values.
     36     """
---> 37     self.fit(*args, **kwargs)
     38     return self.values_

TypeError: fit() got an unexpected keyword argument 'verbose'
tbonald commented 2 years ago

The verbose mode must be set when the object is created:

dirichlet = Dirichlet(verbose=True)

armand33 commented 2 years ago

Still the same issue with dirichlet = Dirichlet(verbose=True)

tbonald commented 2 years ago
import numpy as np
from sknetwork.regression import Dirichlet
from sknetwork.data import house

dirichlet = Dirichlet(verbose=True)
adjacency = house()
seeds = {0: 1, 2: 0}
values = dirichlet.fit_transform(adjacency, seeds)
np.round(values, 2)

Output: array([1. , 0.54, 0. , 0.31, 0.62])

armand33 commented 2 years ago

Ha ! My bad, thanks for the reply.