本文整理匯總了Python中sklearn.linear_model.OrthogonalMatchingPursuit方法的典型用法代碼示例。如果您正苦於以下問題:Python linear_model.OrthogonalMatchingPursuit方法的具體用法?Python linear_model.OrthogonalMatchingPursuit怎麽用?Python linear_model.OrthogonalMatchingPursuit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sklearn.linear_model
的用法示例。
在下文中一共展示了linear_model.OrthogonalMatchingPursuit方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_model_orthogonal_matching_pursuit
# 需要導入模塊: from sklearn import linear_model [as 別名]
# 或者: from sklearn.linear_model import OrthogonalMatchingPursuit [as 別名]
def test_model_orthogonal_matching_pursuit(self):
model, X = fit_regression_model(
linear_model.OrthogonalMatchingPursuit())
model_onnx = convert_sklearn(
model, "orthogonal matching pursuit",
[("input", FloatTensorType([None, X.shape[1]]))])
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
verbose=False,
basename="SklearnOrthogonalMatchingPursuit-Dec4",
allow_failure="StrictVersion("
"onnxruntime.__version__)"
"<= StrictVersion('0.2.1')",
)
示例2: omp_estimator
# 需要導入模塊: from sklearn import linear_model [as 別名]
# 或者: from sklearn.linear_model import OrthogonalMatchingPursuit [as 別名]
def omp_estimator(hparams):
"""OMP estimator"""
omp_est = OrthogonalMatchingPursuit(n_nonzero_coefs=hparams.omp_k)
def estimator(A_val, y_batch_val, hparams):
x_hat_batch = []
for i in range(hparams.batch_size):
y_val = y_batch_val[i]
omp_est.fit(A_val.T, y_val.reshape(hparams.num_measurements))
x_hat = omp_est.coef_
x_hat = np.reshape(x_hat, [-1])
x_hat = np.maximum(np.minimum(x_hat, 1), 0)
x_hat_batch.append(x_hat)
x_hat_batch = np.asarray(x_hat_batch)
return x_hat_batch
return estimator
示例3: __init__
# 需要導入模塊: from sklearn import linear_model [as 別名]
# 或者: from sklearn.linear_model import OrthogonalMatchingPursuit [as 別名]
def __init__(self, options):
self.handle_options(options)
params = options.get('params', {})
out_params = convert_params(
params,
floats=['tol'],
strs=['kernel'],
ints=['n_nonzero_coefs'],
bools=['fit_intercept', 'normalize'],
)
self.estimator = _OrthogonalMatchingPursuit(**out_params)
示例4: test_objectmapper
# 需要導入模塊: from sklearn import linear_model [as 別名]
# 或者: from sklearn.linear_model import OrthogonalMatchingPursuit [as 別名]
def test_objectmapper(self):
df = pdml.ModelFrame([])
self.assertIs(df.linear_model.ARDRegression, lm.ARDRegression)
self.assertIs(df.linear_model.BayesianRidge, lm.BayesianRidge)
self.assertIs(df.linear_model.ElasticNet, lm.ElasticNet)
self.assertIs(df.linear_model.ElasticNetCV, lm.ElasticNetCV)
self.assertIs(df.linear_model.HuberRegressor, lm.HuberRegressor)
self.assertIs(df.linear_model.Lars, lm.Lars)
self.assertIs(df.linear_model.LarsCV, lm.LarsCV)
self.assertIs(df.linear_model.Lasso, lm.Lasso)
self.assertIs(df.linear_model.LassoCV, lm.LassoCV)
self.assertIs(df.linear_model.LassoLars, lm.LassoLars)
self.assertIs(df.linear_model.LassoLarsCV, lm.LassoLarsCV)
self.assertIs(df.linear_model.LassoLarsIC, lm.LassoLarsIC)
self.assertIs(df.linear_model.LinearRegression, lm.LinearRegression)
self.assertIs(df.linear_model.LogisticRegression, lm.LogisticRegression)
self.assertIs(df.linear_model.LogisticRegressionCV, lm.LogisticRegressionCV)
self.assertIs(df.linear_model.MultiTaskLasso, lm.MultiTaskLasso)
self.assertIs(df.linear_model.MultiTaskElasticNet, lm.MultiTaskElasticNet)
self.assertIs(df.linear_model.MultiTaskLassoCV, lm.MultiTaskLassoCV)
self.assertIs(df.linear_model.MultiTaskElasticNetCV, lm.MultiTaskElasticNetCV)
self.assertIs(df.linear_model.OrthogonalMatchingPursuit, lm.OrthogonalMatchingPursuit)
self.assertIs(df.linear_model.OrthogonalMatchingPursuitCV, lm.OrthogonalMatchingPursuitCV)
self.assertIs(df.linear_model.PassiveAggressiveClassifier, lm.PassiveAggressiveClassifier)
self.assertIs(df.linear_model.PassiveAggressiveRegressor, lm.PassiveAggressiveRegressor)
self.assertIs(df.linear_model.Perceptron, lm.Perceptron)
self.assertIs(df.linear_model.RandomizedLasso, lm.RandomizedLasso)
self.assertIs(df.linear_model.RandomizedLogisticRegression, lm.RandomizedLogisticRegression)
self.assertIs(df.linear_model.RANSACRegressor, lm.RANSACRegressor)
self.assertIs(df.linear_model.Ridge, lm.Ridge)
self.assertIs(df.linear_model.RidgeClassifier, lm.RidgeClassifier)
self.assertIs(df.linear_model.RidgeClassifierCV, lm.RidgeClassifierCV)
self.assertIs(df.linear_model.RidgeCV, lm.RidgeCV)
self.assertIs(df.linear_model.SGDClassifier, lm.SGDClassifier)
self.assertIs(df.linear_model.SGDRegressor, lm.SGDRegressor)
self.assertIs(df.linear_model.TheilSenRegressor, lm.TheilSenRegressor)