Skip to the relevant sections if needed.
This file contains hidden or 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
| application: you-app-name-here | |
| version: 1 | |
| runtime: python | |
| api_version: 1 | |
| default_expiration: "30d" | |
| handlers: | |
| - url: /(.*\.(appcache|manifest)) | |
| mime_type: text/cache-manifest |
This file contains hidden or 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
| with apache_beam.Pipeline(options=options) as p: | |
| rows = ( | |
| p | | |
| ReadFromText(input_filename) | | |
| apache_beam.ParDo(Split()) | |
| ) |
This file contains hidden or 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 flask import Flask, render_template, g, jsonify, request, redirect, url_for, session, flash | |
| from gensim import corpora | |
| import os | |
| app = Flask(__name__, | |
| static_folder = "./dist/static", | |
| template_folder = "./dist") | |
| @app.route("/home") | |
| def hello(): |
This file contains hidden or 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
| ref: https://towardsdatascience.com/20-days-to-google-cloud-professional-machine-learning-engineer-exam-beta-b48909499942 | |
| https://cloud.google.com/certification/guides/machine-learning-engineer |
This file contains hidden or 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
| fastROC <- function(probs, class) { | |
| class_sorted <- class[order(probs, decreasing=T)] | |
| TPR <- cumsum(class_sorted) / sum(class) | |
| FPR <- cumsum(class_sorted == 0) / sum(class == 0) | |
| return(list(tpr=TPR, fpr=FPR)) | |
| } | |
| # Helpful function adapted from: https://stat.ethz.ch/pipermail/r-help/2005-September/079872.html | |
| fastAUC <- function(probs, class) { | |
| x <- probs |
This file contains hidden or 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
| # Set JAVA_HOME, set max. memory, and load rJava library | |
| Sys.setenv(JAVA_HOME='/path/to/java_home') | |
| options(java.parameters="-Xmx2g") | |
| library(rJava) | |
| # Output Java version | |
| .jinit() | |
| print(.jcall("java/lang/System", "S", "getProperty", "java.version")) | |
| # Load RJDBC library |
NewerOlder