Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add formatting to Code Generation #1375

Closed
gsheni opened this issue Oct 30, 2020 · 0 comments · Fixed by #1371
Closed

Add formatting to Code Generation #1375

gsheni opened this issue Oct 30, 2020 · 0 comments · Fixed by #1371
Assignees

Comments

@gsheni
Copy link
Contributor

gsheni commented Oct 30, 2020

  • As a developer, I want to write code that is properly formatted, and indented when using Code Generation. I want the pipeline parameters to be indented, and spaced.

Current

from evalml.pipelines.components import (
        Imputer,
        OneHotEncoder,
        RandomForestClassifier
)
from evalml.pipelines.multiclass_classification_pipeline import MulticlassClassificationPipeline

class CustomPipeline(MulticlassClassificationPipeline):
        component_graph = ['Imputer', MyDropNullColumns, 'One Hot Encoder', 'Random Forest Classifier']
        custom_hyperparameters = {'Imputer': {'numeric_impute_strategy': ['mean', 'median']}}
        name = 'Custom Pipeline'

parameters = {'Imputer': {'categorical_impute_strategy': 'most_frequent', 'numeric_impute_strategy': 'median', 'categorical_fill_value': None, 'numeric_fill_value': None}, 'My Drop Null Columns Transformer': {'pct_null_threshold': 1.0}, 'One Hot Encoder': {'top_n': 10, 'features_to_encode': None, 'categories': None, 'drop': None, 'handle_unknown': 'ignore', 'handle_missing': 'error'}, 'Random Forest Classifier': {'n_estimators': 100, 'max_depth': 6, 'n_jobs': -1}}
pipeline = CustomPipeline(parameters)

Proposed

from evalml.pipelines.components import (
        Imputer,
        OneHotEncoder,
        RandomForestClassifier
)
from evalml.pipelines.multiclass_classification_pipeline import MulticlassClassificationPipeline,


class CustomPipeline(MulticlassClassificationPipeline):
    component_graph = [
        "Imputer",
        MyDropNullColumns,
        "One Hot Encoder",
        "Random Forest Classifier",
    ]
    custom_hyperparameters = {
        "Imputer": {"numeric_impute_strategy": ["mean", "median"]}
    }
    name = "Custom Pipeline"


parameters = {
    "Imputer": {
        "categorical_impute_strategy": "most_frequent",
        "numeric_impute_strategy": "median",
        "categorical_fill_value": None,
        "numeric_fill_value": None,
    },
    "My Drop Null Columns Transformer": {"pct_null_threshold": 1.0},
    "One Hot Encoder": {
        "top_n": 10,
        "features_to_encode": None,
        "categories": None,
        "drop": None,
        "handle_unknown": "ignore",
        "handle_missing": "error",
    },
    "Random Forest Classifier": {"n_estimators": 100, "max_depth": 6, "n_jobs": -1},
}
pipeline = CustomPipeline(parameters)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants