MCPcopy
hub / github.com/ddbourgin/numpy-ml / predict

Method predict

numpy_ml/linear_models/ridge.py:86–104  ·  view source on GitHub ↗

Use the trained model to generate predictions on a new collection of data points. Parameters ---------- X : :py:class:`ndarray ` of shape `(Z, M)` A dataset consisting of `Z` new examples, each of dimension `M`. Returns

(self, X)

Source from the content-addressed store, hash-verified

84 return self
85
86 def predict(self, X):
87 """
88 Use the trained model to generate predictions on a new collection of
89 data points.
90
91 Parameters
92 ----------
93 X : :py:class:`ndarray <numpy.ndarray>` of shape `(Z, M)`
94 A dataset consisting of `Z` new examples, each of dimension `M`.
95
96 Returns
97 -------
98 y_pred : :py:class:`ndarray <numpy.ndarray>` of shape `(Z, K)`
99 The model predictions for the items in `X`.
100 """
101 # convert X to a design matrix if we're fitting an intercept
102 if self.fit_intercept:
103 X = np.c_[np.ones(X.shape[0]), X]
104 return np.dot(X, self.beta)

Callers 1

plot_bayesFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected