KeyError:“ float_scaler_mean”使用python

时间:2019-03-26 01:56:08

标签: python machine-learning scikit-learn floating-point keyerror

您好,谢谢您的宝贵时间> ... 我尝试了数百万次以解决此问题,但是我无法让所有其他代码都依赖于此代码,我欺骗了所获得的每个文件,而且一切看起来都很不错,但是我不知道自己做错了什么 我正在寻求您的帮助...

这是我的代码

import pandas as pd
import geopandas as gpd
import time
import pickle
import os
import numpy as np
import xgboost
import pytz
import arcgis
#
#plotting
#'''
from IPython.display import HTML, display
import datashader as ds
from datashader import transfer_functions as tf
from datashader.colors import colormap_select, Greys9, Hot, viridis, inferno
#'''

import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib.ticker import NullFormatter
import matplotlib as mpl
mpl.rc('xtick', color='k')
mpl.rc('ytick', color='k')
%matplotlib inline
#'''
from datetime import datetime, timedelta, timezone


import numpy as np

import matplotlib as mpl
from matplotlib import pyplot as plt
from matplotlib import cm

from sklearn.preprocessing import StandardScaler

with open('wrangler_new.pkl','rb') as fp:
    wrangler = pickle.load(fp)
float_scaler_mean = wrangler['float_scaler_mean']
float_scaler_std = wrangler['float_scaler_std']

float_feature_names = wrangler['float_feature_names']
ohe_fields = wrangler['ohe_fields']
feature_names = wrangler['feature_names']

booster = xgboost.Booster()
booster.load_model('new_0001.model')

这是错误

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-86-f1a726133274> in <module>
      1 with open('wrangler_new.pkl','rb') as fp:
      2     wrangler = pickle.load(fp)
----> 3 float_scaler_mean = wrangler['float_scaler_mean']
      4 float_scaler_std = wrangler['float_scaler_std']
      5 

KeyError: 'float_scaler_mean'

再次感谢您的帮助

0 个答案:

没有答案