|
268 | 268 | " train_instance_count=1,\n",
|
269 | 269 | " train_instance_type='ml.c5.xlarge',\n",
|
270 | 270 | " framework_version='0.20.0',\n",
|
| 271 | + " base_job_name='rf-scikit',\n", |
271 | 272 | " metric_definitions=[\n",
|
272 | 273 | " {'Name': 'median-AE',\n",
|
273 | 274 | " 'Regex': \"AE-at-50th-percentile: ([0-9.]+).*$\"}],\n",
|
|
519 | 520 | "metadata": {},
|
520 | 521 | "outputs": [],
|
521 | 522 | "source": [
|
522 |
| - "endpoint_name = 'rf-scikit-endpoint'\n", |
523 |
| - "\n", |
524 |
| - "model.deploy(\n", |
| 523 | + "predictor = model.deploy(\n", |
525 | 524 | " instance_type='ml.c5.large',\n",
|
526 |
| - " initial_instance_count=1,\n", |
527 |
| - " endpoint_name=endpoint_name)" |
| 525 | + " initial_instance_count=1)" |
528 | 526 | ]
|
529 | 527 | },
|
530 | 528 | {
|
|
534 | 532 | "### Invoke with the Python SDK"
|
535 | 533 | ]
|
536 | 534 | },
|
537 |
| - { |
538 |
| - "cell_type": "code", |
539 |
| - "execution_count": null, |
540 |
| - "metadata": {}, |
541 |
| - "outputs": [], |
542 |
| - "source": [ |
543 |
| - "# we use the SklearnPredictor from the python SDK\n", |
544 |
| - "predictor = sagemaker.sklearn.model.SKLearnPredictor(endpoint_name=endpoint_name)" |
545 |
| - ] |
546 |
| - }, |
547 | 535 | {
|
548 | 536 | "cell_type": "code",
|
549 | 537 | "execution_count": null,
|
|
585 | 573 | "source": [
|
586 | 574 | "# csv serialization\n",
|
587 | 575 | "response = runtime.invoke_endpoint(\n",
|
588 |
| - " EndpointName=endpoint_name,\n", |
| 576 | + " EndpointName=predictor.endpoint,\n", |
589 | 577 | " Body=testX[data.feature_names].to_csv(header=False, index=False).encode('utf-8'),\n",
|
590 | 578 | " ContentType='text/csv')\n",
|
591 | 579 | "\n",
|
|
615 | 603 | "np.save(buffer, testX[data.feature_names].values)\n",
|
616 | 604 | "\n",
|
617 | 605 | "response = runtime.invoke_endpoint(\n",
|
618 |
| - " EndpointName=endpoint_name,\n", |
| 606 | + " EndpointName=predictor.endpoint,\n", |
619 | 607 | " Body=buffer.getvalue(),\n",
|
620 | 608 | " ContentType='application/x-npy')\n",
|
621 | 609 | "\n",
|
|
635 | 623 | "metadata": {},
|
636 | 624 | "outputs": [],
|
637 | 625 | "source": [
|
638 |
| - "sm_boto3.delete_endpoint(EndpointName=endpoint_name)" |
| 626 | + "sm_boto3.delete_endpoint(EndpointName=predictor.endpoint)" |
639 | 627 | ]
|
640 |
| - }, |
641 |
| - { |
642 |
| - "cell_type": "code", |
643 |
| - "execution_count": null, |
644 |
| - "metadata": {}, |
645 |
| - "outputs": [], |
646 |
| - "source": [] |
647 | 628 | }
|
648 | 629 | ],
|
649 | 630 | "metadata": {
|
|
0 commit comments