Setup the Environment

Load the shared core, methods, and environment before starting processing


In [1]:
from __future__ import print_function
import sys, os, requests, json, datetime

# Load the environment and login the user
from src.common.load_redten_ipython_env import user_token, user_login, csv_file, run_job, core, api_urls, ppj, rt_url, rt_user, rt_pass, rt_email, lg, good, boom, anmt, mark, ppj, uni_key, rest_login_as_user, rest_full_login, wait_for_job_to_finish, wait_on_job, get_job_analysis, get_job_results, get_analysis_manifest, get_job_cache_manifest, build_prediction_results, build_forecast_results, get_job_cache_manifest, search_ml_jobs, show_logs, show_errors, ipyImage, ipyHTML, ipyDisplay, pd, np

anmt("Environment ready")


Environment ready

Analyze the IRIS dataset with an XGB Regressor


In [2]:
job_id = None # on success, this will store the actively running job's id

resource_url = rt_url + "/ml/run/"
query_params = {}
uni = uni_key()

lg("Building Post Data", 6)

title = "Hello World - " + str(datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S"))
desc = "This is a Description for - " + str(title)

# initial stubs
feature_column_names = []
target_column_values = []
ignore_features = []
csv_file = "/opt/work/data/src/iris.csv"
rloc = ""
sloc = ""
units_ahead = 0

ds_name = "iris_regressor"
algo_name = "xgb-regressor"

# What column has the labeled targets as integers? (added-manually to the dataset)
target_column_name = "ResultLabel"                 
# possible values in the Target Column
target_column_values = [ "Iris-setosa", "Iris-versicolor", "Iris-virginica" ] 

# What columns can the algorithms use for training and learning?
feature_column_names = [ "SepalLength", "SepalWidth", "PetalLength", "PetalWidth", "ResultTargetValue" ] 

# What column holds string labels for the Target Column?
label_column_name = "ResultLabel"
ignore_features = [ # Prune non-int/float columns as needed: 
                    target_column_name
                ]
if target_column_name != label_column_name:
    ignore_features.append(label_column_name)

predict_row = {
                "SepalLength"       : 5.4,
                "SepalWidth"        : 3.4,
                "PetalLength"       : 1.7,
                "PetalWidth"        : 0.2,
                "ResultTargetValue" : 0
            }

post_data = {
            "title" : title,
            "desc" : desc,
            "predict_this_data" : predict_row,
            "ds_name" : ds_name,
            "feature_column_names" : feature_column_names,
            "ignore_features" : ignore_features,
            "csv_file" : csv_file,
            "rloc" : rloc,
            "sloc" : sloc,
            "algo_name" : algo_name,
            "target_column_values" : target_column_values,
            "target_column_name" : target_column_name,
            "label_column_name" : label_column_name,
            "prediction_type" : "Predict",
            "ml_type" : "Predict with Filter",
            "train" : {
                    "base_score" : 0.5,
                    "col_sample_by_level" : 1.0,
                    "col_sample_by_tree" : 0.8,
                    "gamma" : 0,
                    "learning_rate" : 0.1,
                    "max_delta_step" : 0,
                    "max_depth" : 6,
                    "min_child_weight" : 1,
                    "num_estimators" : 1000,
                    "objective" : "reg:linear",
                    "reg_alpha" : 0.0,
                    "reg_lambda" : 1.0,
                    "scaled_position_weight" : 1.0,
                    "seed" : 27,
                    "sub_sample" : 0.8,
                    "debug" : True
            },
            "user_id" : 2
        }
post_headers = {
                "Content-type" : "application/json",
                "Authorization" : "JWT " + str(user_token)
            }

lg("Running ML Job url=" + str(resource_url), 6)
post_response = requests.post(resource_url, params=query_params, data=json.dumps(post_data), headers=post_headers)

if post_response.status_code != 201 and post_response.status_code != 200:
    lg("Failed with Post Response Status=" + str(post_response.status_code) + " Reason=" + str(post_response.reason), 0)
    lg("Details:\n" + str(post_response.text) + "\n", 0)
else:
    lg("SUCCESS - Post Response Status=" + str(post_response.status_code) + " Reason=" + str(post_response.reason), 5)
    record = post_response.json()
    lg(ppj(record))
    job_id = int(record["id"])
# end of post for running an ML Job


Building Post Data
Running ML Job url=https://redten.io/ml/run/
SUCCESS - Post Response Status=201 Reason=Created
{
    "algo_name": "xgb-regressor",
    "control_state": "active",
    "created": "2017-05-26 17-49-23",
    "csv_file": "/opt/work/data/src/iris.csv",
    "desc": "This is a Description for - Hello World - 2017-05-26-17-49-22",
    "ds_name": "iris_regressor",
    "feature_column_names": [
        "SepalLength",
        "SepalWidth",
        "PetalLength",
        "PetalWidth",
        "ResultTargetValue"
    ],
    "id": 560,
    "ignore_features": [
        "ResultLabel"
    ],
    "manifest_secret_key": null,
    "manifest_sloc": null,
    "max_features": 10,
    "ml_type": "Predict with Filter",
    "prediction_type": "predict",
    "rloc": "",
    "sloc": "",
    "status": "requested",
    "target_column_name": "ResultLabel",
    "target_column_values": [
        "Iris-setosa",
        "Iris-versicolor",
        "Iris-virginica"
    ],
    "title": "Hello World - 2017-05-26-17-49-22",
    "units_ahead_set": [],
    "units_ahead_type": "",
    "updated": "2017-05-26 17-49-23",
    "version": 1
}

Wait for the job to finish


In [3]:
job_data = {}
job_report = {}

job_res = {}
if job_id == None:
    boom("Failed to start a new job")
else:
    job_res = wait_on_job(job_id)

    if job_res["status"] != "SUCCESS":
        boom("Job=" + str(job_id) + " failed with status=" + str(job_res["status"]) + " err=" + str(job_res["error"]))
    else:
        job_data = job_res["record"]
        anmt("Job Report:")
        lg(ppj(job_data), 5)
# end of waiting


Waiting on job=560 url=https://redten.io/ml/560/
Job=560 is training - Step 3/10
Job=560 is plotting - Step 7/10
Job=560 is uploading - Step 9/10
Job=560 completed
Job Report:
{
    "job": {
        "algo_name": "xgb-regressor",
        "control_state": "active",
        "created": "2017-05-26 17-49-23",
        "csv_file": "/opt/work/data/src/iris.csv",
        "desc": "This is a Description for - Hello World - 2017-05-26-17-49-22",
        "ds_name": "iris_regressor",
        "feature_column_names": [
            "SepalLength",
            "SepalWidth",
            "PetalLength",
            "PetalWidth",
            "ResultTargetValue"
        ],
        "id": 560,
        "ignore_features": [
            "ResultLabel"
        ],
        "images": [
            {
                "author_name": null,
                "desc": null,
                "id": 12158,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12158_68fe500cd7564213.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Joint Plot - ResultTargetValue vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_4",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12157,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12157_0180f59977c44413.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Joint Plot - PetalWidth vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_3",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12156,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12156_4a32649040c14ab6.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Joint Plot - PetalLength vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_2",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12155,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12155_e1d895dcd1714932.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Joint Plot - SepalWidth vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_1",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12154,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12154_9b0be64a57fd484b.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Joint Plot - SepalLength vs SepalWidth - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_0",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12153,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12153_80e4812b82a64e4b.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Scatter - ResultTargetValue vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_4",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12152,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12152_0c8343a342bb40fd.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Scatter - PetalWidth vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_3",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12151,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12151_17ef598b56e14f68.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Scatter - PetalLength vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_2",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12150,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12150_8166153a2f87499d.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Scatter - SepalWidth vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_1",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12149,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12149_bd798d8ff84f46f6.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Scatter - SepalLength vs SepalWidth - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_0",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12148,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12148_07ed6b645dac47a2.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Pair Plot - ResultLabel - /opt/work/data/src/pairplot_IRIS_REGRESSOR-2-560",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12147,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12147_5247822cd02242fb.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "ResultTargetValue Importance Analysis",
                "version": 1
            }
        ],
        "manifest_secret_key": "live_2_2e975a62dd094d5bbdea7bbac0ad33b1bdb540f746f429d995d76acfee6af1",
        "manifest_sloc": "redten-models-west:IRIS_REGRESSOR-2-560_manifest.json",
        "max_features": 10,
        "ml_type": "Predict with Filter",
        "prediction_type": "predict",
        "rloc": "",
        "sloc": "",
        "status": "completed",
        "target_column_name": "ResultLabel",
        "target_column_values": [
            "Iris-setosa",
            "Iris-versicolor",
            "Iris-virginica"
        ],
        "title": "Hello World - 2017-05-26-17-49-22",
        "units_ahead_set": [],
        "units_ahead_type": "",
        "updated": "2017-05-26 17-49-42",
        "version": 1
    }
}

Get Predictive Accuracies


In [4]:
job_report = {}
if job_id == None:
    boom("Failed to start a new job")
else:
    # Get the analysis, but do not auto-show the plots
    job_report = get_job_analysis(job_id, show_plots=False)
    if len(job_report) == 0:
        boom("Job=" + str(job_id) + " failed")
    else:
        lg("")
    # if the job failed
# end of get job analysis

# Build the predictive accuracy dictionary from the analysis
# and show the prediction dataframes
acc_results = build_prediction_results(job_report)

# for all columns in the accuracy dictionary:
for col in acc_results:
    col_node = acc_results[col]
    
    # Sensitivity vs Specificity
    # https://en.wikipedia.org/wiki/Sensitivity_and_specificity
    # 
    # successful predictions above 90%...how's that error rate though?
    if col_node["accuracy"] > 0.90: 
        good("Column=" + str(col) + " accuracy=" + str(col_node["accuracy"]) + " mse=" + str(col_node["mse"]) + " num_predictions=" + str(len(col_node["predictions_df"].index)))
    # successful predictions between 90% and 80%...how's that error rate though?
    elif 0.90 > col_node["accuracy"] > 0.80:
        lg("Column=" + str(col) + " accuracy=" + str(col_node["accuracy"]) + " mse=" + str(col_node["mse"]) + " num_predictions=" + str(len(col_node["predictions_df"].index)))
    else:
        boom("Column=" + str(col) + " is not very accurate: accuracy=" + str(col_node["accuracy"]) + " mse=" + str(col_node["mse"]) + " num_predictions=" + str(len(col_node["predictions_df"].index)))
    # end of header line

    # show the predictions
    ipyDisplay(col_node["predictions_df"])
    
    lg("")
# end of showing prediction results


Getting analysis for job=560 url=https://redten.io/ml/analysis/560/
SUCCESS - GET Analysis Response Status=200 Reason=OK
Found Job=560 analysis

Column=SepalLength is not very accurate: accuracy=0.783988472083 mse=0.145626284054 num_predictions=66
0
0 6.200572
1 5.619819
2 7.236766
3 5.094768
4 6.138592
5 5.744506
6 7.033538
7 6.200797
8 5.400625
9 5.872986
10 6.407093
11 4.899189
12 4.900123
13 5.298025
14 5.138183
15 5.106776
16 6.886637
17 6.744435
18 6.698655
19 6.407560
20 4.736238
21 7.020784
22 5.311563
23 6.573887
24 6.508574
25 6.374033
26 6.177010
27 6.839397
28 5.732828
29 4.802983
... ...
36 6.724392
37 4.896573
38 5.637219
39 5.643638
40 6.244489
41 6.639732
42 5.591598
43 4.998384
44 5.143886
45 5.297545
46 6.067437
47 6.670979
48 6.193013
49 7.130998
50 5.879887
51 7.722800
52 5.561193
53 4.369848
54 5.800178
55 5.614164
56 4.926728
57 4.480546
58 4.317115
59 5.821849
60 6.048419
61 4.703830
62 4.903234
63 4.994620
64 5.349566
65 5.250289

66 rows × 1 columns

Column=PetalWidth accuracy=0.928719140212 mse=0.0427658976593 num_predictions=66
0
0 1.331062
1 0.345133
2 1.719044
3 1.145035
4 1.600555
5 0.220241
6 1.483402
7 2.085606
8 1.308045
9 1.417230
10 2.197729
11 0.201280
12 0.100199
13 0.237928
14 0.222329
15 1.018767
16 2.146031
17 1.539388
18 1.527329
19 1.888611
20 0.124799
21 2.500944
22 0.155918
23 1.888611
24 1.949726
25 2.068715
26 1.891891
27 1.945576
28 0.362699
29 0.186127
... ...
36 1.558793
37 0.181759
38 0.268458
39 0.373551
40 2.083598
41 1.435777
42 1.241935
43 0.216305
44 0.186051
45 1.269337
46 2.126385
47 2.298707
48 1.494271
49 1.943346
50 1.276093
51 2.233422
52 1.250620
53 0.122953
54 1.900949
55 1.077144
56 0.197384
57 0.408073
58 0.122953
59 1.248546
60 1.711822
61 0.178438
62 0.220872
63 0.237846
64 1.258338
65 0.207573

66 rows × 1 columns

Column=PetalLength accuracy=0.982132813713 mse=0.0572320923595 num_predictions=66
0
0 4.513339
1 1.782143
2 6.363951
3 3.937796
4 4.900630
5 1.486664
6 4.613516
7 5.629632
8 3.513844
9 4.433239
10 5.102907
11 1.307768
12 1.499826
13 1.368648
14 1.407212
15 3.242986
16 5.311521
17 4.575236
18 4.797418
19 5.507880
20 1.517955
21 5.535549
22 1.423991
23 5.301728
24 5.862045
25 5.567652
26 5.150166
27 5.840205
28 1.677446
29 1.582241
... ...
36 4.724446
37 1.506858
38 1.700494
39 1.333011
40 5.045736
41 4.703067
42 4.508770
43 1.453211
44 1.502607
45 4.206714
46 5.376419
47 5.675442
48 4.786600
49 6.149049
50 3.998515
51 6.405871
52 3.793942
53 1.421860
54 5.100172
55 4.669762
56 1.300184
57 1.571228
58 1.536713
59 4.593300
60 5.356967
61 1.338591
62 1.651200
63 1.502607
64 3.821841
65 1.516675

66 rows × 1 columns

Column=SepalWidth is not very accurate: accuracy=0.368379570605 mse=0.114673327959 num_predictions=66
0
0 3.021737
1 3.531068
2 3.532478
3 2.388528
4 2.615827
5 3.540309
6 2.931330
7 3.020647
8 2.673050
9 2.764662
10 2.926087
11 2.984484
12 3.099823
13 3.647080
14 3.579297
15 2.242815
16 3.042657
17 2.986485
18 2.913861
19 3.197633
20 3.155970
21 2.850365
22 3.620166
23 3.041274
24 3.035612
25 2.981340
26 2.897098
27 3.345549
28 3.375871
29 3.961208
... ...
36 2.673100
37 3.669731
38 3.890962
39 3.584914
40 2.740776
41 2.728949
42 2.927752
43 3.629493
44 3.155970
45 2.677202
46 2.573313
47 2.993517
48 2.802930
49 3.218131
50 2.912671
51 3.237063
52 2.472500
53 3.287420
54 2.699653
55 3.042508
56 3.050663
57 3.418985
58 3.437337
59 2.980584
60 2.724026
61 3.379375
62 3.575385
63 3.220135
64 3.091811
65 3.443473

66 rows × 1 columns

Column=ResultTargetValue accuracy=0.920473871675 mse=0.0542588735957 num_predictions=66
0
0 1.020111
1 0.000028
2 2.032431
3 0.996819
4 2.006838
5 0.000028
6 1.000703
7 1.999662
8 0.998231
9 1.712724
10 1.999990
11 0.000061
12 0.000020
13 0.000028
14 0.000028
15 1.000468
16 2.001127
17 1.971385
18 0.848727
19 2.000851
20 0.000020
21 2.000139
22 0.000028
23 2.000851
24 1.643128
25 1.999664
26 2.003803
27 2.000009
28 0.000028
29 0.000028
... ...
36 1.308210
37 0.000028
38 0.000028
39 0.000028
40 1.910848
41 1.002680
42 0.837692
43 0.000028
44 0.000028
45 0.999657
46 1.504312
47 2.000062
48 1.369408
49 1.999627
50 1.000577
51 2.000009
52 0.990860
53 0.000061
54 2.000018
55 1.125566
56 0.000032
57 0.003069
58 0.000061
59 0.992903
60 1.840597
61 0.000061
62 0.000028
63 0.000028
64 0.999685
65 0.000028

66 rows × 1 columns


Get the Analysis Images


In [5]:
# Show the images built during the analysis
if "images" in job_report:
    for img in job_report["images"]:
        anmt(img["title"])
        lg("URL: " + str(img["image"]))
        ipyDisplay(ipyImage(url=img["image"]))
        lg("---------------------------------------------------------------------------------------")
else:
    boom("Job=" + str(job_id) + " does not have any images yet. Please wait a few seconds and retry.")
# end of if images exist


Joint Plot - ResultTargetValue vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_4
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12158_68fe500cd7564213.png
---------------------------------------------------------------------------------------
Joint Plot - PetalWidth vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_3
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12157_0180f59977c44413.png
---------------------------------------------------------------------------------------
Joint Plot - PetalLength vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_2
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12156_4a32649040c14ab6.png
---------------------------------------------------------------------------------------
Joint Plot - SepalWidth vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_1
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12155_e1d895dcd1714932.png
---------------------------------------------------------------------------------------
Joint Plot - SepalLength vs SepalWidth - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_0
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12154_9b0be64a57fd484b.png
---------------------------------------------------------------------------------------
Scatter - ResultTargetValue vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_4
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12153_80e4812b82a64e4b.png
---------------------------------------------------------------------------------------
Scatter - PetalWidth vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_3
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12152_0c8343a342bb40fd.png
---------------------------------------------------------------------------------------
Scatter - PetalLength vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_2
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12151_17ef598b56e14f68.png
---------------------------------------------------------------------------------------
Scatter - SepalWidth vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_1
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12150_8166153a2f87499d.png
---------------------------------------------------------------------------------------
Scatter - SepalLength vs SepalWidth - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_0
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12149_bd798d8ff84f46f6.png
---------------------------------------------------------------------------------------
Pair Plot - ResultLabel - /opt/work/data/src/pairplot_IRIS_REGRESSOR-2-560
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12148_07ed6b645dac47a2.png
---------------------------------------------------------------------------------------
ResultTargetValue Importance Analysis
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12147_5247822cd02242fb.png
---------------------------------------------------------------------------------------

Get the Job Manifest

Jobs use a manifest to prevent concurrent job and model collisions

A manifest contains:

  1. A dictionary of model nodes
  2. Redis model locations
  3. S3 archival locations
  4. Tracking data for import and export across environments

In [6]:
job_manifest = get_job_cache_manifest(job_report)
lg(ppj(job_manifest))


{
    "11851": {
        "rloc": "MODELS:_MD_IRIS_REGRESSOR-2-560_26fbf8_0",
        "sloc": "redten-models-west:rt_models_userid_2_job_560_train_453_jobresults_416_modelid_11851_modelkey_MD_IRIS_REGRESSOR-2-560_26fbf8_0.cache.pickle.zlib",
        "target": "SepalLength",
        "tracking_id": "ML_IRIS_REGRESSOR-2-560_0253cc1aba9b4c71b1f69d5d2ae1952",
        "tracking_name": "IRIS_REGRESSOR-2-560",
        "tracking_type": "UseTargetColAndUnits"
    },
    "11852": {
        "rloc": "MODELS:_MD_IRIS_REGRESSOR-2-560_26fbf8_1",
        "sloc": "redten-models-west:rt_models_userid_2_job_560_train_453_jobresults_416_modelid_11852_modelkey_MD_IRIS_REGRESSOR-2-560_26fbf8_1.cache.pickle.zlib",
        "target": "PetalLength",
        "tracking_id": "ML_IRIS_REGRESSOR-2-560_0253cc1aba9b4c71b1f69d5d2ae1952",
        "tracking_name": "IRIS_REGRESSOR-2-560",
        "tracking_type": "UseTargetColAndUnits"
    },
    "11853": {
        "rloc": "MODELS:_MD_IRIS_REGRESSOR-2-560_26fbf8_2",
        "sloc": "redten-models-west:rt_models_userid_2_job_560_train_453_jobresults_416_modelid_11853_modelkey_MD_IRIS_REGRESSOR-2-560_26fbf8_2.cache.pickle.zlib",
        "target": "PetalWidth",
        "tracking_id": "ML_IRIS_REGRESSOR-2-560_0253cc1aba9b4c71b1f69d5d2ae1952",
        "tracking_name": "IRIS_REGRESSOR-2-560",
        "tracking_type": "UseTargetColAndUnits"
    },
    "11854": {
        "rloc": "MODELS:_MD_IRIS_REGRESSOR-2-560_26fbf8_3",
        "sloc": "redten-models-west:rt_models_userid_2_job_560_train_453_jobresults_416_modelid_11854_modelkey_MD_IRIS_REGRESSOR-2-560_26fbf8_3.cache.pickle.zlib",
        "target": "SepalWidth",
        "tracking_id": "ML_IRIS_REGRESSOR-2-560_0253cc1aba9b4c71b1f69d5d2ae1952",
        "tracking_name": "IRIS_REGRESSOR-2-560",
        "tracking_type": "UseTargetColAndUnits"
    },
    "11855": {
        "rloc": "MODELS:_MD_IRIS_REGRESSOR-2-560_26fbf8_4",
        "sloc": "redten-models-west:rt_models_userid_2_job_560_train_453_jobresults_416_modelid_11855_modelkey_MD_IRIS_REGRESSOR-2-560_26fbf8_4.cache.pickle.zlib",
        "target": "ResultTargetValue",
        "tracking_id": "ML_IRIS_REGRESSOR-2-560_0253cc1aba9b4c71b1f69d5d2ae1952",
        "tracking_name": "IRIS_REGRESSOR-2-560",
        "tracking_type": "UseTargetColAndUnits"
    }
}

Multiple Models stored in Redis

Here's how models are stored in the Redis machine learning data store

Search Jobs in Elasticsearch

Red10 is running an ELK stack for searching by user, dataset identifiers, and jobs.

Once a job completes it is automatically published to Elasticsearch


In [7]:
search_req = {
        "title" : "Hello", # job title with completion
        "dsname" : "", # dataset name with completion
        "desc" : "", # description with completion
        "features" : "", # feature search
        "target_column" : "" # name of target column for this analysis
    }
job_search = {}
job_res = {}
if len(search_req) == 0 :
    boom("Please create a valid search request")
else:
    job_res = search_ml_jobs(search_req)

    if job_res["status"] != "SUCCESS":
        boom("Job=" + str(job_id) + " failed with status=" + str(job_res["status"]) + " err=" + str(job_res["error"]))
    else:
        job_search = job_res["record"]
        anmt("Job Matches=" + str(len(job_search)))
        lg(ppj(job_search), 5)


Searching ML Jobs url=https://redten.io/ml/search/
SUCCESS - Job Search Response Status=200 Reason=OK
Found Job={'target_column': '', 'desc': '', 'dsname': '', 'features': '', 'title': 'Hello'} results
Job Matches=1
{
    "jobs": [
        {
            "algo_name": "xgb-regressor",
            "desc": "This is a Description for - Hello World - 2017-05-26-08-11-22",
            "ds_name": "iris_regressor",
            "feature_column_names": [
                "SepalLength",
                "SepalWidth",
                "PetalLength",
                "PetalWidth",
                "ResultTargetValue"
            ],
            "ignore_features": [
                "ResultLabel"
            ],
            "images": [
                {
                    "id": 12135,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12135_6c01fa6f6cba42dd.png",
                    "title": "ResultTargetValue Importance Analysis"
                },
                {
                    "id": 12136,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12136_dd8628872bed4cb1.png",
                    "title": "Pair Plot - ResultLabel - /opt/work/data/src/pairplot_IRIS_REGRESSOR-2-559"
                },
                {
                    "id": 12137,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12137_e7b21aeada3f4056.png",
                    "title": "Scatter - SepalLength vs SepalWidth - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-559_0"
                },
                {
                    "id": 12138,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12138_d3fda8e628a0465c.png",
                    "title": "Scatter - SepalWidth vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-559_1"
                },
                {
                    "id": 12139,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12139_a107fe2096db4918.png",
                    "title": "Scatter - PetalLength vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-559_2"
                },
                {
                    "id": 12140,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12140_f8ee9a15e4554230.png",
                    "title": "Scatter - PetalWidth vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-559_3"
                },
                {
                    "id": 12141,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12141_bdd6cafc07684bee.png",
                    "title": "Scatter - ResultTargetValue vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-559_4"
                },
                {
                    "id": 12142,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12142_5f90b61973934f62.png",
                    "title": "Joint Plot - SepalLength vs SepalWidth - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-559_0"
                },
                {
                    "id": 12143,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12143_384b0e17ac724e6c.png",
                    "title": "Joint Plot - SepalWidth vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-559_1"
                },
                {
                    "id": 12144,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12144_8f23906138f94274.png",
                    "title": "Joint Plot - PetalLength vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-559_2"
                },
                {
                    "id": 12145,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12145_acc7e0137ba8401e.png",
                    "title": "Joint Plot - PetalWidth vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-559_3"
                },
                {
                    "id": 12146,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12146_4cc07105dfd4413f.png",
                    "title": "Joint Plot - ResultTargetValue vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-559_4"
                }
            ],
            "job_id": 559,
            "ml_type": "Predict with Filter",
            "prediction_type": "predict",
            "result_id": "",
            "target_column_name": "ResultLabel",
            "target_column_values": [
                "Iris-setosa",
                "Iris-versicolor",
                "Iris-virginica"
            ],
            "title": "Hello World - 2017-05-26-08-11-22",
            "train_id": 452,
            "user_id": 2,
            "username": "jay"
        },
        {
            "algo_name": "xgb-regressor",
            "desc": "This is a Description for - Hello World - 2017-05-23-22-48-19",
            "ds_name": "iris_regressor",
            "feature_column_names": [
                "SepalLength",
                "SepalWidth",
                "PetalLength",
                "PetalWidth",
                "ResultTargetValue"
            ],
            "ignore_features": [
                "ResultLabel"
            ],
            "images": [
                {
                    "id": 12080,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12080_bacd0a3063e643b1.png",
                    "title": "ResultTargetValue Importance Analysis"
                },
                {
                    "id": 12081,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12081_994b29e1e64b4c48.png",
                    "title": "Pair Plot - ResultLabel - /opt/work/data/src/pairplot_IRIS_REGRESSOR-2-557"
                },
                {
                    "id": 12082,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12082_160492c43ac5415d.png",
                    "title": "Scatter - SepalLength vs SepalWidth - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-557_0"
                },
                {
                    "id": 12083,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12083_87091b7a48f64bf8.png",
                    "title": "Scatter - SepalWidth vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-557_1"
                },
                {
                    "id": 12084,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12084_2b85954122e4452d.png",
                    "title": "Scatter - PetalLength vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-557_2"
                },
                {
                    "id": 12085,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12085_87d25f7a41ba41d5.png",
                    "title": "Scatter - PetalWidth vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-557_3"
                },
                {
                    "id": 12086,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12086_b3ef117e966d45a4.png",
                    "title": "Scatter - ResultTargetValue vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-557_4"
                },
                {
                    "id": 12087,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12087_f475c7062acc4e03.png",
                    "title": "Joint Plot - SepalLength vs SepalWidth - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-557_0"
                },
                {
                    "id": 12088,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12088_7316b1cc3a86413d.png",
                    "title": "Joint Plot - SepalWidth vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-557_1"
                },
                {
                    "id": 12089,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12089_db2ec909b1f84946.png",
                    "title": "Joint Plot - PetalLength vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-557_2"
                },
                {
                    "id": 12090,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12090_82e81ab1f9d54d09.png",
                    "title": "Joint Plot - PetalWidth vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-557_3"
                },
                {
                    "id": 12091,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12091_4fdb0c2731074b5c.png",
                    "title": "Joint Plot - ResultTargetValue vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-557_4"
                }
            ],
            "job_id": 557,
            "ml_type": "Predict with Filter",
            "prediction_type": "predict",
            "result_id": "",
            "target_column_name": "ResultLabel",
            "target_column_values": [
                "Iris-setosa",
                "Iris-versicolor",
                "Iris-virginica"
            ],
            "title": "Hello World - 2017-05-23-22-48-19",
            "train_id": 449,
            "user_id": 2,
            "username": "jay"
        },
        {
            "algo_name": "xgb-regressor",
            "desc": "This is a Description for - Hello World - 2017-05-26-17-49-22",
            "ds_name": "iris_regressor",
            "feature_column_names": [
                "SepalLength",
                "SepalWidth",
                "PetalLength",
                "PetalWidth",
                "ResultTargetValue"
            ],
            "ignore_features": [
                "ResultLabel"
            ],
            "images": [
                {
                    "id": 12147,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12147_5247822cd02242fb.png",
                    "title": "ResultTargetValue Importance Analysis"
                },
                {
                    "id": 12148,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12148_07ed6b645dac47a2.png",
                    "title": "Pair Plot - ResultLabel - /opt/work/data/src/pairplot_IRIS_REGRESSOR-2-560"
                },
                {
                    "id": 12149,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12149_bd798d8ff84f46f6.png",
                    "title": "Scatter - SepalLength vs SepalWidth - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_0"
                },
                {
                    "id": 12150,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12150_8166153a2f87499d.png",
                    "title": "Scatter - SepalWidth vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_1"
                },
                {
                    "id": 12151,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12151_17ef598b56e14f68.png",
                    "title": "Scatter - PetalLength vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_2"
                },
                {
                    "id": 12152,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12152_0c8343a342bb40fd.png",
                    "title": "Scatter - PetalWidth vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_3"
                },
                {
                    "id": 12153,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12153_80e4812b82a64e4b.png",
                    "title": "Scatter - ResultTargetValue vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_4"
                },
                {
                    "id": 12154,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12154_9b0be64a57fd484b.png",
                    "title": "Joint Plot - SepalLength vs SepalWidth - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_0"
                },
                {
                    "id": 12155,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12155_e1d895dcd1714932.png",
                    "title": "Joint Plot - SepalWidth vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_1"
                },
                {
                    "id": 12156,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12156_4a32649040c14ab6.png",
                    "title": "Joint Plot - PetalLength vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_2"
                },
                {
                    "id": 12157,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12157_0180f59977c44413.png",
                    "title": "Joint Plot - PetalWidth vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_3"
                },
                {
                    "id": 12158,
                    "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12158_68fe500cd7564213.png",
                    "title": "Joint Plot - ResultTargetValue vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_4"
                }
            ],
            "job_id": 560,
            "ml_type": "Predict with Filter",
            "prediction_type": "predict",
            "result_id": "",
            "target_column_name": "ResultLabel",
            "target_column_values": [
                "Iris-setosa",
                "Iris-versicolor",
                "Iris-virginica"
            ],
            "title": "Hello World - 2017-05-26-17-49-22",
            "train_id": 453,
            "user_id": 2,
            "username": "jay"
        }
    ]
}

Get the Recent Machine Learning Jobs


In [8]:
debug = False
user_token = user_login(rt_user, rt_pass, rt_url)
auth_headers = {
                "Authorization" : "JWT " + str(user_token)
            }
resource_url = rt_url + "/ml/run/"
query_params = {}
post_data = {}
uni = uni_key()

# Get the ML Job
resource_url = rt_url + "/ml/jobs/"

lg("Running Get ML Job url=" + str(resource_url), 6)
get_response = requests.get(resource_url, params=query_params, data=post_data, headers=auth_headers)

if get_response.status_code != 201 and get_response.status_code != 200:
    lg("Failed with GET Response Status=" + str(get_response.status_code) + " Reason=" + str(get_response.reason), 0)
    lg("Details:\n" + str(get_response.text) + "\n", 0)        
else:
    lg("SUCCESS - GET Response Status=" + str(get_response.status_code) + " Reason=" + str(get_response.reason)[0:10], 5)

    as_json = True
    record = {}
    if as_json:
        record = json.loads(get_response.text)
        lg(ppj(record))
# end of post for running an ML Job


Running Get ML Job url=https://redten.io/ml/jobs/
SUCCESS - GET Response Status=200 Reason=OK
{
    "jobs": [
        {
            "algo_name": "xgb-regressor",
            "control_state": "active",
            "created": "2017-05-26 17-49-23",
            "csv_file": "/opt/work/data/src/iris.csv",
            "desc": "This is a Description for - Hello World - 2017-05-26-17-49-22",
            "ds_name": "iris_regressor",
            "feature_column_names": [
                "SepalLength",
                "SepalWidth",
                "PetalLength",
                "PetalWidth",
                "ResultTargetValue"
            ],
            "id": 560,
            "ignore_features": [
                "ResultLabel"
            ],
            "images": [
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12158_68fe500cd7564213.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12157_0180f59977c44413.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12156_4a32649040c14ab6.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12155_e1d895dcd1714932.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12154_9b0be64a57fd484b.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12153_80e4812b82a64e4b.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12152_0c8343a342bb40fd.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12151_17ef598b56e14f68.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12150_8166153a2f87499d.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12149_bd798d8ff84f46f6.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12148_07ed6b645dac47a2.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12147_5247822cd02242fb.png"
            ],
            "manifest_secret_key": "live_2_2e975a62dd094d5bbdea7bbac0ad33b1bdb540f746f429d995d76acfee6af1",
            "manifest_sloc": "redten-models-west:IRIS_REGRESSOR-2-560_manifest.json",
            "max_features": 10,
            "ml_type": "Predict with Filter",
            "prediction_type": "predict",
            "rloc": "",
            "sloc": "",
            "status": "completed",
            "target_column_name": "ResultLabel",
            "target_column_values": [
                "Iris-setosa",
                "Iris-versicolor",
                "Iris-virginica"
            ],
            "title": "Hello World - 2017-05-26-17-49-22",
            "units_ahead_set": [],
            "units_ahead_type": "",
            "updated": "2017-05-26 17-49-42",
            "version": 1
        },
        {
            "algo_name": "xgb-regressor",
            "control_state": "active",
            "created": "2017-05-26 08-11-23",
            "csv_file": "/opt/work/data/src/iris.csv",
            "desc": "This is a Description for - Hello World - 2017-05-26-08-11-22",
            "ds_name": "iris_regressor",
            "feature_column_names": [
                "SepalLength",
                "SepalWidth",
                "PetalLength",
                "PetalWidth",
                "ResultTargetValue"
            ],
            "id": 559,
            "ignore_features": [
                "ResultLabel"
            ],
            "images": [
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12146_4cc07105dfd4413f.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12145_acc7e0137ba8401e.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12144_8f23906138f94274.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12143_384b0e17ac724e6c.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12142_5f90b61973934f62.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12141_bdd6cafc07684bee.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12140_f8ee9a15e4554230.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12139_a107fe2096db4918.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12138_d3fda8e628a0465c.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12137_e7b21aeada3f4056.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12136_dd8628872bed4cb1.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12135_6c01fa6f6cba42dd.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12134_2f0ad89e1bc64da7.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12133_2f543645ce494629.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12132_2a7bbad440484dd3.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12131_b299a0098b71444f.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12130_c16191ff6c8d44af.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12129_371450a1ef1e47e4.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12128_7c4b9e66bd3441e0.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12127_87635cf922604b93.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12126_6a78159747674e0f.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12125_6a75a51713984e45.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12124_f25d9790b4174026.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_559_12123_e8ef0af9bff14cca.png"
            ],
            "manifest_secret_key": "live_2_1060ffc68dac4497873d2548d1cfab6270625574ccb4b9994227d65ee7451c",
            "manifest_sloc": "redten-models-west:IRIS_REGRESSOR-2-559_manifest.json",
            "max_features": 10,
            "ml_type": "Predict with Filter",
            "prediction_type": "predict",
            "rloc": "",
            "sloc": "",
            "status": "completed",
            "target_column_name": "ResultLabel",
            "target_column_values": [
                "Iris-setosa",
                "Iris-versicolor",
                "Iris-virginica"
            ],
            "title": "Hello World - 2017-05-26-08-11-22",
            "units_ahead_set": [],
            "units_ahead_type": "",
            "updated": "2017-05-26 08-12-14",
            "version": 1
        },
        {
            "algo_name": "xgb-regressor",
            "control_state": "active",
            "created": "2017-05-26 08-02-13",
            "csv_file": "",
            "desc": "Forecast simulation - 2017-05-26 08:02:13",
            "ds_name": "SPY",
            "feature_column_names": [
                "FHigh",
                "FLow",
                "FOpen",
                "FClose",
                "FVolume"
            ],
            "id": 558,
            "ignore_features": [
                "Ticker",
                "Date",
                "FDate",
                "FPrice",
                "DcsnDate",
                "Decision"
            ],
            "images": [
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12122_7c49dccd964548fc.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12121_5ae84fdafa034174.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12120_2d87f32772344921.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12119_c54a1003037d4eb3.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12118_192e7a3c4ba840fc.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12117_6b74cc14075f4f20.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12116_1fed112e3a4e42ff.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12115_795d9657c2534f76.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12114_c19203024ec84944.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12113_1b000088cf154451.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12112_c72e079979774d17.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12111_b0c21c4c4d0d4e7a.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12110_2a27883839464a6c.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12109_325e5fefa07a444d.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12108_7dfe5cad6dd341c2.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12107_2fcaa612a10346d9.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12106_29c5e186270348f4.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12105_7139a2dd4df5447b.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12104_74d4b72e2bd342d6.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12103_286431b3eabc4af5.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12102_b8f6174000f5455c.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12101_bfe9888ad15648f9.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12100_0761ea1b0f684ce9.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12099_8f73f41290794595.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12098_5fd3e28826754f24.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12097_214858c79e704f4c.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12096_168bcf41ff5142ad.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12095_de06fd5548504b41.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12094_354bb5267c694ba5.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12093_e2ecdc03bc8a4f30.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_558_12092_954ad32f51ef47f4.png"
            ],
            "manifest_secret_key": "live_2_f3f31f711f1b4081862a1927be0758880c3b3f00e2848aeb2a7f68997b4e17",
            "manifest_sloc": "redten-models-west:SPY-2-558_manifest.json",
            "max_features": 10,
            "ml_type": "Playbook-UnitsAhead",
            "prediction_type": "forecast",
            "rloc": "",
            "sloc": "",
            "status": "completed",
            "target_column_name": "FClose",
            "target_column_values": [
                "GoodBuys",
                "BadBuys",
                "Not Finished"
            ],
            "title": "SPY Forecast v5 - 34d6bf175cad4aaf9234aa06e95f4e4",
            "units_ahead_set": [
                5,
                10,
                15,
                20,
                25,
                30
            ],
            "units_ahead_type": "Days",
            "updated": "2017-05-26 08-03-53",
            "version": 1
        },
        {
            "algo_name": "xgb-regressor",
            "control_state": "active",
            "created": "2017-05-23 22-48-19",
            "csv_file": "/opt/work/data/src/iris.csv",
            "desc": "This is a Description for - Hello World - 2017-05-23-22-48-19",
            "ds_name": "iris_regressor",
            "feature_column_names": [
                "SepalLength",
                "SepalWidth",
                "PetalLength",
                "PetalWidth",
                "ResultTargetValue"
            ],
            "id": 557,
            "ignore_features": [
                "ResultLabel"
            ],
            "images": [
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12091_4fdb0c2731074b5c.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12090_82e81ab1f9d54d09.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12089_db2ec909b1f84946.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12088_7316b1cc3a86413d.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12087_f475c7062acc4e03.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12086_b3ef117e966d45a4.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12085_87d25f7a41ba41d5.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12084_2b85954122e4452d.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12083_87091b7a48f64bf8.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12082_160492c43ac5415d.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12081_994b29e1e64b4c48.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12080_bacd0a3063e643b1.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12079_61d46d9599f6484d.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12078_8b49ca61b2984b6f.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12077_7c6bbe897e684ea3.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12076_ca83a370b4114a88.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12075_a0d64fc564fb4a3b.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12074_4591faca0ca54ecd.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12073_2a41ad8f67804a32.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12072_a4e071ac32fc4177.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12071_bc9e7fd426c444bf.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12070_7f5af55e914444aa.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12069_01ba1d04ca204f1a.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_557_12068_11ef9edc123542be.png"
            ],
            "manifest_secret_key": "live_2_9a5a34e96cca479e98ac8cc47d6fb53448557fa02d447c0bdcf167b8e4a645",
            "manifest_sloc": "redten-models-west:IRIS_REGRESSOR-2-557_manifest.json",
            "max_features": 10,
            "ml_type": "Predict with Filter",
            "prediction_type": "predict",
            "rloc": "",
            "sloc": "",
            "status": "completed",
            "target_column_name": "ResultLabel",
            "target_column_values": [
                "Iris-setosa",
                "Iris-versicolor",
                "Iris-virginica"
            ],
            "title": "Hello World - 2017-05-23-22-48-19",
            "units_ahead_set": [],
            "units_ahead_type": "",
            "updated": "2017-05-23 22-49-13",
            "version": 1
        },
        {
            "algo_name": "xgb-regressor",
            "control_state": "active",
            "created": "2017-05-23 22-24-09",
            "csv_file": "",
            "desc": "Forecast simulation - 2017-05-23 22:24:08",
            "ds_name": "SPY",
            "feature_column_names": [
                "FHigh",
                "FLow",
                "FOpen",
                "FClose",
                "FVolume"
            ],
            "id": 556,
            "ignore_features": [
                "Ticker",
                "Date",
                "FDate",
                "FPrice",
                "DcsnDate",
                "Decision"
            ],
            "images": [
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12067_a1d9483443844be5.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12066_bd242932692b48f1.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12065_c42e1ef3ecda4a50.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12064_4929471da7b848dc.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12063_3f0f9b7a91e6477d.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12062_50476dc42b95485a.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12061_087ef25764154835.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12060_c3c6ab2f04ae4669.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12059_974874fc3c0c4c4b.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12058_660025f112e04a51.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12057_ceced8e2215749e5.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12056_53ca82cd037c4ebb.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12055_76b743196398499f.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12054_72baf6fe1cff49dd.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12053_de8af6d2ab474eb4.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12052_26fbe6058c114619.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12051_184561aa8af3489a.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12050_430a5186b3d945e4.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12049_49d5e69d8c104eb2.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12048_7f90d455f7df4e2f.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12047_eba8de31f57e466a.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12046_8c585f82cd0948c5.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12045_db89689ffd49445c.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12044_f64ef76a00cb4bb9.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12043_ddeb69b9254b4595.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12042_152cb94cf47f4557.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12041_cf802c6530714ae7.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12040_a3e6aafa5e6241c4.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12039_dba3efb9b56c4bb5.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12038_c8fc6f8d4e294881.png",
                "https://rt-media.s3.amazonaws.com/media/imagesml/20170523/2_556_12037_0523b881d6a64baa.png"
            ],
            "manifest_secret_key": "live_2_ab288f9631d848b2a11cc4537728dc3d844c041bf934a6abdae5d6bbce3513",
            "manifest_sloc": "redten-models-west:SPY-2-556_manifest.json",
            "max_features": 10,
            "ml_type": "Playbook-UnitsAhead",
            "prediction_type": "forecast",
            "rloc": "",
            "sloc": "",
            "status": "completed",
            "target_column_name": "FClose",
            "target_column_values": [
                "GoodBuys",
                "BadBuys",
                "Not Finished"
            ],
            "title": "SPY Forecast v5 - 1394ae9d74c24d5886f9608d3dd6328",
            "units_ahead_set": [
                5,
                10,
                15,
                20,
                25,
                30
            ],
            "units_ahead_type": "Days",
            "updated": "2017-05-23 22-25-51",
            "version": 1
        }
    ]
}

Make a new Prediction using the pre-trained XGB Regressor Models


In [9]:
predict_row = {
                "SepalLength"       : 5.4,
                "SepalWidth"        : 3.4,
                "PetalLength"       : 1.7,
                "PetalWidth"        : 0.2,
                "ResultTargetValue" : 0
            }

post_data = {
            "use_cached_job_id" : job_id,
            "predict_this_data" : predict_row,
            "title" : title,
            "desc" : desc,
            "ds_name" : ds_name,
            "feature_column_names" : feature_column_names,
            "ignore_features" : ignore_features,
            "csv_file" : csv_file,
            "rloc" : rloc,
            "sloc" : sloc,
            "units_ahead" : units_ahead,
            "algo_name" : algo_name,
            "target_column_values" : target_column_values,
            "target_column_name" : target_column_name,
            "label_column_name" : label_column_name,
            "prediction_type" : "Predict",
            "ml_type" : "Predict with Filter",
            "user_id" : 2,
            "train" : {
                    "base_score" : 0.5,
                    "col_sample_by_level" : 1.0,
                    "col_sample_by_tree" : 0.8,
                    "gamma" : 0,
                    "learning_rate" : 0.1,
                    "max_delta_step" : 0,
                    "max_depth" : 6,
                    "min_child_weight" : 1,
                    "num_estimators" : 1000,
                    "objective" : "reg:linear",
                    "reg_alpha" : 0.0,
                    "reg_lambda" : 1.0,
                    "scaled_position_weight" : 1.0,
                    "seed" : 27,
                    "sub_sample" : 0.8,
                    "debug" : True
            },
            "max_features" : 10,
            "tracking_type" : "",
            "units_ahead_set" : [],
            "units_ahead_type" : "",
            "version" : 1
    }

#
"""
Login again in case the token expired waiting on the analysis which will show in the logs as:

Failed with Post Response Status=401 Reason=Unauthorized
Details:
{"detail":"Signature has expired."}
"""
user_token = rest_login_as_user(rt_user, rt_pass, rt_url)
post_headers = {
                "Content-type" : "application/json",
                "Authorization" : "JWT " + str(user_token)
            }
resource_url = rt_url + "/ml/run/"

lg("Utilizing Cached Models for new Prediction using ML Job url=" + str(resource_url), 6)
post_response = requests.post(resource_url, params=query_params, data=json.dumps(post_data), headers=post_headers)

if post_response.status_code != 201 and post_response.status_code != 200:
    lg("Failed with Post Response Status=" + str(post_response.status_code) + " Reason=" + str(post_response.reason), 0)
    lg("Details:\n" + str(post_response.text) + "\n", 0)
else:
    lg("SUCCESS - Post Response Status=" + str(post_response.status_code) + " Reason=" + str(post_response.reason), 5)

    record = post_response.json()
    lg(ppj(record))
    job_id = int(record["id"])
# end of post for running an ML Job


Utilizing Cached Models for new Prediction using ML Job url=https://redten.io/ml/run/
SUCCESS - Post Response Status=201 Reason=Created
{
    "algo_name": "xgb-regressor",
    "control_state": "active",
    "created": "2017-05-26 17-49-23",
    "csv_file": "/opt/work/data/src/iris.csv",
    "desc": "This is a Description for - Hello World - 2017-05-26-17-49-22",
    "ds_name": "iris_regressor",
    "feature_column_names": [
        "SepalLength",
        "SepalWidth",
        "PetalLength",
        "PetalWidth",
        "ResultTargetValue"
    ],
    "id": 560,
    "ignore_features": [
        "ResultLabel"
    ],
    "manifest_secret_key": "live_2_2e975a62dd094d5bbdea7bbac0ad33b1bdb540f746f429d995d76acfee6af1",
    "manifest_sloc": "redten-models-west:IRIS_REGRESSOR-2-560_manifest.json",
    "max_features": 10,
    "ml_type": "Predict with Filter",
    "prediction_type": "predict",
    "rloc": "",
    "sloc": "",
    "status": "completed",
    "target_column_name": "ResultLabel",
    "target_column_values": [
        "Iris-setosa",
        "Iris-versicolor",
        "Iris-virginica"
    ],
    "title": "Hello World - 2017-05-26-17-49-22",
    "units_ahead_set": [],
    "units_ahead_type": "",
    "updated": "2017-05-26 17-49-42",
    "version": 1
}

Wait for the Job to finish


In [10]:
job_data = {}
job_report = {}

job_res = {}
if job_id == None:
    boom("Failed to start a new job")
else:
    job_res = wait_on_job(job_id)

    if job_res["status"] != "SUCCESS":
        boom("Job=" + str(job_id) + " failed with status=" + str(job_res["status"]) + " err=" + str(job_res["error"]))
    else:
        job_data = job_res["record"]
        anmt("Job Report:")
        lg(ppj(job_data), 5)
# end of waiting


Waiting on job=560 url=https://redten.io/ml/560/
Job=560 is training - Step 3/10
Job=560 is plotting - Step 7/10
Job=560 is uploading - Step 9/10
Job=560 completed
Job Report:
{
    "job": {
        "algo_name": "xgb-regressor",
        "control_state": "active",
        "created": "2017-05-26 17-49-23",
        "csv_file": "/opt/work/data/src/iris.csv",
        "desc": "This is a Description for - Hello World - 2017-05-26-17-49-22",
        "ds_name": "iris_regressor",
        "feature_column_names": [
            "SepalLength",
            "SepalWidth",
            "PetalLength",
            "PetalWidth",
            "ResultTargetValue"
        ],
        "id": 560,
        "ignore_features": [
            "ResultLabel"
        ],
        "images": [
            {
                "author_name": null,
                "desc": null,
                "id": 12170,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12170_e4c5d75535004a21.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Joint Plot - ResultTargetValue vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_4",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12169,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12169_e2025b07c7e24a83.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Joint Plot - PetalWidth vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_3",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12168,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12168_ff223da922584537.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Joint Plot - PetalLength vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_2",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12167,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12167_9b9870cab7a04c99.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Joint Plot - SepalWidth vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_1",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12166,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12166_d9dd29fe5eaa48d3.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Joint Plot - SepalLength vs SepalWidth - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_0",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12165,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12165_33d5ce390f854ffb.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Scatter - ResultTargetValue vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_4",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12164,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12164_c1367c948b134554.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Scatter - PetalWidth vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_3",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12163,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12163_8dfe71c076824165.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Scatter - PetalLength vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_2",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12162,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12162_52608b634fff4050.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Scatter - SepalWidth vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_1",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12161,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12161_c89cc9f7a653453a.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Scatter - SepalLength vs SepalWidth - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_0",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12160,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12160_3da4e4350ed842c9.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Pair Plot - ResultLabel - /opt/work/data/src/pairplot_IRIS_REGRESSOR-2-560",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12159,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12159_81f43ec15ea94279.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "ResultTargetValue Importance Analysis",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12158,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12158_68fe500cd7564213.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Joint Plot - ResultTargetValue vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_4",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12157,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12157_0180f59977c44413.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Joint Plot - PetalWidth vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_3",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12156,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12156_4a32649040c14ab6.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Joint Plot - PetalLength vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_2",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12155,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12155_e1d895dcd1714932.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Joint Plot - SepalWidth vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_1",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12154,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12154_9b0be64a57fd484b.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Joint Plot - SepalLength vs SepalWidth - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_0",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12153,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12153_80e4812b82a64e4b.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Scatter - ResultTargetValue vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_4",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12152,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12152_0c8343a342bb40fd.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Scatter - PetalWidth vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_3",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12151,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12151_17ef598b56e14f68.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Scatter - PetalLength vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_2",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12150,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12150_8166153a2f87499d.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Scatter - SepalWidth vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_1",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12149,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12149_bd798d8ff84f46f6.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Scatter - SepalLength vs SepalWidth - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_0",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12148,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12148_07ed6b645dac47a2.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "Pair Plot - ResultLabel - /opt/work/data/src/pairplot_IRIS_REGRESSOR-2-560",
                "version": 1
            },
            {
                "author_name": null,
                "desc": null,
                "id": 12147,
                "image": "https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12147_5247822cd02242fb.png",
                "json_data": null,
                "label": null,
                "shareable_link": null,
                "sloc": null,
                "status": "initial",
                "title": "ResultTargetValue Importance Analysis",
                "version": 1
            }
        ],
        "manifest_secret_key": "live_2_87400592a6084c15b5df19be69196707430acf8edc440be8976af12199bb1b",
        "manifest_sloc": "redten-models-west:IRIS_REGRESSOR-2-560_manifest.json",
        "max_features": 10,
        "ml_type": "Predict with Filter",
        "prediction_type": "predict",
        "rloc": "",
        "sloc": "",
        "status": "completed",
        "target_column_name": "ResultLabel",
        "target_column_values": [
            "Iris-setosa",
            "Iris-versicolor",
            "Iris-virginica"
        ],
        "title": "Hello World - 2017-05-26-17-49-22",
        "units_ahead_set": [],
        "units_ahead_type": "",
        "updated": "2017-05-26 17-50-12",
        "version": 1
    }
}

Get the new Prediction results


In [11]:
job_report = {}
if job_id == None:
    boom("Failed to start a new prediction job")
else:
    # show the plots by default
    job_report = get_job_analysis(job_id)

    if len(job_report) == 0:
        boom("Job=" + str(job_id) + " failed making new prediction")
    # end of checking the report had data
# end of get job analysis


Getting analysis for job=560 url=https://redten.io/ml/analysis/560/
SUCCESS - GET Analysis Response Status=200 Reason=OK
Found Job=560 analysis
Joint Plot - ResultTargetValue vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_4
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12170_e4c5d75535004a21.png
---------------------------------------------------------------------------------------
Joint Plot - PetalWidth vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_3
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12169_e2025b07c7e24a83.png
---------------------------------------------------------------------------------------
Joint Plot - PetalLength vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_2
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12168_ff223da922584537.png
---------------------------------------------------------------------------------------
Joint Plot - SepalWidth vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_1
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12167_9b9870cab7a04c99.png
---------------------------------------------------------------------------------------
Joint Plot - SepalLength vs SepalWidth - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_0
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12166_d9dd29fe5eaa48d3.png
---------------------------------------------------------------------------------------
Scatter - ResultTargetValue vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_4
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12165_33d5ce390f854ffb.png
---------------------------------------------------------------------------------------
Scatter - PetalWidth vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_3
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12164_c1367c948b134554.png
---------------------------------------------------------------------------------------
Scatter - PetalLength vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_2
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12163_8dfe71c076824165.png
---------------------------------------------------------------------------------------
Scatter - SepalWidth vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_1
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12162_52608b634fff4050.png
---------------------------------------------------------------------------------------
Scatter - SepalLength vs SepalWidth - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_0
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12161_c89cc9f7a653453a.png
---------------------------------------------------------------------------------------
Pair Plot - ResultLabel - /opt/work/data/src/pairplot_IRIS_REGRESSOR-2-560
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12160_3da4e4350ed842c9.png
---------------------------------------------------------------------------------------
ResultTargetValue Importance Analysis
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12159_81f43ec15ea94279.png
---------------------------------------------------------------------------------------
Joint Plot - ResultTargetValue vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_4
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12158_68fe500cd7564213.png
---------------------------------------------------------------------------------------
Joint Plot - PetalWidth vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_3
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12157_0180f59977c44413.png
---------------------------------------------------------------------------------------
Joint Plot - PetalLength vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_2
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12156_4a32649040c14ab6.png
---------------------------------------------------------------------------------------
Joint Plot - SepalWidth vs SepalLength - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_1
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12155_e1d895dcd1714932.png
---------------------------------------------------------------------------------------
Joint Plot - SepalLength vs SepalWidth - /opt/work/data/src/jointplot_IRIS_REGRESSOR-2-560_0
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12154_9b0be64a57fd484b.png
---------------------------------------------------------------------------------------
Scatter - ResultTargetValue vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_4
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12153_80e4812b82a64e4b.png
---------------------------------------------------------------------------------------
Scatter - PetalWidth vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_3
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12152_0c8343a342bb40fd.png
---------------------------------------------------------------------------------------
Scatter - PetalLength vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_2
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12151_17ef598b56e14f68.png
---------------------------------------------------------------------------------------
Scatter - SepalWidth vs SepalLength - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_1
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12150_8166153a2f87499d.png
---------------------------------------------------------------------------------------
Scatter - SepalLength vs SepalWidth - /opt/work/data/src/scatter_IRIS_REGRESSOR-2-560_0
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12149_bd798d8ff84f46f6.png
---------------------------------------------------------------------------------------
Pair Plot - ResultLabel - /opt/work/data/src/pairplot_IRIS_REGRESSOR-2-560
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12148_07ed6b645dac47a2.png
---------------------------------------------------------------------------------------
ResultTargetValue Importance Analysis
URL: https://rt-media.s3.amazonaws.com/media/imagesml/20170526/2_560_12147_5247822cd02242fb.png
---------------------------------------------------------------------------------------