<commit_before>"""
A module to compute molecule based representations.

This module contains a variety of methods to extract features from molecules
based on the entire molecule. All of the methods included here will produce
one vector per molecule input.
"""
from builtins import range
from collections import defaultdict
from itertools import product

import numpy
from scipy.spatial.distance import cdist

from .base import BaseFeature, SetMergeMixin, EncodedFeature
from .utils import get_depth_threshold_mask_connections, get_coulomb_matrix
from .utils import get_element_pairs, cosine_decay, needs_reversal
from .utils import get_index_mapping, get_angles
from .utils import get_graph_distance
from .constants import ELECTRONEGATIVITY, BOND_LENGTHS


__all__ = ("Connectivity", "Autocorrelation", "EncodedAngle", "EncodedBond",
           "CoulombMatrix", "BagOfBonds")


class Connectivity(SetMergeMixin, BaseFeature):
    """
    A collection of feature types based on the connectivity of atoms.

    Parameters
    ----------
    input_type : string, default='list'
        Specifies the format the input values will be (must be one of 'list'
        or 'filename').

    n_jobs : int, default=1
        Specifies the number of processes to create when generating the
        features. Positive numbers specify a specifc amount, and numbers less
        than 1 will use the number of cores the computer has.

    depth : int, default=1
        The length of the atom chains to generate for connections

    use_bond_order : boolean, default=False
        Specifies whether or not to use bond order information (C-C versus
        C=C). Note: for depth=1, this option does nothing.

    use_coordination : boolean, default=False
        Specifies whether or not to use the coordination number of the atoms
        (C1 vs C2 vs C3 vs C4).

    add_unknown : boolean, default=False
        Specifies whether or not to include an extra UNKNOWN count in the
        feature vector.

    Attributes
    ----------
    _base_chains : set, tuples
        All the chains that are in the fit molecules.

    References
    ----------
    <NAME>.; <NAME>.; <NAME>, <NAME>.; <NAME>. Constant Size
    Molecular Descriptors For Use With Machine Learning. arXiv:1701.06649
    """
    ATTRIBUTES = ("_base_chains", "_idf_values")
    LABELS = ("_base_chains", )

    def __init__(self, input_type='list', n_jobs=1, depth=1,
                 use_bond_order=False, use_coordination=False,
                 add_unknown=False, do_tfidf=False):
        super(Connectivity, self).__init__(input_type=input_type,
                                           n_jobs=n_jobs)
        self.depth = depth
        self.use_bond_order = use_bond_order
        self.use_coordination = use_coordination
        self.add_unknown = add_unknown
        self.do_tfidf = do_tfidf<commit_msg>Add missing parameter in docstring<commit_after>"""
A module to compute molecule based representations.

This module contains a variety of methods to extract features from molecules
based on the entire molecule. All of the methods included here will produce
one vector per molecule input.
"""
from builtins import range
from collections import defaultdict
from itertools import product

import numpy
from scipy.spatial.distance import cdist

from .base import BaseFeature, SetMergeMixin, EncodedFeature
from .utils import get_depth_threshold_mask_connections, get_coulomb_matrix
from .utils import get_element_pairs, cosine_decay, needs_reversal
from .utils import get_index_mapping, get_angles
from .utils import get_graph_distance
from .constants import ELECTRONEGATIVITY, BOND_LENGTHS


__all__ = ("Connectivity", "Autocorrelation", "EncodedAngle", "EncodedBond",
           "CoulombMatrix", "BagOfBonds")


class Connectivity(SetMergeMixin, BaseFeature):
    """
    A collection of feature types based on the connectivity of atoms.

    Parameters
    ----------
    input_type : string, default='list'
        Specifies the format the input values will be (must be one of 'list'
        or 'filename').

    n_jobs : int, default=1
        Specifies the number of processes to create when generating the
        features. Positive numbers specify a specifc amount, and numbers less
        than 1 will use the number of cores the computer has.

    depth : int, default=1
        The length of the atom chains to generate for connections

    use_bond_order : boolean, default=False
        Specifies whether or not to use bond order information (C-C versus
        C=C). Note: for depth=1, this option does nothing.

    use_coordination : boolean, default=False
        Specifies whether or not to use the coordination number of the atoms
        (C1 vs C2 vs C3 vs C4).

    add_unknown : boolean, default=False
        Specifies whether or not to include an extra UNKNOWN count in the
        feature vector.

    do_tfidf : boolean, default=False
        Apply weighting to counts based on their inverse document (molecule)
        frequency.

    Attributes
    ----------
    _base_chains : set, tuples
        All the chains that are in the fit molecules.

    References
    ----------
    <NAME>.; <NAME>.; <NAME>, <NAME>.; <NAME>. Constant Size
    Molecular Descriptors For Use With Machine Learning. arXiv:1701.06649
    """
    ATTRIBUTES = ("_base_chains", "_idf_values")
    LABELS = ("_base_chains", )

    def __init__(self, input_type='list', n_jobs=1, depth=1,
                 use_bond_order=False, use_coordination=False,
                 add_unknown=False, do_tfidf=False):
        super(Connectivity, self).__init__(input_type=input_type,
                                           n_jobs=n_jobs)
        self.depth = depth
        self.use_bond_order = use_bond_order
        self.use_coordination = use_coordination
        self.add_unknown = add_unknown
        self.do_tfidf = do_tfidf
{'fraction_non_alphanumeric': 0.07140428425705542, 'fraction_numerical': 0.006460387623257395, 'mean_word_length': 2.9966032608695654, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2801175', 'n_tokens_mistral': 1667, 'n_tokens_neox': 1567, 'n_words': 599}