From d8b72535a9eb5669ede998602bf66fd194a3723c Mon Sep 17 00:00:00 2001 From: Hector Dominguez Date: Fri, 22 Feb 2019 00:05:08 -0500 Subject: [PATCH 1/2] add primitive for `sklearn.linear_model.ElasticNet` --- .../sklearn.linear_model.ElasticNet.json | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 mlprimitives/jsons/sklearn.linear_model.ElasticNet.json diff --git a/mlprimitives/jsons/sklearn.linear_model.ElasticNet.json b/mlprimitives/jsons/sklearn.linear_model.ElasticNet.json new file mode 100644 index 00000000..c4d65801 --- /dev/null +++ b/mlprimitives/jsons/sklearn.linear_model.ElasticNet.json @@ -0,0 +1,139 @@ +{ + "name": "sklearn.linear_model.ElasticNet", + "contributors": [ + "Hector Dominguez " + ], + "documentation": "https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.ElasticNet.html", + "description": "Linear regression with combined L1 and L2 priors as regularizer", + "classifiers": { + "type": "estimator", + "subtype": "regressor" + }, + "modalities": [], + "primitive": "sklearn.linear_model.ElasticNet", + "fit": { + "method": "fit", + "args": [ + { + "name": "X", + "type": "ndarray" + }, + { + "name": "y", + "type": "array" + } + ] + }, + "produce": { + "method": "predict", + "args": [ + { + "name": "X", + "type": "ndarray" + } + ], + "output": [ + { + "name": "y", + "type": "array" + } + ] + }, + "hyperparameters": { + "fixed": { + "precompute": { + "type": "bool or list", + "default": false, + "description": "Whether to use a precomputed Gram matrix to speed up calculations. The Gram matrix can also be passed as argument. For sparse input this option is always True to preserve sparsity" + }, + "copy_X": { + "type": "bool", + "description": "If True, X will be copied; else, it may be overwritten", + "default": true + }, + "warm_start": { + "type": "bool", + "description": "When set to True, reuse the solution of the previous call to fit as initialization, otherwise, just erase the previous solution", + "default": false + }, + "random_state": { + "type": "multitype", + "description": "The seed of the pseudo random number generator that selects a random feature to update", + "types": { + "int": { + "description": "random_state is the seed used by the random number generator" + }, + "RandomState": { + "description": "random_state is the random number generator" + }, + "None": { + "description": "the random number generator is the RandomState instance used by np.random" + } + }, + "default": null + } + }, + "tunable": { + "alpha": { + "type": "float", + "description": "Constant that multiplies the penalty terms", + "default": 1.0, + "range": [ + 0.01, + 10.0 + ] + }, + "l1_ratio": { + "type": "float", + "description": "The ElasticNet mixing parameter, with 0 <= l1_ratio <= 1. For l1_ratio = 0 the penalty is an L2 penalty. For l1_ratio = 1 it is an L1 penalty. For 0 < l1_ratio < 1, the penalty is a combination of L1 and L2", + "default": 0.5, + "range": [ + 0.0, + 1.0 + ] + }, + "fit_intercept": { + "type": "bool", + "default": true, + "description": "Whether the intercept should be estimated or not. If False, the data is assumed to be already centered" + }, + "normalize": { + "type": "bool", + "default": false, + "description": "This parameter is ignored when fit_intercept is set to False. If True, the regressors X will be normalized before regression by subtracting the mean and dividing by the l2-norm" + }, + "max_iter": { + "type": "int", + "description": "The maximum number of iterations", + "default": 1000, + "range": [ + 1, + 10000 + ] + }, + "tol": { + "type": "float", + "description": "The tolerance for the optimization: if the updates are smaller than tol, the optimization code checks the dual gap for optimality and continues until it is smaller than tol", + "default": 0.0001, + "range": [ + 1e-06, + 0.01 + ] + }, + "positive": { + "type": "bool", + "description": "When set to True, forces the coefficients to be positive", + "default": false + }, + "selection": { + "type": "str", + "description": "If set to random, a random coefficient is updated every iteration rather than looping over features sequentially by default", + "values": [ + "cyclic", + "random" + ], + "default": "cyclic" + } + } + } +} From ea55fd96b8c75edfb35919725e036df78cb12ac1 Mon Sep 17 00:00:00 2001 From: Hector Dominguez Date: Fri, 22 Feb 2019 00:05:15 -0500 Subject: [PATCH 2/2] create pipeline using `sklearn.linear_model.ElasticNet` --- pipelines/sklearn.linear_model.ElasticNet.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 pipelines/sklearn.linear_model.ElasticNet.json diff --git a/pipelines/sklearn.linear_model.ElasticNet.json b/pipelines/sklearn.linear_model.ElasticNet.json new file mode 100644 index 00000000..650c215b --- /dev/null +++ b/pipelines/sklearn.linear_model.ElasticNet.json @@ -0,0 +1,13 @@ +{ + "metadata": { + "name": "sklearn.linear_model.ElasticNet", + "data_type": "single_table", + "task_type": "regression" + }, + "validation": { + "dataset": "boston" + }, + "primitives": [ + "sklearn.linear_model.ElasticNet" + ] +}