| @@ -233,19 +233,19 @@ class SimpleBridge(BaseBridge): | |||||
| ``self.metric_list``. If ``val_data`` is None, ``train_data`` will be used to validate | ``self.metric_list``. If ``val_data`` is None, ``train_data`` will be used to validate | ||||
| the model during training time. Defaults to None. | the model during training time. Defaults to None. | ||||
| loops : int | loops : int | ||||
| Machine Learning part and Reasoning part will be iteratively optimized | |||||
| for ``loops`` times, by default 50. | |||||
| Learning part and Reasoning part will be iteratively optimized | |||||
| for ``loops`` times. Defaults to 50. | |||||
| segment_size : Union[int, float] | segment_size : Union[int, float] | ||||
| Data will be split into segments of this size and data in each segment | Data will be split into segments of this size and data in each segment | ||||
| will be used together to train the model, by default 1.0. | |||||
| will be used together to train the model. Defaults to 1.0. | |||||
| eval_interval : int | eval_interval : int | ||||
| The model will be evaluated every ``eval_interval`` loop during training, | The model will be evaluated every ``eval_interval`` loop during training, | ||||
| by default 1. | |||||
| Defaults to 1. | |||||
| save_interval : int, optional | save_interval : int, optional | ||||
| The model will be saved every ``eval_interval`` loop during training, by | |||||
| default None. | |||||
| The model will be saved every ``eval_interval`` loop during training. | |||||
| Defaults to None. | |||||
| save_dir : str, optional | save_dir : str, optional | ||||
| Directory to save the model, by default None. | |||||
| Directory to save the model. Defaults to None. | |||||
| """ | """ | ||||
| data_examples = self.data_preprocess("train", train_data) | data_examples = self.data_preprocess("train", train_data) | ||||
| @@ -24,7 +24,7 @@ class BaseMetric(metaclass=ABCMeta): | |||||
| prefix : str, optional | prefix : str, optional | ||||
| The prefix that will be added in the metrics names to disambiguate homonymous | The prefix that will be added in the metrics names to disambiguate homonymous | ||||
| metrics of different tasks. If prefix is not provided in the argument, | metrics of different tasks. If prefix is not provided in the argument, | ||||
| self.default_prefix will be used instead. Default to None. | |||||
| self.default_prefix will be used instead. Defaults to None. | |||||
| """ | """ | ||||
| @@ -25,10 +25,10 @@ class ReasoningMetric(BaseMetric): | |||||
| ---------- | ---------- | ||||
| kb : KBBase | kb : KBBase | ||||
| An instance of a knowledge base, used for logical reasoning and validation. | An instance of a knowledge base, used for logical reasoning and validation. | ||||
| If not provided, reasoning checks are not performed. Default to None. | |||||
| If not provided, reasoning checks are not performed. Defaults to None. | |||||
| prefix : str, optional | prefix : str, optional | ||||
| The prefix that will be added to the metrics names to disambiguate homonymous | The prefix that will be added to the metrics names to disambiguate homonymous | ||||
| metrics of different tasks. Inherits from BaseMetric. Default to None. | |||||
| metrics of different tasks. Inherits from BaseMetric. Defaults to None. | |||||
| Notes | Notes | ||||
| ----- | ----- | ||||
| @@ -21,7 +21,7 @@ class SymbolAccuracy(BaseMetric): | |||||
| ---------- | ---------- | ||||
| prefix : str, optional | prefix : str, optional | ||||
| The prefix that will be added to the metrics names to disambiguate homonymous | The prefix that will be added to the metrics names to disambiguate homonymous | ||||
| metrics of different tasks. Inherits from BaseMetric. Default to None. | |||||
| metrics of different tasks. Inherits from BaseMetric. Defaults to None. | |||||
| """ | """ | ||||
| def process(self, data_examples: ListData) -> None: | def process(self, data_examples: ListData) -> None: | ||||
| @@ -33,30 +33,30 @@ class BasicNN: | |||||
| scheduler : Callable[..., Any], optional | scheduler : Callable[..., Any], optional | ||||
| The learning rate scheduler used for training, which will be called | The learning rate scheduler used for training, which will be called | ||||
| at the end of each run of the ``fit`` method. It should implement the | at the end of each run of the ``fit`` method. It should implement the | ||||
| ``step`` method, by default None. | |||||
| ``step`` method. Defaults to None. | |||||
| device : Union[torch.device, str] | device : Union[torch.device, str] | ||||
| The device on which the model will be trained or used for prediction, | The device on which the model will be trained or used for prediction, | ||||
| by default torch.device("cpu"). | |||||
| Defaults to torch.device("cpu"). | |||||
| batch_size : int, optional | batch_size : int, optional | ||||
| The batch size used for training, by default 32. | |||||
| The batch size used for training. Defaults to 32. | |||||
| num_epochs : int, optional | num_epochs : int, optional | ||||
| The number of epochs used for training, by default 1. | |||||
| The number of epochs used for training. Defaults to 1. | |||||
| stop_loss : float, optional | stop_loss : float, optional | ||||
| The loss value at which to stop training, by default 0.0001. | |||||
| The loss value at which to stop training. Defaults to 0.0001. | |||||
| num_workers : int | num_workers : int | ||||
| The number of workers used for loading data, by default 0. | |||||
| The number of workers used for loading data. Defaults to 0. | |||||
| save_interval : int, optional | save_interval : int, optional | ||||
| The model will be saved every ``save_interval`` epoch during training, by default None. | |||||
| The model will be saved every ``save_interval`` epoch during training. Defaults to None. | |||||
| save_dir : str, optional | save_dir : str, optional | ||||
| The directory in which to save the model during training, by default None. | |||||
| The directory in which to save the model during training. Defaults to None. | |||||
| train_transform : Callable[..., Any], optional | train_transform : Callable[..., Any], optional | ||||
| A function/transform that takes an object and returns a transformed version used | A function/transform that takes an object and returns a transformed version used | ||||
| in the ``fit`` and ``train_epoch`` methods, by default None. | |||||
| in the ``fit`` and ``train_epoch`` methods. Defaults to None. | |||||
| test_transform : Callable[..., Any], optional | test_transform : Callable[..., Any], optional | ||||
| A function/transform that takes an object and returns a transformed version in the | A function/transform that takes an object and returns a transformed version in the | ||||
| ``predict``, ``predict_proba`` and ``score`` methods, , by default None. | |||||
| ``predict``, ``predict_proba`` and ``score`` methods, . Defaults to None. | |||||
| collate_fn : Callable[[List[T]], Any], optional | collate_fn : Callable[[List[T]], Any], optional | ||||
| The function used to collate data, by default None. | |||||
| The function used to collate data. Defaults to None. | |||||
| """ | """ | ||||
| def __init__( | def __init__( | ||||
| @@ -184,11 +184,11 @@ class BasicNN: | |||||
| Parameters | Parameters | ||||
| ---------- | ---------- | ||||
| data_loader : DataLoader, optional | data_loader : DataLoader, optional | ||||
| The data loader used for training, by default None. | |||||
| The data loader used for training. Defaults to None. | |||||
| X : List[Any], optional | X : List[Any], optional | ||||
| The input data, by default None. | |||||
| The input data. Defaults to None. | |||||
| y : List[int], optional | y : List[int], optional | ||||
| The target data, by default None. | |||||
| The target data. Defaults to None. | |||||
| Returns | Returns | ||||
| ------- | ------- | ||||
| @@ -291,9 +291,9 @@ class BasicNN: | |||||
| Parameters | Parameters | ||||
| ---------- | ---------- | ||||
| data_loader : DataLoader, optional | data_loader : DataLoader, optional | ||||
| The data loader used for prediction, by default None. | |||||
| The data loader used for prediction. Defaults to None. | |||||
| X : List[Any], optional | X : List[Any], optional | ||||
| The input data, by default None. | |||||
| The input data. Defaults to None. | |||||
| Returns | Returns | ||||
| ------- | ------- | ||||
| @@ -333,9 +333,9 @@ class BasicNN: | |||||
| Parameters | Parameters | ||||
| ---------- | ---------- | ||||
| data_loader : DataLoader, optional | data_loader : DataLoader, optional | ||||
| The data loader used for prediction, by default None. | |||||
| The data loader used for prediction. Defaults to None. | |||||
| X : List[Any], optional | X : List[Any], optional | ||||
| The input data, by default None. | |||||
| The input data. Defaults to None. | |||||
| Returns | Returns | ||||
| ------- | ------- | ||||
| @@ -423,11 +423,11 @@ class BasicNN: | |||||
| Parameters | Parameters | ||||
| ---------- | ---------- | ||||
| data_loader : DataLoader, optional | data_loader : DataLoader, optional | ||||
| The data loader used for scoring, by default None. | |||||
| The data loader used for scoring. Defaults to None. | |||||
| X : List[Any], optional | X : List[Any], optional | ||||
| The input data, by default None. | |||||
| The input data. Defaults to None. | |||||
| y : List[int], optional | y : List[int], optional | ||||
| The target data, by default None. | |||||
| The target data. Defaults to None. | |||||
| Returns | Returns | ||||
| ------- | ------- | ||||
| @@ -466,9 +466,9 @@ class BasicNN: | |||||
| X : List[Any] | X : List[Any] | ||||
| Input samples. | Input samples. | ||||
| y : List[int], optional | y : List[int], optional | ||||
| Target labels. If None, dummy labels are created, by default None. | |||||
| Target labels. If None, dummy labels are created. Defaults to None. | |||||
| shuffle : bool, optional | shuffle : bool, optional | ||||
| Whether to shuffle the data, by default True. | |||||
| Whether to shuffle the data. Defaults to True. | |||||
| Returns | Returns | ||||
| ------- | ------- | ||||
| @@ -507,7 +507,7 @@ class BasicNN: | |||||
| epoch_id : int | epoch_id : int | ||||
| The epoch id. | The epoch id. | ||||
| save_path : str, optional | save_path : str, optional | ||||
| The path to save the model, by default None. | |||||
| The path to save the model. Defaults to None. | |||||
| """ | """ | ||||
| if self.save_dir is None and save_path is None: | if self.save_dir is None and save_path is None: | ||||
| raise ValueError("'save_dir' and 'save_path' should not be None simultaneously.") | raise ValueError("'save_dir' and 'save_path' should not be None simultaneously.") | ||||
| @@ -536,7 +536,7 @@ class BasicNN: | |||||
| Parameters | Parameters | ||||
| ---------- | ---------- | ||||
| load_path : str | load_path : str | ||||
| The directory to load the model, by default "". | |||||
| The directory to load the model. Defaults to "". | |||||
| """ | """ | ||||
| if load_path is None: | if load_path is None: | ||||
| @@ -50,30 +50,30 @@ class ModelConverter: | |||||
| The dict contains necessary parameters to construct a learning rate scheduler used | The dict contains necessary parameters to construct a learning rate scheduler used | ||||
| for training, which will be called at the end of each run of the ``fit`` method. | for training, which will be called at the end of each run of the ``fit`` method. | ||||
| The scheduler class is specified by the ``scheduler`` key. It should implement the | The scheduler class is specified by the ``scheduler`` key. It should implement the | ||||
| ``step`` method, by default None. | |||||
| ``step`` method. Defaults to None. | |||||
| device : torch.device, optional | device : torch.device, optional | ||||
| The device on which the model will be trained or used for prediction, | The device on which the model will be trained or used for prediction, | ||||
| by default torch.device("cpu"). | |||||
| Defaults to torch.device("cpu"). | |||||
| batch_size : int, optional | batch_size : int, optional | ||||
| The batch size used for training, by default 32. | |||||
| The batch size used for training. Defaults to 32. | |||||
| num_epochs : int, optional | num_epochs : int, optional | ||||
| The number of epochs used for training, by default 1. | |||||
| The number of epochs used for training. Defaults to 1. | |||||
| stop_loss : float, optional | stop_loss : float, optional | ||||
| The loss value at which to stop training, by default 0.0001. | |||||
| The loss value at which to stop training. Defaults to 0.0001. | |||||
| num_workers : int | num_workers : int | ||||
| The number of workers used for loading data, by default 0. | |||||
| The number of workers used for loading data. Defaults to 0. | |||||
| save_interval : int, optional | save_interval : int, optional | ||||
| The model will be saved every ``save_interval`` epoch during training, by default None. | |||||
| The model will be saved every ``save_interval`` epoch during training. Defaults to None. | |||||
| save_dir : str, optional | save_dir : str, optional | ||||
| The directory in which to save the model during training, by default None. | |||||
| The directory in which to save the model during training. Defaults to None. | |||||
| train_transform : Callable[..., Any], optional | train_transform : Callable[..., Any], optional | ||||
| A function/transform that takes an object and returns a transformed version used | A function/transform that takes an object and returns a transformed version used | ||||
| in the `fit` and `train_epoch` methods, by default None. | |||||
| in the `fit` and `train_epoch` methods. Defaults to None. | |||||
| test_transform : Callable[..., Any], optional | test_transform : Callable[..., Any], optional | ||||
| A function/transform that takes an object and returns a transformed version in the | A function/transform that takes an object and returns a transformed version in the | ||||
| `predict`, `predict_proba` and `score` methods, , by default None. | |||||
| `predict`, `predict_proba` and `score` methods, . Defaults to None. | |||||
| collate_fn : Callable[[List[T]], Any], optional | collate_fn : Callable[[List[T]], Any], optional | ||||
| The function used to collate data, by default None. | |||||
| The function used to collate data. Defaults to None. | |||||
| Returns | Returns | ||||
| ------- | ------- | ||||
| @@ -140,30 +140,30 @@ class ModelConverter: | |||||
| The dict contains necessary parameters to construct a learning rate scheduler used | The dict contains necessary parameters to construct a learning rate scheduler used | ||||
| for training, which will be called at the end of each run of the ``fit`` method. | for training, which will be called at the end of each run of the ``fit`` method. | ||||
| The scheduler class is specified by the ``scheduler`` key. It should implement the | The scheduler class is specified by the ``scheduler`` key. It should implement the | ||||
| ``step`` method, by default None. | |||||
| ``step`` method. Defaults to None. | |||||
| device : torch.device, optional | device : torch.device, optional | ||||
| The device on which the model will be trained or used for prediction, | The device on which the model will be trained or used for prediction, | ||||
| by default torch.device("cpu"). | |||||
| Defaults to torch.device("cpu"). | |||||
| batch_size : int, optional | batch_size : int, optional | ||||
| The batch size used for training, by default 32. | |||||
| The batch size used for training. Defaults to 32. | |||||
| num_epochs : int, optional | num_epochs : int, optional | ||||
| The number of epochs used for training, by default 1. | |||||
| The number of epochs used for training. Defaults to 1. | |||||
| stop_loss : float, optional | stop_loss : float, optional | ||||
| The loss value at which to stop training, by default 0.0001. | |||||
| The loss value at which to stop training. Defaults to 0.0001. | |||||
| num_workers : int | num_workers : int | ||||
| The number of workers used for loading data, by default 0. | |||||
| The number of workers used for loading data. Defaults to 0. | |||||
| save_interval : int, optional | save_interval : int, optional | ||||
| The model will be saved every ``save_interval`` epoch during training, by default None. | |||||
| The model will be saved every ``save_interval`` epoch during training. Defaults to None. | |||||
| save_dir : str, optional | save_dir : str, optional | ||||
| The directory in which to save the model during training, by default None. | |||||
| The directory in which to save the model during training. Defaults to None. | |||||
| train_transform : Callable[..., Any], optional | train_transform : Callable[..., Any], optional | ||||
| A function/transform that takes an object and returns a transformed version used | A function/transform that takes an object and returns a transformed version used | ||||
| in the `fit` and `train_epoch` methods, by default None. | |||||
| in the `fit` and `train_epoch` methods. Defaults to None. | |||||
| test_transform : Callable[..., Any], optional | test_transform : Callable[..., Any], optional | ||||
| A function/transform that takes an object and returns a transformed version in the | A function/transform that takes an object and returns a transformed version in the | ||||
| `predict`, `predict_proba` and `score` methods, , by default None. | |||||
| `predict`, `predict_proba` and `score` methods, . Defaults to None. | |||||
| collate_fn : Callable[[List[T]], Any], optional | collate_fn : Callable[[List[T]], Any], optional | ||||
| The function used to collate data, by default None. | |||||
| The function used to collate data. Defaults to None. | |||||
| Returns | Returns | ||||
| ------- | ------- | ||||
| @@ -26,7 +26,7 @@ class FilterDuplicateWarning(logging.Filter): | |||||
| Parameters | Parameters | ||||
| ---------- | ---------- | ||||
| name : str, optional | name : str, optional | ||||
| The name of the filter, by default "abl". | |||||
| The name of the filter. Defaults to "abl". | |||||
| """ | """ | ||||
| def __init__(self, name: Optional[str] = "abl"): | def __init__(self, name: Optional[str] = "abl"): | ||||
| @@ -193,7 +193,7 @@ def tab_data_to_tuple( | |||||
| y : Union[List[Any], Any] | y : Union[List[Any], Any] | ||||
| The label. | The label. | ||||
| reasoning_result : Any, optional | reasoning_result : Any, optional | ||||
| The reasoning result, by default 0. | |||||
| The reasoning result. Defaults to 0. | |||||
| Returns | Returns | ||||
| ------- | ------- | ||||