<commit_before>import numpy as np
from sklearn.datasets import make_blobs

class genData:
	def __init__(self,n,m,k,min_gamma=1, std=0.7):
		self.n = n
		self.m = m
		self.k = k
		self.std = std
		self.min_gamma = 1
		self.gamma = 0

	def gen(self):
		while self.gamma <= self.min_gamma:
			X,y = make_blobs(n_samples=self.n,n_features=self.m,centers=self.k,cluster_std = self.std)
			X_means = [X[y==t,:].mean(axis=0) for t in xrange(self.k)]
			gammas = []

			for i in xrange(self.k):
				ri = max(np.linalg.norm(X[y==i,:]-np.tile(X_means[i],(sum(y==i),1)),axis=1))
				ra = min(np.linalg.norm(X[y!=i,:]-np.tile(X_means[i],(sum(y!=i),1)),axis=1))
				gammas.append(ra/float(ri))

			y += 1
			self.gamma = min(gammas)

		return X,y

	def calc_eta(self,q,delta=0.99):
		self.delta = delta
		assert (q >0) and (q<=1), "q must be in (0,1]"
		if q < 1:
			return int(np.ceil(np.log(2*self.k*(self.m+1)/delta) / \
		                       np.log(1.0/(1 - q**(self.k-1)*(1-np.exp(-(self.gamma-1)**2 /8.0))))<commit_msg>Added calculating parameters<commit_after>import numpy as np
from sklearn.datasets import make_blobs

class genData:
	def __init__(self,n,m,k,min_gamma=1, std=0.7):
		self.n = n
		self.m = m
		self.k = k
		self.std = std
		self.min_gamma = 1
		self.gamma = 0

	def gen(self):
		while self.gamma <= self.min_gamma:
			X,y = make_blobs(n_samples=self.n,n_features=self.m,centers=self.k,cluster_std = self.std)
			X_means = [X[y==t,:].mean(axis=0) for t in xrange(self.k)]
			gammas = []

			for i in xrange(self.k):
				ri = max(np.linalg.norm(X[y==i,:]-np.tile(X_means[i],(sum(y==i),1)),axis=1))
				ra = min(np.linalg.norm(X[y!=i,:]-np.tile(X_means[i],(sum(y!=i),1)),axis=1))
				gammas.append(ra/float(ri))

			y += 1
			self.gamma = min(gammas)

		return X,y

	def calc_eta(self,q,delta=0.99):
		self.delta = delta
		assert (q >0) and (q<=1), "q must be in (0,1]"
		if q < 1:
			return int(np.ceil(np.log(2.0*self.k*(self.m+1)/delta) / \
		                       np.log(1.0/(1 - q**(self.k-1)*(1-np.exp(-(self.gamma-1)**2 /8.0))))
{'fraction_non_alphanumeric': 0.21055202735710796, 'fraction_numerical': 0.02979970688812897, 'mean_word_length': 3.302521008403361, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, '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': '5764512', 'n_tokens_mistral': 1040, 'n_tokens_neox': 928, 'n_words': 155}