def validator(input_data):
    """Simple model input validator.

    Validator ensures the input data array is
        - two dimensional
        - has the correct number of features.
    """
    global data
    # check num dims
    if input_data.ndim != 2:
        return False, 'Data should have two dimensions.'
    # check number of columns
    if input_data.shape[1] != data.data.shape[1]:
        reason = '{} features required, {} features provided'.format(
            data.data.shape[1], input_data.shape[1])
        return False, reason
    # validation passed
    return True, None
def validator ( input_data ) : global data if input_data . ndim != 2 : return False , 'Data should have two dimensions.' if input_data . shape [ 1 ] != data . data . shape [ 1 ] : reason = '{} features required, {} features provided' . format ( data . data . shape [ 1 ] , input_data . shape [ 1 ] ) return False , reason return True , None
Simple model input validator.

    Validator ensures the input data array is
        - two dimensional
        - has the correct number of features.