function scaleTo( factor ) {
	/* eslint-disable no-invalid-this */
	var i;
	if ( this.scale < MIN_SCALE ) {
		// Scale vector to one:
		for ( i = 0; i < this.nWeights; i++ ) {
			this._data[ i ] *= this.scale;
		}
		this.scale = 1.0;
	}

	this.norm *= pow( factor, 2 );

	if ( factor > 0.0 ) {
		this.scale *= factor;
	} else {
		throw new RangeError( format( 'unexpected error. Scaling weight vector by nonpositive value, likely due to too large value of eta * lambda. Value: `%f`.', factor ) );
	}
}
Scale elements of the weight vector by the supplied factor.

@private
@param {number} factor - scaling factor
@throws {RangeError} `lambda` times `eta` must be large enough for the scaling weight to be nonnegative