Skip to content

remove file_name argument because it's not used in function #252

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

Merged
merged 1 commit into from
Apr 8, 2020

Conversation

cindyweng
Copy link
Contributor

No description provided.

@cindyweng
Copy link
Contributor Author

Leaving "file_name" argument in also causes the AML pipeline to fail because elsewhere in the CI pipeline, the function is called without a filename argument, and throws an error.

@cindyweng cindyweng changed the title remove file_name parameter because it's not used in function remove file_name argument because it's not used in function Apr 6, 2020
@martin-weber
Copy link
Member

martin-weber commented Apr 6, 2020

I was running into the same issue, see #253 .
Another solution would be to first do the file_name assignment and then call create_sample_data_csv(file_name) in lines 62 and 65 in ml_service/pipelines/diabetes_regression_build_train_pipeline.py as described in #253 .
And move the constant file_name in df.to_csv(...) to a default argument of the function:

import pandas as pd
from sklearn.datasets import load_diabetes


# Loads the diabetes sample data from sklearn and produces a csv file that can
# be used by the build/train pipeline script.
def create_sample_data_csv(file_name='diabetes.csv'):
    sample_data = load_diabetes()
    df = pd.DataFrame(
        data=sample_data.data,
        columns=sample_data.feature_names)
    df['Y'] = sample_data.target
    # Hard code to diabetes so we fail fast if the project has been
    # bootstrapped.
    df.to_csv(file_name, index=False)

@cindyweng
Copy link
Contributor Author

@martin-weber I looked into those changes but chose this solution purely because it was fewer code edits and didn't seem to bork anything :)

@martin-weber
Copy link
Member

@cindyweng Fine for me. Both solutions work.

@eedorenko eedorenko merged commit bb62f3d into microsoft:master Apr 8, 2020
@eedorenko eedorenko mentioned this pull request Apr 8, 2020
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 this pull request may close these issues.

3 participants