<commit_before>#!/usr/bin/env python3

import hdim
import test_data_gen
import numpy as np
import matplotlib.pyplot as plt
import math
import scipy.io as sio

def test_FOS( X, Y ):
	fos_test = hdim.FOS_d( X, Y )

	fos_test.Algorithm()
	return fos_test.ReturnCoefficients()

def test_X_FOS( X, Y ):
	fos_test = hdim.X_FOS_d()

	fos_test( X, Y )
	return fos_test.ReturnCoefficients()

def main():
	N = 200
	P = 500

	#ind = np.arange(P)  # the x locations for the groups

	# X, y, beta = test_data_gen.generate_data( N, P, int( math.ceil(P/10) ), 0.3, 5 )

	old_data = sio.loadmat('Bundled_data.mat')
	X = old_data['X']
	y = np.transpose( old_data['y'] )
	beta = old_data['beta']

	# Mat_dict = {}
	# Mat_dict['X'] = X
	# Mat_dict['y'] = y
	# Mat_dict['beta'] = beta

	# sio.savemat( 'Bundled_data.mat', Mat_dict )

	fos_results = test_FOS( X, y )
	x_fos_results = test_X_FOS( X, y )

	L2_sqr_norm = np.linalg.norm( x_fos_results, ord='fro' )**2

	ind = np.arange( len( fos_results ) )

	width = 0.35       # the width of the bars

	fig, ax = plt.subplots()
	rects1 = ax.bar(ind, fos_results, width, color='#800080')
	rects2 = ax.bar(ind + width, x_fos_results, width, color='y')

	ax.legend((rects1[0], rects2[0]), ('FOS', 'X_FOS'))

	plt.show()

if __name__ == "__main__":
    main()<commit_msg>Updated FOS test script in Python Wrapper<commit_after>#!/usr/bin/env python3

import hdim
import test_data_gen
import numpy as np
import matplotlib.pyplot as plt
import math
import scipy.io as sio

def test_X_FOS( X, Y, solver_type ):
	fos_test = hdim.X_FOS_d()

	fos_test( X, Y, solver_type )
	return fos_test.ReturnCoefficients()

def main():
	N = 20
	P = 50

	ind = np.arange(P)  # the x locations for the groups

	X, y, beta = test_data_gen.generate_data( N, P, int( math.ceil(P/10) ), 0.3, 5 )

	fos_ista_results = test_X_FOS( X, y, 0 )
	fos_fista_results = test_X_FOS( X, y, 1 )
	fos_cd_results = test_X_FOS( X, y, 2 )
	fos_lazy_cd_results = test_X_FOS( X, y, 3 )

	ind = np.arange( len( fos_ista_results ) )

	width = 0.2       # the width of the bars

	fig, ax = plt.subplots()

	rects1 = ax.bar(ind, fos_ista_results, width, color='#800080')
	rects2 = ax.bar(ind + width, fos_fista_results, width, color='b')
	rects3 = ax.bar(ind + 2*width, fos_cd_results, width, color='g')
	rects4 = ax.bar(ind + 3*width, fos_lazy_cd_results, width, color='y')

	ax.legend((rects1[0], rects2[0], rects3[0], rects4[0]), ('ISTA', 'FISTA', 'CD', 'Lazy_CD'))

	plt.show()

if __name__ == "__main__":
    main()
{'fraction_non_alphanumeric': 0.1518429487179487, 'fraction_numerical': 0.026041666666666668, 'mean_word_length': 4.044444444444444, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, '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': '5364444', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1097, 'n_words': 264}