本文整理汇总了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)