<commit_before>
import scipy.stats
import numpy

def beta_pert( x_min, x_mode, x_max,  lamb= 4 ):
	"""
	Beta-PERT

	To transform a [0,1] random uniform `x` to a beta-PERT random,
	use beta_pert(*arg).ppf(x)

	Parameters
	----------
	x_min, x_mode, x_max : float
		The min, mode, and max for the beta-pert distribution
	lamb : float
		The pert shape modifier

	Returns
	-------
	rv_frozen
	"""

	if ( x_min > x_max or x_mode > x_max or x_mode < x_min ):
		raise ValueError( "invalid parameters" )

	x_range = x_max - x_min
	if ( x_range == 0 ):
		return numpy.full_like(q, fill_value=x_min)

	mu = ( x_min + x_max + lamb * x_mode ) / ( lamb + 2 )

	# special case if mu == mode
	if ( mu == x_mode ):
		v = ( lamb / 2 ) + 1
	else:
		v = (( mu - x_min ) * ( 2 * x_mode - x_min - x_max )) / (( x_mode - mu ) * ( x_max - x_min ))

	w = ( v * ( x_max - mu )) / ( mu - x_min )

	return scipy.stats.beta( v, w, loc=x_min, scale=x_range )


def triangular( x_min, x_mode, x_max ):
	if ( x_min > x_max or x_mode > x_max or x_mode < x_min ):
		raise ValueError( "invalid parameters" )
	scale = x_max - x_min
	peak = (x_mode-x_min)/scale
	return scipy.stats.triang( peak, loc=x_min, scale=scale )<commit_msg>uniform<commit_after>
import scipy.stats
import numpy

def beta_pert( x_min, x_mode, x_max,  lamb= 4 ):
	"""
	Beta-PERT

	To transform a [0,1] random uniform `x` to a beta-PERT random,
	use beta_pert(*arg).ppf(x)

	Parameters
	----------
	x_min, x_mode, x_max : float
		The min, mode, and max for the beta-pert distribution
	lamb : float
		The pert shape modifier

	Returns
	-------
	rv_frozen
	"""

	if ( x_min > x_max or x_mode > x_max or x_mode < x_min ):
		raise ValueError( "invalid parameters" )

	x_range = x_max - x_min
	if ( x_range == 0 ):
		return numpy.full_like(q, fill_value=x_min)

	mu = ( x_min + x_max + lamb * x_mode ) / ( lamb + 2 )

	# special case if mu == mode
	if ( mu == x_mode ):
		v = ( lamb / 2 ) + 1
	else:
		v = (( mu - x_min ) * ( 2 * x_mode - x_min - x_max )) / (( x_mode - mu ) * ( x_max - x_min ))

	w = ( v * ( x_max - mu )) / ( mu - x_min )

	return scipy.stats.beta( v, w, loc=x_min, scale=x_range )


def triangular( x_min, x_mode, x_max ):
	if ( x_min > x_max or x_mode > x_max or x_mode < x_min ):
		raise ValueError( "invalid parameters" )
	scale = x_max - x_min
	peak = (x_mode-x_min)/scale
	return scipy.stats.triang( peak, loc=x_min, scale=scale )


def uniform( x_min, x_max ):
	if ( x_min > x_max ):
		raise ValueError( "invalid parameters" )
	scale = x_max - x_min
	return scipy.stats.uniform( loc=x_min, scale=scale )
{'fraction_non_alphanumeric': 0.143359375, 'fraction_numerical': 0.00625, 'mean_word_length': 2.8744326777609683, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1403057', 'n_tokens_mistral': 1110, 'n_tokens_neox': 1052, 'n_words': 300}