This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sagemaker.processing import ProcessingInput, ProcessingOutput | |
script_processor.framework_entrypoint_command = ['python3'] | |
script_processor.run( | |
job_name=job_name, | |
code=f"{base_url}/processing_job/code/run_notebook-{random_string}.py", | |
source_dir=f"{base_url}/processing_job/code", | |
inputs=[ | |
ProcessingInput( | |
source=s3_notebook_path, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stop the notebook execution | |
raise SystemExit('Notebook end') | |
# Send this notebook to the runner | |
notebook = '<your notebook>.ipynb' | |
src = '<your S3 bucket/folder>' | |
notebook_uri = f'{src}{notebook}' | |
!aws s3 cp {notebook} {notebook_uri} | |
payload = '{"input_path": "NOTEBOOK_URI", "image": "<image name>"}'.replace('NOTEBOOK_URI', notebook_uri) | |
print(payload) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ aws lambda invoke --function-name RunNotebook --payload '{"input_path": "s3://mybucket/mynotebook.ipynb", "image": "notebook-runner", "parameters": {"p": 0.75}}' result.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sagemaker.sklearn.processing import SKLearnProcessor | |
from sagemaker.processing import ProcessingInput, ProcessingOutput | |
sklearn_processor = SKLearnProcessor(framework_version='0.20.0', | |
role=role, | |
instance_type='ml.m5.xlarge', | |
instance_count=1) | |
sklearn_processor.run(code='preprocessing.py', | |
inputs=[ProcessingInput( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let range = context.workbook.getSelectedRange() | |
range.load("values"); | |
await context.sync(); | |
let data = range.values |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function trainModel(data) { | |
classifier = new Classifier({ | |
nGramMin: 1, | |
nGramMax: 3, | |
}); | |
for (let key in data) { | |
classifier.train(data[key], key); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | |
* See LICENSE in the project root for license information. | |
*/ | |
// images references in the manifest | |
import "../../assets/icon-16.png"; | |
import "../../assets/icon-32.png"; | |
import "../../assets/icon-80.png"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. --> | |
<!-- This file shows how to design a first-run page that provides a welcome screen to the user about the features of the add-in. --> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=Edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let range = resolveRange(selectedRange.address, usedRange.address) | |
range = book.worksheets | |
.getActiveWorksheet() | |
.getRange(range); | |
range.load("values"); | |
await context.sync(); | |
processedData = processData(range.values); |
NewerOlder