Source code for darkon.influence.feeder
# Copyright 2017 Neosapience, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========================================================================
""" Feeding interface for Influence class
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import abc
import six
[docs]@six.add_metaclass(abc.ABCMeta)
class InfluenceFeeder:
[docs] @abc.abstractmethod
def reset(self):
""" reset dataset
"""
raise RuntimeError('must be implemented')
[docs] @abc.abstractmethod
def train_batch(self, batch_size):
""" training data feeder by batch sampling
Parameters
----------
batch_size : batch size
Returns
-------
xs : feed input values
ys : feed label values
"""
raise RuntimeError('must be implemented')
[docs] @abc.abstractmethod
def train_one(self, index):
""" single training data feeder
Parameters
----------
index : training sample index
Returns
-------
x : feed one input value
y : feed one label value
"""
raise RuntimeError('must be implemented')
[docs] @abc.abstractmethod
def test_indices(self, indices):
""" test data feeder
Parameters
----------
indices : testing sample index
Returns
-------
x : feed input values
y : feed label values
"""
raise RuntimeError('must be implemented')