r"""Get the X, y pair for a given model and partition Parameters ---------- model : alphapy.Model The model object with partition data. partition : alphapy.Partition Reference to the dataset. Returns ------- X : numpy array The feature matrix.
(model, partition)
| 100 | # |
| 101 | |
| 102 | def get_partition_data(model, partition): |
| 103 | r"""Get the X, y pair for a given model and partition |
| 104 | |
| 105 | Parameters |
| 106 | ---------- |
| 107 | model : alphapy.Model |
| 108 | The model object with partition data. |
| 109 | partition : alphapy.Partition |
| 110 | Reference to the dataset. |
| 111 | |
| 112 | Returns |
| 113 | ------- |
| 114 | X : numpy array |
| 115 | The feature matrix. |
| 116 | y : numpy array |
| 117 | The target vector. |
| 118 | |
| 119 | Raises |
| 120 | ------ |
| 121 | TypeError |
| 122 | Partition must be train or test. |
| 123 | |
| 124 | """ |
| 125 | |
| 126 | if partition == Partition.train: |
| 127 | X = model.X_train |
| 128 | y = model.y_train |
| 129 | elif partition == Partition.test: |
| 130 | X = model.X_test |
| 131 | y = model.y_test |
| 132 | else: |
| 133 | raise TypeError('Partition must be train or test') |
| 134 | |
| 135 | return X, y |
| 136 | |
| 137 | |
| 138 | # |
no outgoing calls
no test coverage detected