MCPcopy Create free account
hub / github.com/ScottfreeLLC/AlphaPy / get_partition_data

Function get_partition_data

alphapy/plots.py:102–135  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

100#
101
102def 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#

Callers 6

plot_calibrationFunction · 0.85
plot_learning_curveFunction · 0.85
plot_roc_curveFunction · 0.85
plot_confusion_matrixFunction · 0.85
plot_validation_curveFunction · 0.85
plot_boundaryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected