<commit_before>import sys
sys.path.append("${CMAKE_BINARY_DIR}")

import os
import pickle
import tempfile
import unittest

import pyrfr.regression as reg


class TestfANOVAForest(unittest.TestCase):

	def setUp(self):
		data_set_prefix = '${CMAKE_SOURCE_DIR}/test_data_sets/'
		self.data = reg.data_container()
		self.data.import_csv_files(data_set_prefix+'features13.csv', data_set_prefix+'responses13.csv')
		
		self.rng = reg.default_random_engine(1)
		self.forest_constructor = reg.fanova_forest
	
	def tearDown(self):
		self.data = None
		
	def test_options_constructor(self):
		fopts = reg.forest_opts()
		fopts.num_trees = 16
		fopts.num_data_points_per_tree = self.data.num_data_points()		

		the_forest = self.forest_constructor(fopts)
		the_forest.fit(self.data, self.rng)

	def test_options_member(self):

		the_forest = self.forest_constructor()
		fopts = reg.forest_opts()
		the_forest.options.num_trees = 7
		the_forest.options.num_data_points_per_tree = self.data.num_data_points()		
		the_forest.fit(self.data, self.rng)

		self.assertEqual(the_forest.num_trees(), 7)


if __name__ == '__main__':<commit_msg>minor fix to pyrfr unittest<commit_after>import sys
sys.path.append("${CMAKE_BINARY_DIR}")

import os
import pickle
import tempfile
import unittest

import pyrfr.regression as reg


class TestfANOVAForest(unittest.TestCase):

	def setUp(self):
		data_set_prefix = '${CMAKE_SOURCE_DIR}/test_data_sets/'
		self.data = reg.data_container()
		self.data.import_csv_files(data_set_prefix+'features13.csv', data_set_prefix+'responses13.csv')
		
		self.rng = reg.default_random_engine(1)
		self.forest_constructor = reg.fanova_forest
	
	def tearDown(self):
		self.data = None
		
	def test_options_constructor(self):
		fopts = reg.forest_opts()
		fopts.num_trees = 16
		fopts.num_data_points_per_tree = self.data.num_data_points()		

		the_forest = self.forest_constructor(fopts)
		self.assertEqual(the_forest.num_trees(), 0)
		the_forest.fit(self.data, self.rng)

		self.assertEqual(the_forest.num_trees(), 16)
		

	def test_options_member(self):

		the_forest = self.forest_constructor()
		fopts = reg.forest_opts()
		the_forest.options.num_trees = 7
		the_forest.options.num_data_points_per_tree = self.data.num_data_points()		
		the_forest.fit(self.data, self.rng)

		self.assertEqual(the_forest.num_trees(), 7)


if __name__ == '__main__':
{'fraction_non_alphanumeric': 0.11021619330224672, 'fraction_numerical': 0.008902077151335312, 'mean_word_length': 5.361185983827493, 'pattern_counts': {'":': 0, '<': 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': '4027178', 'n_tokens_mistral': 978, 'n_tokens_neox': 851, 'n_words': 131}