Calculates hypothesis value for a given example :param data_set: test data or train_data :param example_no: example whose hypothesis value is to be calculated :return: hypothesis value for that example
(example_no, data_set)
| 60 | |
| 61 | |
| 62 | def calculate_hypothesis_value(example_no, data_set): |
| 63 | """ |
| 64 | Calculates hypothesis value for a given example |
| 65 | :param data_set: test data or train_data |
| 66 | :param example_no: example whose hypothesis value is to be calculated |
| 67 | :return: hypothesis value for that example |
| 68 | """ |
| 69 | if data_set == "train": |
| 70 | return _hypothesis_value(train_data[example_no][0]) |
| 71 | elif data_set == "test": |
| 72 | return _hypothesis_value(test_data[example_no][0]) |
| 73 | return None |
| 74 | |
| 75 | |
| 76 | def summation_of_cost_derivative(index, end=m): |