当您在数据上训练回归模型时,您正在学习从输入特征到响应变量的映射。然后,通过将新的输入特征提供给模型,使用该映射进行预测。
如果你只想知道这两个特征如何影响预测,那么你可以查看训练模型的权重(也称为“参数”或“系数”)。如果特征1的权重为x,则当特征1增加1.0时,预测响应增加x。
output
sagemaker.estimator.Estimator
方法
import os
import mxnet as mx
import boto3
bucket = "<your_bucket>"
key = "<your_model_prefix>"
boto3.resource('s3').Bucket(bucket).download_file(key, 'model.tar.gz')
os.system('tar -zxvf model.tar.gz')
# Linear learner model is itself a zip file, containing a mxnet model and other metadata.
# First unzip the model.
os.system('unzip model_algo-1')
# Load the mxnet module
mod = mx.module.Module.load("mx-mod", 0)
# model weights
weights = mod._arg_params['fc0_weight'].asnumpy().flatten()
# model bias
bias = mod._arg_params['fc0_bias'].asnumpy().flatten()
# weight for the first feature
weights[0]