Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions examples/natural_language_classifier_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@

# create a classifier
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason why these are commented out? are the examples run with some sort of CI?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown

@mkistler mkistler Nov 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the examples serve double-duty as they are used as integration tests. You can see this in the test/test_examples.py module.

# with open('../resources/weather_data_train.csv', 'rb') as training_data:
# print(json.dumps(natural_language_classifier.create(
# training_data=training_data, name='weather'), indent=2))
# metadata = json.dumps({'name': 'my-classifier', 'language': 'en'})
# classifier = natural_language_classifier.create_classifier(
# metadata=metadata,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be training_metadata now, right?

Copy link
Copy Markdown
Contributor Author

@ammardodin ammardodin Nov 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

training_metadata is what we name the parameter when we send it to the service and what it expects, but the parameter is still called metadata for your purposes in invoking the method.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha, cool cool

# training_data=training_data
# )
# print(json.dumps(classifier, indent=2))

status = natural_language_classifier.get_classifier(classifier_id)
print(json.dumps(status, indent=2))
Expand All @@ -30,10 +34,10 @@
'tomorrow?')
print(json.dumps(classes, indent=2))

# delete = natural_language_classifier.remove('2374f9x68-nlc-2697')
# delete = natural_language_classifier.delete_classifier('2374f9x68-nlc-2697')
# print(json.dumps(delete, indent=2))

# example of raising a ValueError
# print(json.dumps(
# natural_language_classifier.create(training_data='', name='weather3'),
# natural_language_classifier.create_classifier(training_data='', name='weather3'),
# indent=2))