def _validate_ngram(self, fields, delta_threshold, timestamp_field, timestamp_overlap):
        """
        Validates the fields, delta_threshold and timestamp_field are set and of the correct types.
        :param fields: The ngram fields.
        :param delta_threshold: The delta threshold.
        :param timestamp_field: The timestamp field.
        :param timestamp_overlap: Whether timestamps in sequences are allowed to overlap
        """
        if fields is None or not isinstance(fields, dict):
            raise ValueError('Fields must be set and must be a dictionary.')

        for key in fields:
            if not isinstance(fields[key], list):
                raise ValueError('Each field value must be a list of unischema fields/regular expression(s)')
            for field in fields[key]:
                if not (isinstance(field, UnischemaField) or isinstance(field, string_types)):
                    raise ValueError('All field values must be of type UnischemaField/regular expression')

        if delta_threshold is None or not isinstance(delta_threshold, numbers.Number):
            raise ValueError('delta_threshold must be a number.')

        if timestamp_field is None or not (isinstance(timestamp_field, UnischemaField) or
                                           isinstance(timestamp_field, string_types)):
            raise ValueError('timestamp_field must be set and must be of type UnischemaField or regular expression')

        if timestamp_overlap is None or not isinstance(timestamp_overlap, bool):
            raise ValueError('timestamp_overlap must be set and must be of type bool')

        Validates the fields, delta_threshold and timestamp_field are set and of the correct types.
        :param fields: The ngram fields.
        :param delta_threshold: The delta threshold.
        :param timestamp_field: The timestamp field.
        :param timestamp_overlap: Whether timestamps in sequences are allowed to overlap
        
petastorm/ngram.py