model.Model
model.Model()
A model class to support a variety of different models. This should accept an input matrix or dataframe X
and response array y
. This class must also implement the following methods:
Notes
The following methods must be implemented:
fit() This method should fit the model and return the fitted model object. The class should also record the fitted model under the self._fitted
attribute. That way the user can access the fitted model directly or after the fact. predict(X): This method should generate predicted values from the fitted model on a holdout set and return these predictions as a numpy array.
Methods
Name | Description |
---|---|
fit | Fit the underlying model and return the model object. |
predict | Returns the predictions of the fitted model on a hold-out dataset. |
fit
model.Model.fit()
Fit the underlying model and return the model object.
This method should also store the model at the self._fitted
attribute for direct user access.
Returns
Name | Type | Description |
---|---|---|
Any | An arbitrary fitted model. |
predict
model.Model.predict(X)
Returns the predictions of the fitted model on a hold-out dataset.
This function should return predictions as a numpy array.
Parameters
Name | Type | Description | Default |
---|---|---|---|
X | pd.DataFrame | np.array | Any | Any rectangular data structure that can generate predictions using the np.dot(X, beta) procedure. |
required |
Returns
Name | Type | Description |
---|---|---|
np.array | A one-dimension numpy array with predicted hold-out values. |