# Path: recordlinkage/base.py
# class BaseCompareFeature(object):
#     """Base abstract class for compare feature engineering.
# 
#     Parameters
#     ----------
#     labels_left : list, str, int
#         The labels to use for comparing record pairs in the left
#         dataframe.
#     labels_right : list, str, int
#         The labels to use for comparing record pairs in the right
#         dataframe (linking) or left dataframe (duplicate detection).
#     args : tuple
#         Additional arguments to pass to the `_compare_vectorized`
#         method.
#     kwargs : tuple
#         Keyword additional arguments to pass to the `_compare_vectorized`
#         method.
#     label : list, str, int
#         The identifying label(s) for the returned values.
#     """
# 
#     name = None
#     description = None
# 
#     def __init__(self, labels_left, labels_right, args=(), kwargs={},
#                  label=None):
# 
#         self.labels_left = labels_left
#         self.labels_right = labels_right
#         self.args = args
#         self.kwargs = kwargs
#         self.label = label
#         self._f_compare_vectorized = None
# 
#     def _repr(self):
#         return "<{} {!r}>".format(self.__class__.__name__, self.label)
# 
#     def __repr__(self):
#         return self._repr()
# 
#     def __str__(self):
#         return repr(self)
# 
#     def _compute_vectorized(self, *args):
#         """Compare attributes (vectorized)
# 
#         Parameters
#         ----------
#         *args : pandas.Series
#             pandas.Series' as arguments.
# 
#         Returns
#         -------
#         pandas.Series, pandas.DataFrame, numpy.ndarray
#             The result of comparing record pairs (the features). Can be
#             a tuple with multiple pandas.Series, pandas.DataFrame,
#             numpy.ndarray objects.
# 
#         """
#         if self._f_compare_vectorized:
#             return self._f_compare_vectorized(
#                 *(args + self.args), **self.kwargs)
#         else:
#             raise NotImplementedError()
# 
#     def _compute(self, left_on, right_on):
#         """Compare the data on the left and right.
# 
#         :meth:`BaseCompareFeature._compute` and
#         :meth:`BaseCompareFeature.compute` differ on the accepted
#         arguments. `_compute` accepts indexed data while `compute`
#         accepts the record pairs and the DataFrame's.
# 
#         Parameters
#         ----------
#         left_on : (tuple of) pandas.Series
#             Data to compare with `right_on`
#         right_on : (tuple of) pandas.Series
#             Data to compare with `left_on`
# 
#         Returns
#         -------
#         pandas.Series, pandas.DataFrame, numpy.ndarray
#             The result of comparing record pairs (the features). Can be
#             a tuple with multiple pandas.Series, pandas.DataFrame,
#             numpy.ndarray objects.
#         """
#         result = self._compute_vectorized(*tuple(left_on + right_on))
# 
#         return result
# 
#     def compute(self, pairs, x, x_link=None):
#         """Compare the records of each record pair.
# 
#         Calling this method starts the comparing of records.
# 
#         Parameters
#         ----------
#         pairs : pandas.MultiIndex
#             A pandas MultiIndex with the record pairs to compare. The indices
#             in the MultiIndex are indices of the DataFrame(s) to link.
#         x : pandas.DataFrame
#             The DataFrame to link. If `x_link` is given, the comparing is a
#             linking problem. If `x_link` is not given, the problem is one of
#             duplicate detection.
#         x_link : pandas.DataFrame, optional
#             The second DataFrame.
# 
#         Returns
#         -------
#         pandas.Series, pandas.DataFrame, numpy.ndarray
#             The result of comparing record pairs (the features). Can be
#             a tuple with multiple pandas.Series, pandas.DataFrame,
#             numpy.ndarray objects.
#         """
#         if not is_pandas_2d_multiindex(pairs):
#             raise ValueError(
#                 "expected pandas.MultiIndex with record pair indices "
#                 "as first argument"
#             )
# 
#         if not isinstance(x, pandas.DataFrame):
#             raise ValueError("expected pandas.DataFrame as second argument")
# 
#         if x_link is not None and not isinstance(x_link, pandas.DataFrame):
#             raise ValueError("expected pandas.DataFrame as third argument")
# 
#         labels_left = listify(self.labels_left, [])
#         labels_right = listify(self.labels_right, [])
# 
#         if x_link is None:
#             df_a = frame_indexing(x[labels_left + labels_right], pairs, 0)
#             data1 = tuple([df_a[lbl] for lbl in listify(self.labels_left)])
#             data2 = tuple([df_a[lbl] for lbl in listify(self.labels_right)])
#         else:
#             df_a = frame_indexing(x[labels_left], pairs, 0)
#             data1 = tuple([df_a[lbl] for lbl in listify(self.labels_left)])
#             df_b = frame_indexing(x_link[labels_right], pairs, 1)
#             data2 = tuple([df_b[lbl] for lbl in listify(self.labels_right)])
# 
#         results = self._compute(data1, data2)
# 
#         return results


import numpy as np
import pandas as pd
from numpy.random import random_sample, choice
from recordlinkage.base import BaseCompareFeature
    def compute(self, pairs, x=None, x_link=None):
        """Return continuous random values for each record pair.

        Parameters
        ----------
        pairs : pandas.MultiIndex
            A pandas MultiIndex with the record pairs to compare. The indices
            in the MultiIndex are indices of the DataFrame(s) to link.
        x : pandas.DataFrame
            The DataFrame to link. If `x_link` is given, the comparing is a
            linking problem. If `x_link` is not given, the problem is one of
            deduplication.
        x_link : pandas.DataFrame, optional
            The second DataFrame.

        Returns
        -------
        pandas.Series, pandas.DataFrame, numpy.ndarray
            The result of comparing record pairs (the features). Can be
            a tuple with multiple pandas.Series, pandas.DataFrame,
            numpy.ndarray objects.
        """

        df_empty = pd.DataFrame(index=pairs)
        return self._compute(
            tuple([df_empty]),
            tuple([df_empty])
        )



# Path: recordlinkage/base.py
# class BaseCompareFeature(object):
#     """Base abstract class for compare feature engineering.
# 
#     Parameters
#     ----------
#     labels_left : list, str, int
#         The labels to use for comparing record pairs in the left
#         dataframe.
#     labels_right : list, str, int
#         The labels to use for comparing record pairs in the right
#         dataframe (linking) or left dataframe (duplicate detection).
#     args : tuple
#         Additional arguments to pass to the `_compare_vectorized`
#         method.
#     kwargs : tuple
#         Keyword additional arguments to pass to the `_compare_vectorized`
#         method.
#     label : list, str, int
#         The identifying label(s) for the returned values.
#     """
# 
#     name = None
#     description = None
# 
#     def __init__(self, labels_left, labels_right, args=(), kwargs={},
#                  label=None):
# 
#         self.labels_left = labels_left
#         self.labels_right = labels_right
#         self.args = args
#         self.kwargs = kwargs
#         self.label = label
#         self._f_compare_vectorized = None
# 
#     def _repr(self):
#         return "<{} {!r}>".format(self.__class__.__name__, self.label)
# 
#     def __repr__(self):
#         return self._repr()
# 
#     def __str__(self):
#         return repr(self)
# 
#     def _compute_vectorized(self, *args):
#         """Compare attributes (vectorized)
# 
#         Parameters
#         ----------
#         *args : pandas.Series
#             pandas.Series' as arguments.
# 
#         Returns
#         -------
#         pandas.Series, pandas.DataFrame, numpy.ndarray
#             The result of comparing record pairs (the features). Can be
#             a tuple with multiple pandas.Series, pandas.DataFrame,
#             numpy.ndarray objects.
# 
#         """
#         if self._f_compare_vectorized:
#             return self._f_compare_vectorized(
#                 *(args + self.args), **self.kwargs)
#         else:
#             raise NotImplementedError()
# 
#     def _compute(self, left_on, right_on):
#         """Compare the data on the left and right.
# 
#         :meth:`BaseCompareFeature._compute` and
#         :meth:`BaseCompareFeature.compute` differ on the accepted
#         arguments. `_compute` accepts indexed data while `compute`
#         accepts the record pairs and the DataFrame's.
# 
#         Parameters
#         ----------
#         left_on : (tuple of) pandas.Series
#             Data to compare with `right_on`
#         right_on : (tuple of) pandas.Series
#             Data to compare with `left_on`
# 
#         Returns
#         -------
#         pandas.Series, pandas.DataFrame, numpy.ndarray
#             The result of comparing record pairs (the features). Can be
#             a tuple with multiple pandas.Series, pandas.DataFrame,
#             numpy.ndarray objects.
#         """
#         result = self._compute_vectorized(*tuple(left_on + right_on))
# 
#         return result
# 
#     def compute(self, pairs, x, x_link=None):
#         """Compare the records of each record pair.
# 
#         Calling this method starts the comparing of records.
# 
#         Parameters
#         ----------
#         pairs : pandas.MultiIndex
#             A pandas MultiIndex with the record pairs to compare. The indices
#             in the MultiIndex are indices of the DataFrame(s) to link.
#         x : pandas.DataFrame
#             The DataFrame to link. If `x_link` is given, the comparing is a
#             linking problem. If `x_link` is not given, the problem is one of
#             duplicate detection.
#         x_link : pandas.DataFrame, optional
#             The second DataFrame.
# 
#         Returns
#         -------
#         pandas.Series, pandas.DataFrame, numpy.ndarray
#             The result of comparing record pairs (the features). Can be
#             a tuple with multiple pandas.Series, pandas.DataFrame,
#             numpy.ndarray objects.
#         """
#         if not is_pandas_2d_multiindex(pairs):
#             raise ValueError(
#                 "expected pandas.MultiIndex with record pair indices "
#                 "as first argument"
#             )
# 
#         if not isinstance(x, pandas.DataFrame):
#             raise ValueError("expected pandas.DataFrame as second argument")
# 
#         if x_link is not None and not isinstance(x_link, pandas.DataFrame):
#             raise ValueError("expected pandas.DataFrame as third argument")
# 
#         labels_left = listify(self.labels_left, [])
#         labels_right = listify(self.labels_right, [])
# 
#         if x_link is None:
#             df_a = frame_indexing(x[labels_left + labels_right], pairs, 0)
#             data1 = tuple([df_a[lbl] for lbl in listify(self.labels_left)])
#             data2 = tuple([df_a[lbl] for lbl in listify(self.labels_right)])
#         else:
#             df_a = frame_indexing(x[labels_left], pairs, 0)
#             data1 = tuple([df_a[lbl] for lbl in listify(self.labels_left)])
#             df_b = frame_indexing(x_link[labels_right], pairs, 1)
#             data2 = tuple([df_b[lbl] for lbl in listify(self.labels_right)])
# 
#         results = self._compute(data1, data2)
# 
#         return results


# Path: recordlinkage/contrib/compare/random/random.py
import numpy as np
import pandas as pd
from numpy.random import random_sample, choice
from recordlinkage.base import BaseCompareFeature

    def compute(self, pairs, x=None, x_link=None):
        """Return continuous random values for each record pair.

        Parameters
        ----------
        pairs : pandas.MultiIndex
            A pandas MultiIndex with the record pairs to compare. The indices
            in the MultiIndex are indices of the DataFrame(s) to link.
        x : pandas.DataFrame
            The DataFrame to link. If `x_link` is given, the comparing is a
            linking problem. If `x_link` is not given, the problem is one of
            deduplication.
        x_link : pandas.DataFrame, optional
            The second DataFrame.

        Returns
        -------
        pandas.Series, pandas.DataFrame, numpy.ndarray
            The result of comparing record pairs (the features). Can be
            a tuple with multiple pandas.Series, pandas.DataFrame,
            numpy.ndarray objects.
        """

        df_empty = pd.DataFrame(index=pairs)
        return self._compute(
            tuple([df_empty]),
            tuple([df_empty])
        )



class RandomDiscrete(BaseCompareFeature):