def _daal4py_predict_enet(self, X): X = make2d(X) _fptype = getFPType(self.coef_) elastic_net_palg = daal4py.elastic_net_prediction(fptype=_fptype, method='defaultDense') elastic_net_res = elastic_net_palg.compute(X, self.daal_model_) res = elastic_net_res.prediction if res.shape[1] == 1 and self.coef_.ndim == 1: res = np.ravel(res) return res
def _daal4py_predict_enet(self, X): X = make2d(X) _fptype = getFPType(self.coef_) elastic_net_palg = daal4py.elastic_net_prediction(fptype=_fptype, method='defaultDense') if self.n_features_in_ != X.shape[1]: raise ValueError((f'X has {X.shape[1]} features, ' f'but ElasticNet is expecting ' f'{self.n_features_in_} features as input')) elastic_net_res = elastic_net_palg.compute(X, self.daal_model_) res = elastic_net_res.prediction if res.shape[1] == 1 and self.coef_.ndim == 1: res = np.ravel(res) return res