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
package com.randyphoa; | |
import java.io.File; | |
import java.util.List; | |
import org.apache.log4j.Logger; | |
import com.ibm.openpages.api.resource.IStringField; | |
import com.ibm.openpages.api.resource.IGRCObject; | |
import com.ibm.openpages.api.workflow.actions.AbstractCustomAction; | |
import com.ibm.openpages.api.workflow.actions.IWFCustomProperty; |
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
def func(): | |
import os | |
import ibm_db | |
import subprocess | |
import sqlalchemy | |
import numpy as np | |
import pandas as pd | |
import ibm_watson_studio_lib | |
import ibm_watson_machine_learning | |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width,initial-scale=1" /> | |
<title>RARAS - IBM Cloud Pak for Data</title> | |
{{ headContent() }} | |
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.1/dist/leaflet.css" integrity="sha256-sA+zWATbFveLLNqWO2gtiw3HL/lh1giY/Inf1BJ0z14=" crossorigin="" /> | |
<link rel="stylesheet" href="https://unpkg.com/react-leaflet-markercluster/dist/styles.min.css" /> |
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
library(httr) | |
library(shiny) | |
library(jsonlite) | |
DEPLOYMENT_ID <- "93562b3a-19d5-42db-a52a-f4846dd7d487" | |
VERSION <- "2022-09-27" | |
SPACE_ID = "399a2bce-40b5-457a-8e18-de978043e2c8" | |
API_KEY = "xxx" | |
CPD_URL = "https://cpd-cpd.itzroks-550003aw18-rmaez9-6ccd7f378ae819553d37d5f2ee142bd6-0000.au-syd.containers.appdomain.cloud" | |
USERNAME = "admin" |
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
shiny_details = wml_client.shiny.store(meta_props={wml_client.shiny.ConfigurationMetaNames.NAME: SHINY_APP_NAME}, file_path="app.R.zip") | |
shiny_asset_id = wml_client.shiny.get_id(shiny_details) | |
deployment_details = wml_client.deployments.create( | |
artifact_uid=shiny_asset_id, | |
meta_props={ | |
wml_client.deployments.ConfigurationMetaNames.NAME: SHINY_APP_DEPLOYMENT_NAME, | |
wml_client.deployments.ConfigurationMetaNames.R_SHINY: {"authentication": "anyone_with_url"}, | |
wml_client.deployments.ConfigurationMetaNames.HARDWARE_SPEC: {"name": "M", "num_nodes": 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
ACTIONS_MAPPING = { | |
"GET_ACCIDENT_DATA": get_accident_data, | |
"GET_ACCIDENT_DETAILS": get_accident_details, | |
"GET_CLUSTERS": get_clusters, | |
"GET_CLUSTERS_DETAILS": get_cluster_details, | |
"SAVE_CLUSTERS_RESULTS": save_clusters_results, | |
"GET_PREDICTIONS": get_predictions, | |
"GET_MODELS": get_models, | |
"GET_PREDICT_INPUT_FILES": get_predict_input_files, | |
} |
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
library(httr) | |
library(shiny) | |
library(jsonlite) | |
DEPLOYMENT_ID <- "21d4e28f-2e58-4b9b-9d82-5b6938655991" | |
VERSION <- "2022-09-27" | |
SPACE_ID = "399a2bce-40b5-457a-8e18-de978043e2c8" | |
API_KEY = "xxx" | |
CPD_URL = "https://cpd-cpd.itzroks-550003aw18-rmaez9-6ccd7f378ae819553d37d5f2ee142bd6-0000.au-syd.containers.appdomain.cloud" | |
USERNAME = "admin" |
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
ui <- function(req) { | |
if (identical(req$REQUEST_METHOD, "GET")) { | |
htmlTemplate("index.html") | |
} else if (identical(req$REQUEST_METHOD, "POST")) { | |
body <- rawToChar(req$rook.input$read(-1)) | |
url <- stringr::str_interp("${CPD_URL}/ml/v4/deployments/${DEPLOYMENT_ID}/predictions") | |
query <- list(version=VERSION) | |
r <- POST( |
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
const getAccidentData = (countries) => { | |
const payload = { | |
input_data: [{ | |
values: [{ | |
ACTION: "GET_ACCIDENT_DATA", | |
PARAMS: { COUNTRY: countries.map(x => x.toUpperCase()) } | |
}] | |
}] | |
}; | |
axios.post(URL, payload).then((response) => { |
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
import sklearn | |
import sklearn.tree | |
from sklearn.pipeline import Pipeline | |
from sklearn.preprocessing import OneHotEncoder | |
def get_rules(tree, feature_names, class_names): | |
tree_ = tree.tree_ | |
feature_name = [feature_names[i] if i != sklearn.tree._tree.TREE_UNDEFINED else "undefined!" for i in tree_.feature] | |
paths = [] | |
path = [] |
NewerOlder