function validate( opts, options ) {
	var name;
	if ( !isObject( options ) ) {
		return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
	}
	if ( hasOwnProp( options, 'intercept' ) ) {
		opts.intercept = options.intercept;
		if ( !isBoolean( opts.intercept ) ) {
			return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'intercept', opts.intercept ) );
		}
	}
	if ( hasOwnProp( options, 'lambda' ) ) {
		opts.lambda = options.lambda;
		if ( !isNonNegativeNumber( opts.lambda ) ) {
			return new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'lambda', opts.lambda ) );
		}
	}
	if ( hasOwnProp( options, 'learningRate' ) ) {
		if ( !isArrayLikeObject( options.learningRate ) ) {
			return new TypeError( format( 'invalid option. `%s` option must be an array-like object. Option: `%s`.', 'learningRate', options.learningRate ) );
		}
		name = options.learningRate[ 0 ];
		opts.learningRate[ 0 ] = name;
		if ( !isLearningRate( name ) ) {
			return new TypeError( format( 'invalid option. First `%s` option must be one of the following: "%s". Option: `%s`.', 'learningRate', LEARNING_RATES.join( '", "' ), name ) );
		}
		if ( options.learningRate.length > 1 ) {
			if ( name === 'constant' || name === 'invscaling' ) {
				opts.learningRate[ 1 ] = options.learningRate[ 1 ];
				if ( !isPositiveNumber( opts.learningRate[ 1 ] ) ) {
					return new TypeError( format( 'invalid option. Second `%s` option must be a positive number. Option: `%s`.', 'learningRate', opts.learningRate[ 1 ] ) );
				}
			}
		}
		if ( options.learningRate.length > 2 ) {
			if ( name === 'invscaling' ) {
				opts.learningRate[ 2 ] = options.learningRate[ 2 ];
				if ( !isNumber( opts.learningRate[ 2 ] ) ) {
					return new TypeError( format( 'invalid option. Third `%s` option must be a number. Option: `%s`.', 'learningRate', opts.learningRate[ 2 ] ) );
				}
			}
		}
	}
	if ( hasOwnProp( options, 'loss' ) ) {
		opts.loss = options.loss;
		if ( !isLossFunction( opts.loss ) ) {
			return new TypeError( format( 'invalid option. `%s` option must be one of the following: "%s". Option: `%s`.', 'loss', LOSS_FUNCTIONS.join( '", "' ), opts.loss ) );
		}
	}
	return null;
}
Validates function options.

@private
@param {Object} opts - destination object
@param {Options} options - function options
@param {PositiveNumber} [options.lambda] - regularization parameter
@param {ArrayLikeObject} [options.learningRate] - learning rate function
@param {string} [options.loss] - loss function
@param {boolean} [options.intercept] - specifies whether an intercept should be included
@returns {(Error|null)} null or an error object

@example
var opts = {};
var options = {};
var err = validate( opts, options );
if ( err ) {
    throw err;
}