diff --git a/abl/learning/abl_model.py b/abl/learning/abl_model.py index b433c64..c5fa3ca 100644 --- a/abl/learning/abl_model.py +++ b/abl/learning/abl_model.py @@ -1,14 +1,3 @@ -# coding: utf-8 -# ================================================================# -# Copyright (C) 2020 Freecss All rights reserved. -# -# File Name :models.py -# Author :freecss -# Email :karlfreecss@gmail.com -# Created Date :2020/04/02 -# Description : -# -# ================================================================# import pickle from typing import Any, Dict diff --git a/abl/learning/basic_nn.py b/abl/learning/basic_nn.py index 9a068b5..02d22e1 100644 --- a/abl/learning/basic_nn.py +++ b/abl/learning/basic_nn.py @@ -1,15 +1,3 @@ -# coding: utf-8 -# ================================================================# -# Copyright (C) 2020 Freecss All rights reserved. -# -# File Name :basic_model.py -# Author :freecss -# Email :karlfreecss@gmail.com -# Created Date :2020/11/21 -# Description : -# -# ================================================================# - import os import logging from typing import Any, Callable, List, Optional, T, Tuple diff --git a/docs/Intro/Learning.rst b/docs/Intro/Learning.rst index 4f5197b..8c4504f 100644 --- a/docs/Intro/Learning.rst +++ b/docs/Intro/Learning.rst @@ -21,7 +21,7 @@ Learning Part self.base_model = base_model -All scikit-learn models satisify this requiremnts, so we can directly use the model to create an instance of ``ABLModel``. For example, we can customize our machine learning model by +All scikit-learn models satisify this requirements, so we can directly use the model to create an instance of ``ABLModel``. For example, we can customize our machine learning model by .. code:: python @@ -36,6 +36,7 @@ For a PyTorch-based neural network, we first need to encapsulate it within a ``B .. code:: python # Load a PyTorch-based neural network + import torchvision cls = torchvision.models.resnet18(pretrained=True) # criterion and optimizer are used for training diff --git a/docs/Intro/Quick-Start.rst b/docs/Intro/Quick-Start.rst index 95c7d99..0eea012 100644 --- a/docs/Intro/Quick-Start.rst +++ b/docs/Intro/Quick-Start.rst @@ -72,7 +72,7 @@ ABL-Package offers several `dataset classes <../API/abl.dataset.html>`_ for diff Read more about `preparing datasets `_. -Building the Machine Learning Part +Building the Learning Part ---------------------------------- To build the machine learning part, we need to wrap our machine learning model into the ``ABLModel`` class. The machine learning model can either be a scikit-learn model or a PyTorch neural network. We use a simple LeNet5 in the MNIST Add example. @@ -141,13 +141,6 @@ function specifying how to perform (deductive) reasoning. return sum(nums) kb = AddKB(pseudo_label_list=list(range(10))) - print(kb) - -Out: - -.. code-block:: none - - AddKB is a KB with pseudo_label_list=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], max_err=1e-10, use_cache=True. Then, we create a reasoner by defining an instance of class ``ReasonerBase`` and passing the knowledge base as an parameter. @@ -178,10 +171,10 @@ In the case of MNIST Add example, the metric definition looks like Read more about `building evaluation metrics `_ -Bridging Machine Learning and Reasoning +Bridging Learning and Reasoning --------------------------------------- -Now, we use ``SimpleBridge`` to combine machine learning and reasoning together. +Now, we use ``SimpleBridge`` to combine learning and reasoning in a unified model. .. code:: python @@ -189,7 +182,7 @@ Now, we use ``SimpleBridge`` to combine machine learning and reasoning together. bridge = SimpleBridge(model, reasoner, metric_list) -Finally, we proceed with testing and training. +Finally, we proceed with training and testing. .. code:: python