<commit_before>#include <BALLTestConfig.h>
#include <BALL/CONCEPT/classTest.h>

#include <BALL/QSAR/QSARData.h>
#include <BALL/QSAR/pcrModel.h>

using namespace BALL;
using namespace BALL::QSAR;


START_TEST(PCR-model, "$Id: PCR_test.C$")

PRECISION(1E-7)

QSARData data;
data.readCSVFile(BALL_TEST_DATA_PATH(Regression_test.csv),1,1,1,"	",0,0);

CHECK(PCR-model)
	PCRModel pcr(data);
	pcr.readTrainingData();

	// now just check if SVDSolver works correctly. MLR has already been checked separately
	Matrix<double> eigenvectors;
	Matrix<double> XX = pcr.getDescriptorMatrix()->t() * *pcr.getDescriptorMatrix();
	pcr.calculateEigenvectors(XX,1.0,eigenvectors);
	TEST_REAL_EQUAL(eigenvectors.getColumnCount(),3)
	TEST_REAL_EQUAL(eigenvectors.getRowCount(),3)
	TEST_REAL_EQUAL(eigenvectors(1,1),-0.1998991)
	TEST_REAL_EQUAL(eigenvectors(2,1),-0.5353127)
	TEST_REAL_EQUAL(eigenvectors(3,1),-0.8206587)
	TEST_REAL_EQUAL(eigenvectors(1,2),0.1287921)
	TEST_REAL_EQUAL(eigenvectors(2,2),0.8159410)
	TEST_REAL_EQUAL(eigenvectors(3,2),-0.5636070)
	TEST_REAL_EQUAL(eigenvectors(1,3),0.97131506)<commit_msg>Fixed REAL_EQUAL => EQUAL in PCRModel_test<commit_after>#include <BALLTestConfig.h>
#include <BALL/CONCEPT/classTest.h>

#include <BALL/QSAR/QSARData.h>
#include <BALL/QSAR/pcrModel.h>

using namespace BALL;
using namespace BALL::QSAR;


START_TEST(PCR-model, "$Id: PCR_test.C$")

PRECISION(1E-7)

QSARData data;
data.readCSVFile(BALL_TEST_DATA_PATH(Regression_test.csv),1,1,1,"	",0,0);

CHECK(PCR-model)
	PCRModel pcr(data);
	pcr.readTrainingData();

	// now just check if SVDSolver works correctly. MLR has already been checked separately
	Matrix<double> eigenvectors;
	Matrix<double> XX = pcr.getDescriptorMatrix()->t() * *pcr.getDescriptorMatrix();
	pcr.calculateEigenvectors(XX,1.0,eigenvectors);
	TEST_EQUAL(eigenvectors.getColumnCount(),3)
	TEST_EQUAL(eigenvectors.getRowCount(),3)
	TEST_REAL_EQUAL(eigenvectors(1,1),-0.1998991)
	TEST_REAL_EQUAL(eigenvectors(2,1),-0.5353127)
	TEST_REAL_EQUAL(eigenvectors(3,1),-0.8206587)
	TEST_REAL_EQUAL(eigenvectors(1,2),0.1287921)
	TEST_REAL_EQUAL(eigenvectors(2,2),0.8159410)
	TEST_REAL_EQUAL(eigenvectors(3,2),-0.5636070)
	TEST_REAL_EQUAL(eigenvectors(1,3),0.97131506)
{'fraction_non_alphanumeric': 0.14744459520578923, 'fraction_numerical': 0.0741745816372682, 'mean_word_length': 8.140495867768594, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 18, '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': '3280149', 'n_tokens_mistral': 1039, 'n_tokens_neox': 926, 'n_words': 113}