<commit_before>#encoding=utf8

import unittest
import FukuML.PLA as pla
import numpy as np

class PLATestCase(unittest.TestCase):

    def test_train_pla(self):
        pla.load_train_data()
        pla.init_W()
        W = pla.train()

        print ("\n訓練得出權重模型：")
        print W
        print ('-'*70)

        test_data_x = np.array([1, 0.97681, 0.10723, 0.64385, 0.29556])
        test_data_y = 1.0
        prediction = np.sign(np.dot(test_data_x, W))
        self.assertEqual(prediction, test_data_y)

        print ("測試資料 x：")
        print test_data_x
        print ("測試資料 y：")
        print test_data_y
        print ("預測結果：")
        print prediction
        print ('-'*70)

        test_data_x = np.array([1, 0.15654, 0.75584, 0.01122, 0.42598])
        test_data_y = -1.0
        prediction = np.sign(np.dot(test_data_x, W))
        self.assertEqual(prediction, test_data_y)

        print ("測試資料 x：")
        print test_data_x
        print ("測試資料 y：")
        print test_data_y
        print ("預測結果：")
        print prediction
        print ('-'*70)

if __name__ == '__main__':

    unittest.main(verbosity=2)<commit_msg>fix test<commit_after>#encoding=utf8

import unittest
import FukuML.PLA as pla
import numpy as np

class PLATestCase(unittest.TestCase):

    def test_train_pla(self):
        pla.load_train_data()
        pla.init_W()
        W = pla.train()

        print("\n訓練得出權重模型：")
        print(W)
        print('-'*70)

        test_data_x = np.array([1, 0.97681, 0.10723, 0.64385, 0.29556])
        test_data_y = 1.0
        prediction = np.sign(np.dot(test_data_x, W))
        self.assertEqual(prediction, test_data_y)

        print("測試資料 x：")
        print(test_data_x)
        print("測試資料 y：")
        print(test_data_y)
        print("預測結果：")
        print(prediction)
        print('-'*70)

        test_data_x = np.array([1, 0.15654, 0.75584, 0.01122, 0.42598])
        test_data_y = -1.0
        prediction = np.sign(np.dot(test_data_x, W))
        self.assertEqual(prediction, test_data_y)

        print("測試資料 x：")
        print(test_data_x)
        print("測試資料 y：")
        print(test_data_y)
        print("預測結果：")
        print(prediction)
        print('-'*70)

if __name__ == '__main__':

    unittest.main(verbosity=2)
{'fraction_non_alphanumeric': 0.13250883392226148, 'fraction_numerical': 0.054770318021201414, 'mean_word_length': 2.167832167832168, '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': '167628', 'n_tokens_mistral': 955, 'n_tokens_neox': 905, 'n_words': 157}